From f7c287068e4e2122d589ca87b98cd19120cd352c Mon Sep 17 00:00:00 2001 From: Kevin Rode Date: Wed, 2 Oct 2019 01:11:09 -0400 Subject: [PATCH] App Extraction Added --- README.md | 7 ++- amt.py | 22 +++++-- helpers/__pycache__/extract.cpython-37.pyc | Bin 0 -> 2199 bytes helpers/__pycache__/root.cpython-37.pyc | Bin 3212 -> 3428 bytes helpers/extract.py | 69 +++++++++++++++++++++ helpers/root.py | 17 ++++- 6 files changed, 107 insertions(+), 8 deletions(-) create mode 100644 helpers/__pycache__/extract.cpython-37.pyc create mode 100644 helpers/extract.py diff --git a/README.md b/README.md index 912e573..feb428b 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,15 @@ 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 - + v1.0 + Initial version + Root any twrp compatible device diff --git a/amt.py b/amt.py index ad4c4e8..bd57cf7 100644 --- a/amt.py +++ b/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() diff --git a/helpers/__pycache__/extract.cpython-37.pyc b/helpers/__pycache__/extract.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fc1936a61ef28dbb95f0ca7208cba7ba81881c6b GIT binary patch literal 2199 zcmaJ?&2HQ_5GEz9R=fU58n{V=6a||WMN~8~nw%1(MUpl^4~=1@1`KTME@Y9$DytP0 zlIx#^d`cdmhdzJ}^wL+-wI{zqPW?z}9mi>^T@I-sXE@}1-{{HGQlH>iW`Ax!iU|3~ zzRVvVgGXq31A-Gyb26~Km(z(i@Mxp+2fmvN1_AeZ@P-UJyu(BEAz$KM9=)N1E??$7 z-p4573w#lCJx+fk@ugFECTlUR10|(N?VEkNXdSel(DWY=oE{NFj%kJ6uaOga?46J! z%KeItL&b{R_{RY>9{Nt@olr_J3eQH}6M|^rg9k@G{6vPl?48h~;NWf*{7kmLJwnV? z2fm7`a};7lzw&u_jZ|pP+XC;thSyiWZ{pO5JX)JwE%U_eN;SD{q|EhJ!gub712Kyj z7kgPM^dM3qm3u-R&Td>-yPIgUgA-eWIxzdHoQ2FP*o>_!p*4G27@^qyNEB>i^Z7a( zCE6_zJYK9lsq0QDOHttBM8cJaJE|8D!7!CYAyQK>S*JrT_lsO6yzZA%JsR$2xzP0| zO4zN2R@h0Q>TaHC!!uQf=~TI1A8I2ebtfyzsfoL_59fmjA{~izT!+mW>u7$Gy3;rh zY^N-A{w8V#-P?yxA8f53nvpDUH2D(2>8-~FS2E-5ncTs0wt)*AXJ%_8@=_?hB@T>A zQgf#~te56@=)$$Y&t(8YFig{rGqbB3n?FSa>6J;30<@l?@c zpZmatcd$}&p+{5NgpgO6waD$_VY&Ti$Jt@6YqPQ*3s#~o$&R~FPNgs3~Z z%rk>5s;n?^pe{i<2$HhYgC68CQ7SpCY3A;*5uaMSp3T(IuDgL(?bz$?!rp?ix|BlL z=e<+^1%<)6UsLeL15?1E%HuvTPOpI%ZQp6|4xW**rz%*4u<*eKGWOL7Rv0@*H1^%r zE${z^y5ehR*>LGYOVU_6X7$!)Kdk2>(Sixb0W%V;NG5{GU1rBPJ3Ew9 zwlAkSXL&Xj%t$sz`UCb+VqTx8CoS3S=jSrCI_t4j&C^8j)weXBr624srv@}&UR9zkg|kP9Ziz4 zz@|D5YAOdlj_!a`hfP2i!Lc~M1q+a`;6Ym&5XX)$AnmVDKlfHVVC759oMFXc#ugFB zkk2qMrq@AgktIa``heUk`?TkD5j_Of=+FEPJJuv#Q`kW(K*D_K5B@& zQhZ6nbR_ZhxtNT_Ht^vD4)4QK+bk36IZ%Wsozc0bV$8)zHU9nDmi?*8a$R@Z3hh2P v4yd({FU18sxKNynb5YoDfpR4*dN`4Mnu{OpvGiq#X6wk0R-&kXxgY)u$+aa2 literal 0 HcmV?d00001 diff --git a/helpers/__pycache__/root.cpython-37.pyc b/helpers/__pycache__/root.cpython-37.pyc index 28235f1c91cf02cd3731939b687b2bf2726c0b4a..324c94ddd52c8ec7bf28b7cdb784f347ca3d28c1 100644 GIT binary patch delta 1034 zcmZ9LOK%)S5P-XSb{;z~&#s+d$CkCk0kbje<`e`6kRXbLWPw5~8I2T?c&io!ZEd_nm>8y1>xF+BYoq&_;)J9bNQD`&dVxbbtYd zq(h7_CLQ4%CZuD8yR6+fd-5B+qj#XKe}rYI>tEm*B>E9=#WBUMlYB^$f31JzH$my= z{M!?E7N4_ePz3vPvjn5U&)^(@6~W9a{BxLws(~@io$~LS)2N7M%_7{NHy+yz*&X&N z`-~|z1I6|^dGq6yg5P5I7N!>R!a8ssgN)Id!ejU%-e$*J1)z0ck#(#VFgXPWn7V`w z{kygH>edU#t!+l`Z)~%nM^4RC3Wki*o7aun{kKai8$6se_mmpv?{>S`@2Dd=?hM4l z?(C^SKXs+p6;jBFS8b4Y$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l)g+*A)p?R0|XZcMhQv;bn==hZTfcz#t4Q9xO$r{!!7kGTbZq* zqh?Es{G@egMB9-pkXb}%B>b(mFLko1@R$0 B!RP=0 diff --git a/helpers/extract.py b/helpers/extract.py new file mode 100644 index 0000000..fc25fb2 --- /dev/null +++ b/helpers/extract.py @@ -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 diff --git a/helpers/root.py b/helpers/root.py index d882179..5ea3f4a 100644 --- a/helpers/root.py +++ b/helpers/root.py @@ -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")