Skip to content

Instantly share code, notes, and snippets.

View alessaba's full-sized avatar

Alessandro Saba alessaba

  • Italy
View GitHub Profile
@alessaba
alessaba / extract_kernelcache
Created January 22, 2017 13:55
Very simple python script to extract the kernelcache from the device
#Pythonista needed
import console
console.open_in('/System/Library/Caches/com.apple.kernelcaches/kernelcache')
print('Done!')
# coding: utf-8
from objutil import *
import ui
colorpicker = ObjCClass('OMColorPickerViewController').new().autorelease()
clview = colorpicker.view()
clview.frame = CGRect((0, 0), (512, 512))
view = presentUIView(clview, 'Color Picker', 'sheet')
@alessaba
alessaba / VolumeControls.py
Created March 20, 2016 11:55
VolumeControls.py
# coding: utf-8
from objc_util import NSBundle, ObjCClass, on_main_thread
NSBundle.bundleWithPath_('/System/Library/Frameworks/MediaPlayer.framework').load()
MPVolumeView = ObjCClass('MPVolumeView')
volume_view = MPVolumeView.new().autorelease()
@on_main_thread
def set_system_volume(value):
volume_view.subviews()[0].value = value
@alessaba
alessaba / Omtab.py
Created January 17, 2016 17:42
Omtab.py
# coding: utf-8
from objc_util import *
import ui
def btnaction(sender):
print 'hellah'
tabvc=ObjCClass('UIApplication').sharedApplication().keyWindow().rootViewController().childViewControllers()[1]
toolbar=tabvc.toolbar()
@alessaba
alessaba / NewRightButton.py
Created January 17, 2016 16:36
NewRightButton.py
# coding: utf-8
from objc_util import *
from ui import Button
def btnaction(sender):
print 'Hello'
toolbar=UIApplication.sharedApplication().keyWindow().rootViewController().childViewControllers()[1].view()
btn=ui.Button(frame=(toolbar.size().width - 152 - 40,22,40,40))
@alessaba
alessaba / JailbreakTest.py
Last active December 24, 2015 12:11
JailbreakTest.py
# coding: utf-8
import os
def is_device_jailbroken():
try:
os.listdir('/private')
except OSError:
return False
return True
@alessaba
alessaba / JailbreakTest.py
Created October 19, 2015 18:40
JailbreakTest.py
# coding: utf-8
import subprocess
jailbroken=True
try:
subprocess.call(["ls", "-l"])
except OSError:
jailbroken=False
print 'Is my device jailbroken: '+ str(jailbroken)
@alessaba
alessaba / Recorder.py
Created August 29, 2015 11:07
Recorder.py
# coding: utf-8
from objc_util import *
AVAudioSession = ObjCClass('AVAudioSession')
shared_session = AVAudioSession.sharedInstance()
category_set = shared_session.setCategory_error_('AVAudioSessionCategoryPlayAndRecord', None)
settings = ObjCClass('NSMutableDictionary').dictionary()
kAudioFormatMPEG4AAC = 1633772320
settings.setObject_forKey_(kAudioFormatMPEG4AAC,'AVFormatIDKey')
@alessaba
alessaba / objutil.py
Created August 24, 2015 18:12
objutil.py
# coding: utf-8
from objc_util import *
import ctypes
import webbrowser
def parse_encoding(enc):
type_names={'c':'char',
'i':'int',
's':'short',
'l':'long',
@alessaba
alessaba / SetBadge.py
Created August 24, 2015 18:10
SetBadge.py
# coding: utf-8
from objc_util import *
from console import input_alert,hud_alert
badgesting = input_alert('App Badge','Not more than 5 charaters')
UIApplication.sharedApplication().setApplicationBadgeString_(badgesting[:5])
hud_alert('Badge Set!')