This repository has been archived on 2023-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
Android-Mobile-Toolkit/helpers/extract.py

79 lines
2.4 KiB
Python
Raw Normal View History

2019-10-02 05:11:09 +00:00
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.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
2019-10-03 17:36:02 +00:00
else:
twrploc = 0
while twrploc == 0:
input("TWRP not found. Please ensure it is in the correct location and press enter to continue. ")
files = os.listdir(os.curdir)
for file in files:
if "twrp" in file:
twrp = file
twrploc = 1
2019-10-02 05:11:09 +00:00
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:
2019-10-03 17:36:02 +00:00
if os.path.isdir(o) == False:
os.makedirs(o)
2019-10-02 05:11:09 +00:00
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