All backup methods implimented

This commit is contained in:
Kass Rode 2024-08-17 16:39:26 -04:00
parent d3706c129c
commit d97d3b9113
6 changed files with 41 additions and 14 deletions

5
.gitignore vendored
View File

@ -1,4 +1,5 @@
*.pyc
twrp.img
*.img
*.ab
*.tar.gz
*.tar
*.zip

9
README.md Normal file
View File

@ -0,0 +1,9 @@
# Acquisition Script for Mobile Resources
## Written by Kassiopia Rode
This script is designed to ease the aquisition of Android devices. It has options for a Physical extraction (requires bootloader to be unlocked), logical extraction, and adb backups
### Requirements
This script was built using Python 3.10.12 but any version 3.10+ should work. \
Required libraries can be installed with `pip install requirements.txt` \
All device extraction methods require USB Debugging to be enabled and the user to have the device passcode.
### Running the script
Run `python3 main.py` and select the relevant menu item

View File

@ -23,6 +23,10 @@ def connect_device():
def shell(device, command):
return device.shell(command)
def pull(device, ipath, opath):
print(f"Pulling {ipath} to {opath}...")
os.system(f'adb pull {ipath} {opath}')
def reboot_bootloader():
print("Rebooting to Bootloader...")
os.system('adb reboot-bootloader')

27
main.py
View File

@ -29,6 +29,9 @@ def device_pull():
print("Unable to connect to device. Ensure that Debug Mode is enabled and USB Debugging is allowed")
sys.exit()
print("getting twrp...")
if os.path.isfile('./twrp.img'):
pass
else:
download_twrp()
adb.reboot_bootloader()
fastboot.devices()
@ -40,14 +43,26 @@ def device_pull():
except:
time.sleep(10)
device = adb.connect_device()
command = adb.shell(device, "whoami")
print(command)
adb.pull(device, "/dev/block/sda", "./sda.img")
def logicpull():
install.main()
print("Connecting Device...")
try:
device = adb.connect_device()
except:
print("Unable to connect to device. Ensure that Debug Mode is enabled and USB Debugging is allowed")
sys.exit()
print("pulling data...")
adb.pull(device, "/sdcard", "./sdcard")
os.system('zip -r logical.zip ./sdcard')
os.system("rm -r ./sdcard")
def menu():
print('Acquisition Script for Mobile Resources')
print("---------------------------------------")
print("[1] Device Pull")
print("[2] Application Pull")
print("[1] Physical Image")
print("[2] Logical Image")
print("[3] ADB Backup")
print("[99] Exit")
@ -58,10 +73,10 @@ def main():
case 1:
device_pull()
case 2:
pass
logicpull()
case 3:
adb.backup()
os.system("python helpers/unpackBackup.py -i ./backup.ab")
os.system("dd if=backup.ab bs=1 skip=24 | python3 -c 'import zlib,sys;sys.stdout.buffer.write(zlib.decompress(sys.stdin.buffer.read()))' > backup.tar")
case 99:
sys.exit()

3
requirements.txt Normal file
View File

@ -0,0 +1,3 @@
lxml==4.8.0
pure_python_adb==0.3.0.dev0
Requests==2.32.3

View File

@ -1,5 +0,0 @@
import os, subprocess
unlock = os.popen('fastboot getvar unlocked 2>&1').read()
print(unlock)
#if "yes" not in unlock:
# print(True)