diff --git a/Phone b/Phone index 7d4cef1..04009b5 100644 --- a/Phone +++ b/Phone @@ -2,73 +2,183 @@ import readline import os import re -from subprocess import check_output, run -from colorama import Fore +import shutil +from subprocess import check_output, run, CalledProcessError +from colorama import Fore, init import art -if os.name == "posix": - pass -else: - print(Fore.RED+"\n[!] OS not supported... Exiting !\n"+Fore.WHITE) - exit() - -os.system('clear') - -print(art.text2art("Phone")) -print(Fore.BLUE+"[+] Phone: A Mobile Phone Forensic Framework"+Fore.WHITE) -print(Fore.BLUE+"[+] Creator: @cyb3rf034r3ss ( X )\n"+Fore.WHITE) -print(Fore.YELLOW+"[x] Features:"+Fore.WHITE) -print(Fore.BLUE+"[*] Dump Call Logs"+Fore.WHITE) -print(Fore.BLUE+"[*] Dump SMS"+Fore.WHITE) -print(Fore.BLUE+"[*] Dump Photos"+Fore.WHITE) -print(Fore.BLUE+"[*] Dump Videos"+Fore.WHITE) -print(Fore.BLUE+"[*] Dump Installed Apks"+Fore.WHITE) -print(Fore.BLUE+"[*] Upload Files"+Fore.WHITE) -print(Fore.BLUE+"[*] Dump Documents"+Fore.WHITE) -print(Fore.BLUE+"[*] Find and extract informations from documents i.e passwords, emails, e.t.c"+Fore.WHITE) - -print(Fore.GREEN+"\n[x] Type 'help' or '?' to see available commands"+Fore.WHITE) -print() - -print(Fore.YELLOW+"[-] Connected Device:"+Fore.WHITE) -if "model" in check_output("adb devices -l", shell=True).decode(): - print("[x]", re.findall("device:[a-z]+[0-9]+[a-z]+", check_output("adb devices -l", shell=True).decode())[0]) - print() -else: - print(Fore.RED+"\n[!] No mobile phone detected\n"+Fore.WHITE) - exit() - -try: +# Initialize colorama for cross-platform color support +init() + +# Check if running on supported OS +if os.name != "posix": + print(Fore.RED + "\n[!] OS not supported... Exiting !\n" + Fore.RESET) + exit(1) + +# Create output directory if it doesn't exist +if not os.path.exists("Datas"): + os.makedirs("Datas") + +def clear_screen(): + os.system('clear' if os.name == 'posix' else 'cls') + +def check_adb_connection(): + try: + output = check_output("adb devices -l", shell=True).decode() + if "model" in output: + device = re.findall("device:[a-zA-Z0-9_-]+", output)[0] + return device + return None + except CalledProcessError: + return None + +def display_banner(): + clear_screen() + print(art.text2art("Phone")) + print(Fore.BLUE + "[+] Phone: A Mobile Phone Forensic Framework" + Fore.RESET) + print(Fore.BLUE + "[+] Creator: @cyb3rf034r3ss ( X )\n" + Fore.RESET) + print(Fore.YELLOW + "[x] Features:" + Fore.RESET) + print(Fore.BLUE + "[*] Dump Call Logs" + Fore.RESET) + print(Fore.BLUE + "[*] Dump SMS" + Fore.RESET) + print(Fore.BLUE + "[*] Dump Photos" + Fore.RESET) + print(Fore.BLUE + "[*] Dump Videos" + Fore.RESET) + print(Fore.BLUE + "[*] Dump Installed Apks" + Fore.RESET) + print(Fore.BLUE + "[*] Upload Files" + Fore.RESET) + print(Fore.BLUE + "[*] Dump Documents" + Fore.RESET) + print(Fore.BLUE + "[*] Find and extract informations from documents i.e passwords, emails, e.t.c" + Fore.RESET) + print(Fore.GREEN + "\n[x] Type 'help' or '?' to see available commands" + Fore.RESET) + print() + +def show_help(): + print(Fore.YELLOW + "\n[!] Available Commands\n" + Fore.RESET) + print(Fore.BLUE + "[*] clear: Clear The Screen" + Fore.RESET) + print(Fore.BLUE + "[*] dump_call_logs: Dump Call Logs From Device" + Fore.RESET) + print(Fore.BLUE + "[*] dump_sms: Dump SMS From Device" + Fore.RESET) + print(Fore.BLUE + "[*] dump_photos: Download All Images From Device" + Fore.RESET) + print(Fore.BLUE + "[*] dump_videos: Download All Videos From Device" + Fore.RESET) + print(Fore.BLUE + "[*] dump_in_apks: Download All Installed APKs" + Fore.RESET) + print(Fore.BLUE + "[*] dump_documents: Download All Documents From Device" + Fore.RESET) + print(Fore.BLUE + "[*] upload_file : Upload File to Device" + Fore.RESET) + print(Fore.BLUE + "[*] exfil: Exfiltrate Information From Documents" + Fore.RESET) + print(Fore.BLUE + "[*] exit / quit: Exit From Phone" + Fore.RESET) + print() + +def dump_call_logs(): + try: + check_output("adb backup -noapk -f Datas/Phone_call_logs.ab com.android.calllogbackup", shell=True) + print(Fore.BLUE + "\n[+] Call logs dumped successfully" + Fore.RESET) + except CalledProcessError as e: + print(Fore.RED + f"\n[!] Error dumping call logs: {e}" + Fore.RESET) + +def dump_videos(): + try: + check_output("adb pull /sdcard/DCIM/Camera Datas/", shell=True) + print(Fore.BLUE + "\n[+] Videos dumped successfully" + Fore.RESET) + except CalledProcessError as e: + print(Fore.RED + f"\n[!] Error dumping videos: {e}" + Fore.RESET) + +def dump_apks(): + try: + packages = check_output("adb shell pm list packages -f", shell=True).decode().splitlines() + for package in packages: + path = package.split("=")[0].replace("package:", "") + package_name = package.split("=")[1] + check_output(f"adb pull {path} Datas/{package_name}.apk", shell=True) + print(Fore.BLUE + "\n[+] APKs dumped successfully" + Fore.RESET) + except CalledProcessError as e: + print(Fore.RED + f"\n[!] Error dumping APKs: {e}" + Fore.RESET) + +def dump_documents(): + try: + check_output("adb pull /sdcard/Documents Datas/", shell=True) + print(Fore.BLUE + "\n[+] Documents dumped successfully" + Fore.RESET) + except CalledProcessError as e: + print(Fore.RED + f"\n[!] Error dumping documents: {e}" + Fore.RESET) + +def upload_file(file_path): + try: + check_output(f"adb push {file_path} /sdcard/", shell=True) + print(Fore.BLUE + f"\n[+] File {file_path} uploaded successfully" + Fore.RESET) + except CalledProcessError as e: + print(Fore.RED + f"\n[!] Error uploading file: {e}" + Fore.RESET) + +def exfil_data(): + try: + email_pattern = r"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}" + password_pattern = r"(?i)(?:password|pass|pw|key)[=:]?\s*([^\s]+)" + + for root, _, files in os.walk("Datas"): + for file in files: + file_path = os.path.join(root, file) + if file.endswith(('.txt', '.doc', '.docx', '.pdf')): + with open(file_path, 'r', errors='ignore') as f: + content = f.read() + emails = re.findall(email_pattern, content) + passwords = re.findall(password_pattern, content) + + if emails or passwords: + print(Fore.GREEN + f"\n[+] Found in {file_path}:" + Fore.RESET) + for email in emails: + print(Fore.BLUE + f"Email: {email}" + Fore.RESET) + for password in passwords: + print(Fore.BLUE + f"Password: {password}" + Fore.RESET) + except Exception as e: + print(Fore.RED + f"\n[!] Error during exfiltration: {e}" + Fore.RESET) + +def main(): + display_banner() + + device = check_adb_connection() + if not device: + print(Fore.RED + "\n[!] No mobile phone detected\n" + Fore.RESET) + exit(1) + + print(Fore.YELLOW + "[-] Connected Device:" + Fore.RESET) + print(f"[x] {device}\n") + while True: - shell = input("[x] Phone >> ") - if shell == "help" or shell == "?": - def get_help(): - print(Fore.YELLOW+"\n[!] Available Commands\n"+Fore.WHITE) - print(Fore.BLUE+"[*] clear: Clear The Screen"+Fore.WHITE) - print(Fore.BLUE+"[*] dump_call_logs: Dump Call Logs From Device"+Fore.WHITE) - print(Fore.BLUE+"[*] dump_sms: Dump SMS From Device"+Fore.WHITE) - print(Fore.BLUE+"[*] dump_photos: Download All Images From Device"+Fore.WHITE) - print(Fore.BLUE+"[*] dump_downloads: Dump All Downloads From Device"+Fore.WHITE) - print(Fore.BLUE+"[*] dump_in_apks: Download All Installed APKs"+Fore.WHITE) - print(Fore.BLUE+"[*] dump_documents: Download All Documents From Device"+Fore.WHITE) - print(Fore.BLUE+"[*] exfil: Exfiltrate Informations From Documents"+Fore.WHITE) - print(Fore.BLUE+"[*] exit / quit: Exit From Phone"+Fore.WHITE) - print() - get_help() - elif shell == "clear": - os.system('clear') - elif shell == "exit" or shell == "quit": - exit(0) - elif shell == "dump_sms": - check_output("adb backup -noapk -f Datas/Phone_dump_sms.ab -nocompress com.android.providers.telephony", shell=True) - print(Fore.BLUE+"\n[+] dump_sms completed... Extracting DB...\n"+Fore.WHITE) - check_output("mvt-android check-backup Datas/Phone_dump_sms.ab -o Datas/ && rm Datas/Phone_dump_sms.ab", shell=True) - elif shell == "dump_photos": - check_output("adb pull /sdcard/Pictures Datas/", shell=True) - print(Fore.BLUE+"\n[+] dump_photos completed...\n"+Fore.WHITE) - elif shell == "dump_downloads": - check_output("adb pull /sdcard/Download Datas/", shell=True) - print(Fore.BLUE+"\n[+] dump_downloads completed...\n"+Fore.WHITE) -except KeyboardInterrupt as e: - print(e) - exit() + try: + shell = input("[x] Phone >> ").strip() + + if shell in ["help", "?"]: + show_help() + elif shell == "clear": + display_banner() + elif shell in ["exit", "quit"]: + print(Fore.GREEN + "\n[+] Goodbye!" + Fore.RESET) + exit(0) + elif shell == "dump_call_logs": + dump_call_logs() + elif shell == "dump_sms": + check_output("adb backup -noapk -f Datas/Phone_dump_sms.ab com.android.providers.telephony", shell=True) + print(Fore.BLUE + "\n[+] SMS dumped successfully" + Fore.RESET) + elif shell == "dump_photos": + check_output("adb pull /sdcard/Pictures Datas/", shell=True) + print(Fore.BLUE + "\n[+] Photos dumped successfully" + Fore.RESET) + elif shell == "dump_videos": + dump_videos() + elif shell == "dump_in_apks": + dump_apks() + elif shell == "dump_documents": + dump_documents() + elif shell.startswith("upload_file"): + try: + _, file_path = shell.split(maxsplit=1) + upload_file(file_path) + except ValueError: + print(Fore.RED + "\n[!] Usage: upload_file " + Fore.RESET) + elif shell == "exfil": + exfil_data() + elif shell: + print(Fore.RED + f"\n[!] Unknown command: {shell}" + Fore.RESET) + + except KeyboardInterrupt: + print(Fore.GREEN + "\n[+] Goodbye!" + Fore.RESET) + exit(0) + except CalledProcessError as e: + print(Fore.RED + f"\n[!] Command failed: {e}" + Fore.RESET) + except Exception as e: + print(Fore.RED + f"\n[!] Error: {e}" + Fore.RESET) + +if __name__ == "__main__": + main() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..fca7a93 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +colorama==0.4.6 +art==6.1 +pip install mvt-android