Skip to content

Instantly share code, notes, and snippets.

View alessaba's full-sized avatar

Alessandro Saba alessaba

  • 11:33 (UTC +02:00)
View GitHub Profile
@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!')
@alessaba
alessaba / TouchID.py
Last active October 27, 2021 03:53
TouchID.py
# coding: utf-8
from objc_util import *
ObjCClass('NSBundle').bundleWithPath_('/System/Library/Frameworks/LocalAuthentication.framework').load()
context = ObjCClass('LAContext').alloc().init()
policy = 1 #put 1 if you want to auth with password, 2 with passcode
reason = 'We need you fingerprint to ste...ehm... to log you in'
def funct(_cmd,success,error):
if success:
@alessaba
alessaba / PythonistaMod.py
Created July 29, 2015 11:45
PythonistaMod.py
# coding: utf-8
from objc_util import *
import ui
@on_main_thread
def main():
app=ObjCClass('UIApplication').sharedApplication() #Si accede all app in se
root_vc=app.keyWindow().rootViewController() #si accede alla view di base
mainView=root_vc.detailViewController().view() #Si acccede alla view principale
typedef enum _UIBackgroundStyle {
UIBackgroundStyleDefault,
UIBackgroundStyleTransparent,
UIBackgroundStyleLightBlur,
UIBackgroundStyleDarkBlur,
UIBackgroundStyleDarkTranslucent
} UIBackgroundStyle;
@interface UIApplication (UIBackgroundStyle)
-(void)_setBackgroundStyle:(UIBackgroundStyle)style;
@alessaba
alessaba / prowl_sender.py
Last active December 20, 2015 22:28
prowl_sender
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Sender (for Mac OS X)
# For details, in Mac OS X Terminal type: man pbcopy
import subprocess, sys
import prowlpy
def getClipboardData(): # Only works for data types: {txt | rtf | ps}
p = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE)
@alessaba
alessaba / prowl_reciever.py
Last active December 20, 2015 22:28
prowl_reciever
import clipboard,sys
#you have to set Prowl's custom url to 'pythonista://prowl_reciever?action=run&args=hello%20world' where 'hello%20world is the notification text.
#I'll use argv to take advantage of the Pythonista's URL Scheme.
text=str(sys.argv[1]).replace('[space]',' ') #the [space] is a space
clipboard.set('')
clipboard.set(text)
print text #Remove after debug