Skip to content

Instantly share code, notes, and snippets.

@thomasfinch
thomasfinch / nightShiftControl.sh
Created April 3, 2017 18:40
Bash script to enable/disable night shift on Mac OS
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Usage: $0 [enable|disable]"
exit 1
fi
plistLoc="/private/var/root/Library/Preferences/com.apple.CoreBrightness.plist"
currentUserUID=$(dscl . -read /Users/$(whoami)/ GeneratedUID) # Get the GeneratedUID for the current user
@thomasfinch
thomasfinch / buildFishiOS.sh
Created March 23, 2017 06:20
Bash script to build the fish shell for a jailbroken iOS device
#!/bin/bash
# Before running this script:
# Find AC_CHECK_FILES([/proc/self/stat]) in configure.ac and comment it out
# cd into the fish source directory
FLAGS="-stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -target armv7-apple-darwin16 -miphoneos-version-min=8.0.0"
PREFIX=$(pwd)"/deb"
# Build fish
@thomasfinch
thomasfinch / dumpTBD.py
Created September 12, 2016 15:09
TBD dumper, able to pull frameworks from a connected device and dump TBDs to the private frameworks folder automatically
#!/usr/local/bin/python
# Dumping all frameworks requires dsc_extractor, idk where to get it
import os, sys, shutil
device_ip = 'localhost'
device_port = '2222'
def dumpTBD(frameworkPath):
@thomasfinch
thomasfinch / HopperVCppDemangler.py
Last active September 3, 2017 16:23
A super crappy and kinda slow (it makes network calls!) Visual C++ demangler script for Hopper disassembler. Based on https://github.com/melomac/Hopper/blob/master/Demangle%20Swift.py, uses demangler.com
import urllib, urllib2
def demangle(symbol):
r = urllib2.Request('http://demangler.com/raw', urllib.urlencode({'input': symbol}))
response = urllib2.urlopen(r)
return response.read()
def main():
doc = Document.getCurrentDocument()
current = doc.getCurrentAddress()
@thomasfinch
thomasfinch / gadgetFinder.py
Last active June 4, 2018 06:18
Simple ROP gadget finder in python
import sys
from capstone import *
if len(sys.argv) < 2:
print 'Error: need file name argument'
exit()
# Read binary input file into an array
fileName = sys.argv[1]
file = open(fileName, "rb")
@thomasfinch
thomasfinch / gist:4b7166a81e56facf919d
Created July 1, 2015 02:43
Day progress mac app
#!/usr/bin/xcrun swift
import Foundation
import Cocoa
import AppKit
class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
let statusItem: NSStatusItem = NSStatusBar.systemStatusBar().statusItemWithLength(100)
let progressIndicator = NSProgressIndicator()
%hook SpringBoard
-(BOOL)homeScreenSupportsRotation {
return YES;
}
-(BOOL)homeScreenRotationStyleWantsUIKitRotation {
return YES;
}