updated with pep8 compliance

This commit is contained in:
Kevin Rode 2019-09-29 15:20:36 -04:00
parent 51ef51bdf9
commit 453dc05611

11
amt.py
View File

@ -1,4 +1,4 @@
#amt.py # amt.py
""" """
Code to interact with an android device using ADB Code to interact with an android device using ADB
Written by Kevin Rode Written by Kevin Rode
@ -11,6 +11,8 @@ import re
import time import time
import requests import requests
from lxml import html from lxml import html
def adb_start(): def adb_start():
if "platform-tools" in os.environ['PATH']: if "platform-tools" in os.environ['PATH']:
print("ADB found in PATH") print("ADB found in PATH")
@ -34,7 +36,7 @@ def twrp_download(d):
found = 1 found = 1
if found != 1: if found != 1:
cpu = d.shell('cat /proc/cpuinfo | grep Hardware') cpu = d.shell('cat /proc/cpuinfo | grep Hardware')
cpu = cpu.replace(" ","") cpu = cpu.replace(" ", "")
cpu = re.sub(r'(.+:)', '', cpu) cpu = re.sub(r'(.+:)', '', cpu)
r = requests.get('https://dl.twrp.me/'+cpu) r = requests.get('https://dl.twrp.me/'+cpu)
tree = html.fromstring(r.text) tree = html.fromstring(r.text)
@ -91,12 +93,13 @@ def root_device():
for file in files: for file in files:
if "twrp" in file: if "twrp" in file:
twrp = file twrp = file
os.system(fastboot+ " boot "+twrp) os.system(fastboot + " boot "+twrp)
input("Press Enter when TWRP has booted") input("Press Enter when TWRP has booted")
print("Follow the onscreen directions to install Magisk (Located at the bottom of the install window)") print("Follow the onscreen directions to install Magisk (Located at the bottom of the install window)")
print("After Magisk installs click [Reboot] then [Do Not Install]") print("After Magisk installs click [Reboot] then [Do Not Install]")
input("Press Enter when the device has rebooted") input("Press Enter when the device has rebooted")
def menu(): def menu():
while True: while True:
print("[1] Root Device (WIP)\n[2] Extract Data (Coming Soon)\n[99] Quit") print("[1] Root Device (WIP)\n[2] Extract Data (Coming Soon)\n[99] Quit")
@ -113,6 +116,8 @@ def menu():
elif int(choice) == 99: elif int(choice) == 99:
print("Goodbye!") print("Goodbye!")
sys.exit() sys.exit()
def show_help(): def show_help():
print("Android Mobile Toolkit v1.1") print("Android Mobile Toolkit v1.1")
print("Written by Kevin Rode (kevroded)") print("Written by Kevin Rode (kevroded)")