#!/usr/bin/env python import pexpect import sys if len(sys.argv) < 2: print "I need a host specified!" sys.exit(1) key_string="Are you sure you want to continue connecting" session = pexpect.spawn('ssh root@%s -p 22' % sys.argv[1]) test=session.expect(['.assword:*', pexpect.TIMEOUT, key_string]) if test==0: session.sendline('alpine') sys.exit(0) elif test==1: print "Timeout failure for jail break test" session.sendline('exit') sys.exit(2) elif test==2: session.sendline('yes') test2=session.expect(['.assword:*', pexpect.TIMEOUT, key_string]) if test2 == 0: session.sendline('alpine') test3=session.expect(['.assword:*', pexpect.TIMEOUT, key_string]) if test3 == 0: print "Failed to log in! Quiting!" sys.exit(1) elif test3 == 1: session.sendline('exit') print "Default credentials found for jail broken iphone" sys.exit(0)