App Extraction Added
This commit is contained in:
parent
bc36d2bead
commit
f7c287068e
|
@ -15,6 +15,11 @@ A compiled version is available in the releases tab
|
|||
+ Add options to extract all data on the phone
|
||||
|
||||
## Changelog
|
||||
v1.1
|
||||
+ App extraction added
|
||||
+ Downloading twrp now happens without user interaction
|
||||
+ Root checking option added
|
||||
|
||||
v1.0.1
|
||||
+ Updated zip with correct files for rooting
|
||||
+ Spelling fixes
|
||||
|
|
22
amt.py
22
amt.py
|
@ -6,21 +6,24 @@ Last Updated Sep 28 2019
|
|||
"""
|
||||
import sys
|
||||
from helpers import root
|
||||
from helpers import extract
|
||||
|
||||
|
||||
def menu():
|
||||
while True:
|
||||
print("[1] Root Device (WIP)\n[2] Extract Data (Coming Soon)\n[99] Quit")
|
||||
print("[1] Root Device\n[2] Check root\n[3] Extract Data (WIP)\n[99] Quit")
|
||||
choice = input("Please select a number: ")
|
||||
if int(choice) == 1:
|
||||
root.root_device()
|
||||
elif int(choice) == 2:
|
||||
print("Data extraction is coming soon.")
|
||||
time.sleep(2)
|
||||
root.root_check()
|
||||
elif int(choice) == 3:
|
||||
extract.extract_menu()
|
||||
elif int(choice) == 99:
|
||||
print("Goodbye!")
|
||||
sys.exit()
|
||||
|
||||
else:
|
||||
print("Unknown input")
|
||||
|
||||
def show_help():
|
||||
print("Android Mobile Toolkit v1.1")
|
||||
|
@ -33,6 +36,8 @@ def show_help():
|
|||
print(" -i : alias for --interactive")
|
||||
print(" --root : root a connected Android device")
|
||||
print(" -r : alias for --root")
|
||||
print(" --check-root : checks if the device is rooted")
|
||||
print(" -Ae : Extract data in app extract mode. Add -o to specify an output directory")
|
||||
print(" --help : print this message")
|
||||
print(" -h : alias for --help")
|
||||
|
||||
|
@ -45,6 +50,15 @@ def main():
|
|||
root.root_device()
|
||||
elif "--help" in sys.argv[1:] or "-h" in sys.argv[1:]:
|
||||
show_help()
|
||||
elif "--check-root" in sys.argv[1:]:
|
||||
root.root_check()
|
||||
elif "-Ae" in sys.argv[1:]:
|
||||
if "-o" in sys.argv[1:]:
|
||||
output_index = sys.argv.index("-o")
|
||||
output = sys.argv[output_index+1]
|
||||
extract.app_extract(output)
|
||||
else:
|
||||
extract.app_extract()
|
||||
else:
|
||||
show_help()
|
||||
|
||||
|
|
BIN
helpers/__pycache__/extract.cpython-37.pyc
Normal file
BIN
helpers/__pycache__/extract.cpython-37.pyc
Normal file
Binary file not shown.
Binary file not shown.
69
helpers/extract.py
Normal file
69
helpers/extract.py
Normal file
|
@ -0,0 +1,69 @@
|
|||
import adbutils
|
||||
from helpers import root
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def recovery_boot():
|
||||
adb = "platform-tools\\adb.exe"
|
||||
adbcheck = os.popen(adb+" devices").read()
|
||||
if "recovery" in adbcheck:
|
||||
pass
|
||||
else:
|
||||
device = root.adb_connect()
|
||||
root.twrp_download(device)
|
||||
root.push_files(device)
|
||||
root.reboot_bootloader()
|
||||
adb = "platform-tools\\adb.exe"
|
||||
fastboot = "platform-tools\\fastboot.exe"
|
||||
files = os.listdir(os.curdir)
|
||||
for file in files:
|
||||
if "twrp" in file:
|
||||
twrp = file
|
||||
os.system(fastboot + " boot "+twrp)
|
||||
input("Press Enter when TWRP has booted")
|
||||
|
||||
|
||||
def list_apps():
|
||||
adb = "platform-tools\\adb.exe"
|
||||
apps = os.popen(adb+" shell (ls /data/data)").read()
|
||||
app_array = apps.split("\n")
|
||||
for i in app_array:
|
||||
print(i)
|
||||
|
||||
|
||||
def download_app(o=None):
|
||||
app = input("Please enter the name of the app you would like to download: ")
|
||||
adb = "platform-tools\\adb.exe"
|
||||
os.system(adb+" shell (cp -R /data/data/"+app+" /sdcard/"+app+")")
|
||||
if o == None:
|
||||
output = input("Please enter the output directory for the app files. Leave blank to download to current directory: ")
|
||||
if output != None:
|
||||
os.makedirs(output)
|
||||
os.system(adb+" pull /sdcard/"+app+" "+output)
|
||||
else:
|
||||
os.system(adb+" pull /sdcard/"+app)
|
||||
else:
|
||||
os.makedirs(o)
|
||||
os.system(adb+" pull /sdcard/"+app+" "+o)
|
||||
|
||||
|
||||
def app_extract(output=None):
|
||||
recovery_boot()
|
||||
list_apps()
|
||||
download_app(output)
|
||||
|
||||
|
||||
def extract_menu():
|
||||
while True:
|
||||
print("How would you like to extract data")
|
||||
print("[1] App extraction\n[2] Whole Phone Extraction (via Android Backup)(COMING SOON)\n[3] Whole Phone Extraction (via adb shell)(COMING SOON)\n[99] Main Menu")
|
||||
choice = input()
|
||||
if int(choice) == 1:
|
||||
app_extract()
|
||||
elif int(choice) == 2:
|
||||
print()
|
||||
elif int(choice) == 3:
|
||||
print()
|
||||
elif int(choice) == 99:
|
||||
break
|
|
@ -40,9 +40,11 @@ def twrp_download(d):
|
|||
downloads.append(i)
|
||||
url_to_download = "https://dl.twrp.me"+downloads[0]
|
||||
url_to_download = url_to_download.replace('.html', '')
|
||||
print("Use this link to download twrp for your connected device: "+url_to_download)
|
||||
print("Ensure that the downloaded file is moved to the same folder as the script before continuing")
|
||||
input("Press Enter to continue...")
|
||||
s = requests.Session()
|
||||
s.headers.update({'referer':url_to_download})
|
||||
img = s.get(url_to_download)
|
||||
with open("twrp.img",'wb') as f:
|
||||
f.write(img.content)
|
||||
files = os.listdir(os.curdir)
|
||||
for file in files:
|
||||
if "twrp" in file:
|
||||
|
@ -95,3 +97,12 @@ def root_device():
|
|||
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]")
|
||||
input("Press Enter when the device has rebooted")
|
||||
|
||||
|
||||
def root_check():
|
||||
device = adb_connect()
|
||||
rootcheck = device.shell("ls /sbin | grep su")
|
||||
if rootcheck != None:
|
||||
print("Device is rooted")
|
||||
else:
|
||||
print("Device is not rooted")
|
||||
|
|
Reference in New Issue
Block a user