diff --git a/.vscode/settings.json b/.vscode/settings.json index 6d3be3d..512cd23 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,5 +6,17 @@ "ideviceinstaller", "libimobiledevice", "noobpk" + ], + "python.testing.unittestArgs": [ + "-v", + "-s", + ".", + "-p", + "*_test.py" + ], + "python.testing.pytestEnabled": true, + "python.testing.unittestEnabled": false, + "python.testing.pytestArgs": [ + "." ] } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 73d5e08..3f3560c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Frida iOS Hook ChangeLog +## [Release 3.7] - 2022-06-17 + +### Added +- Add setup.py for build executable +- Add --ssh to option Get the shell of connect device +- Add suggestion script for option -s (--script) +### Changed +- Update readme, changelog +- Update frida-script +- Update hook.py +### Fixed +- Fix syntax in hook.json +- Fix psutil not found + ## [Unrelease] - 2022-04-18 ### Added diff --git a/LICENSE b/LICENSE index 9e7c67c..194435c 100755 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 lethanhphuc +Copyright (c) 2020 lethanhphuc noobpk Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 08ff2f2..3b87884 100755 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ Support both spawn & attach script to process. --list-appinfo List Info of Apps on Itunes --list-scripts List All Scripts --logcat Show system log of device - --shell Get the shell of connect device + --shell, --ssh Get the shell of connect device [*] Quick method: @@ -79,26 +79,30 @@ Support both spawn & attach script to process. ## 📜 ChangeLog -Version: 3.6 +Version: 3.7 ``` [+] Add: - [-] New option Show system log of device `--logcat` + [-] Add setup.py for build executable - [-] New option Get the shell of connect device `--shell` + [-] Add `--ssh` to option Get the shell of connect device - [-] Add CHANGELOG.md + [-] Add suggestion script for option `-s (--script)` [+] Change: - [-] Update README.md + [-] Update readme, changelog - [-] Using `hook.json` to load configuration for the tool + [-] Update frida-script - [-] Optimize core `hook.py` + [-] Update hook.py [+] Fix + + [-] Fix syntax in hook.json + + [-] Fix psutil not found ``` [See Full ChangeLog](https://github.com/noobpk/frida-ios-hook/blob/master/CHANGELOG.md) diff --git a/frida-ios-hook/core/hook.json b/frida-ios-hook/core/hook.json index 05a293d..6be864f 100644 --- a/frida-ios-hook/core/hook.json +++ b/frida-ios-hook/core/hook.json @@ -1,6 +1,6 @@ { "name": "frida-ios-hook", - "version": "3.6", + "version": "3.7", "cliVersion": "1.0", "author": "noobpk", "license": "LICENSE", diff --git a/frida-ios-hook/core/hook.py b/frida-ios-hook/core/hook.py index 6fc50f5..3570b17 100755 --- a/frida-ios-hook/core/hook.py +++ b/frida-ios-hook/core/hook.py @@ -13,6 +13,7 @@ from utils.log import * from utils.config import * from utils.cli import * +from utils.suggestion import * GLOBAL_CONFIG = config.loadConfig() @@ -106,7 +107,7 @@ def main(): info.add_option("--list-scripts", action="store_true", help="List All Scripts", dest="listscripts") info.add_option("--logcat", action="store_true", help="Show system log of device", dest="logcat") - info.add_option("--shell", action="store_true", help="Get the shell of connect device", dest="shell") + info.add_option("--shell", "--ssh", action="store_true", help="Get the shell of connect device", dest="shell") #Dump decrypt IPA using the code of the AloneMonkey's repo frida-ios-dump - Link: https://github.com/AloneMonkey/frida-ios-dump dump.add_option("-d", "--dump", action="store_true", help="Dump decrypt application.ipa", dest="dumpapp") dump.add_option("-o", "--output", action="store" , dest="output_ipa", help="Specify name of the decrypted IPA", metavar="OUTPUT_IPA", type="string") @@ -146,7 +147,7 @@ def main(): os.system('frida -U -n '+ process + ' -l ' + method) #sys.stdin.read() else: - logger.error('[?] Script not found!') + logger.error('[x_x] Script not found!') elif options.listscripts: path = APP_FRIDA_SCRIPTS @@ -174,10 +175,25 @@ def main(): version = re.sub('\s+', '', line[12:]) print('|%d|%s|%s|%s|%s|' % (i, mode, file_name, description, version)) else: - logger.error('[?] Path frida-script not exists!') + logger.error('[x_x] Path frida-script not exists!') #Spawning application and load script elif options.package and options.script: + if not os.path.isfile(options.script): + logger.warning('[!] Script '+options.script+' not found. Try suggestion in frida-script!') + findingScript = suggestion_script(options.script) + if (findingScript == False): + logger.error('[x_x] No matching suggestions!') + sys.exit(0) + logger.info('[*] iOSHook suggestion use '+findingScript) + answer = input('[?] Do you want continue? (y/n): ') or "y" + if answer == "y": + options.script = APP_FRIDA_SCRIPTS + findingScript + elif answer == "n": + sys.exit(0) + else: + logger.error('[x_x] Nothing done. Please try again!') + sys.exit(0) if os.path.isfile(options.script): logger.info('[*] Spawning: ' + options.package) logger.info('[*] Script: ' + options.script) @@ -190,12 +206,27 @@ def main(): frida.get_usb_device().resume(pid) sys.stdin.read() else: - logger.error('[?] Script not found!') + logger.error('[x_x] Script not found!') #Spawning application and load script with output #Attaching script to application elif options.name and options.script: + if not os.path.isfile(options.script): + logger.warning('[!] Script '+options.script+' not found. Try suggestion in frida-script!') + findingScript = suggestion_script(options.script) + if (findingScript == False): + logger.error('[x_x] No matching suggestions!') + sys.exit(0) + logger.info('[*] iOSHook suggestion use '+findingScript) + answer = input('[?] Do you want continue? (y/n): ') or "y" + if answer == "y": + options.script = APP_FRIDA_SCRIPTS + findingScript + elif answer == "n": + sys.exit(0) + else: + logger.error('[x_x] Nothing done. Please try again!') + sys.exit(0) if os.path.isfile(options.script): logger.info('[*] Attaching: ' + options.name) logger.info('[*] Script: ' + options.script) @@ -206,7 +237,7 @@ def main(): script.load() sys.stdin.read() else: - logger.error('[?] Script not found!') + logger.error('[x_x] Script not found!') #Static Analysis Application elif options.name and options.method == "app-static": @@ -221,7 +252,7 @@ def main(): script.load() sys.stdin.read() else: - logger.error('[?] Script not found!') + logger.error('[x_x] Script not found!') #Bypass jailbreak elif options.package and options.method == "bypass-jb": @@ -239,7 +270,7 @@ def main(): frida.get_usb_device().resume(pid) sys.stdin.read() else: - logger.error('[?] Script for method not found!') + logger.error('[x_x] Script for method not found!') #Bypass SSL Pinning elif options.package and options.method == "bypass-ssl": @@ -251,7 +282,7 @@ def main(): os.system('frida -U -f '+ options.package + ' -l ' + method + ' --no-pause') #sys.stdin.read() else: - logger.error('[?] Script for method not found!') + logger.error('[x_x] Script for method not found!') #Intercept url request in app elif options.name and options.method == "i-url-req": @@ -267,7 +298,7 @@ def main(): script.load() sys.stdin.read() else: - logger.error('[?] Script for method not found!') + logger.error('[x_x] Script for method not found!') #Intercept Crypto Operations elif options.package and options.method == "i-crypto": @@ -285,7 +316,7 @@ def main(): frida.get_usb_device().resume(pid) sys.stdin.read() else: - logger.error('[?] Script for method not found!') + logger.error('[x_x] Script for method not found!') #check newversion elif options.checkversion: @@ -357,9 +388,9 @@ def main(): #EXCEPTION FOR FRIDA except frida.ServerNotRunningError: - logger.error("Frida server is not running.") + logger.error("[x_x] Frida server is not running.") except frida.TimedOutError: - logger.error("Timed out while waiting for device to appear.") + logger.error("[x_x] Timed out while waiting for device to appear.") except frida.TransportError: logger.error("[x_x] The application may crash or lose connection.") except (frida.ProcessNotFoundError, @@ -386,5 +417,4 @@ def run(): main() if __name__ == '__main__': - run() - + run() \ No newline at end of file diff --git a/frida-ios-hook/core/utils/config.py b/frida-ios-hook/core/utils/config.py index 1190d84..c867a0c 100644 --- a/frida-ios-hook/core/utils/config.py +++ b/frida-ios-hook/core/utils/config.py @@ -11,7 +11,7 @@ APP_AUTHOR = '' APP_VERSION = '' APP_SSH = '' -APP_PLATFORM_SUPORT = '' +APP_PLATFORM_SUPPORT = '' APP_FIRST_RUN = '' APP_PACKAGES = '' APP_CONFIG = 'core/hook.json' @@ -20,7 +20,7 @@ class config(): def loadConfig(): - global APP_VERSION, APP_AUTHOR, APP_SSH, APP_PLATFORM_SUPORT, APP_FIRST_RUN, APP_PACKAGES + global APP_VERSION, APP_AUTHOR, APP_SSH, APP_PLATFORM_SUPPORT, APP_FIRST_RUN, APP_PACKAGES try: if os.path.isfile(APP_CONFIG): @@ -35,7 +35,7 @@ def loadConfig(): APP_METHODS = obj['methods'] APP_UTILS = obj['utils'] APP_SSH = obj['ssh'] - APP_PLATFORM_SUPORT = obj['platformSupport'] + APP_PLATFORM_SUPPORT = obj['platformSupport'] APP_FIRST_RUN = obj['firstRun'] APP_PACKAGES = obj['packages'] APP_FRIDA_SCRIPTS = obj['fridaScripts'] @@ -46,7 +46,7 @@ def loadConfig(): "methods": APP_METHODS, "utils": APP_UTILS, "ssh": APP_SSH, - 'platformSupport': APP_PLATFORM_SUPORT, + 'platformSupport': APP_PLATFORM_SUPPORT, 'firstRun': APP_FIRST_RUN, 'packages': APP_PACKAGES, 'fridaScripts': APP_FRIDA_SCRIPTS @@ -105,7 +105,7 @@ def initLoad(): def platform(): try: - if sys.platform not in APP_PLATFORM_SUPORT: + if sys.platform not in APP_PLATFORM_SUPPORT: sys.exit(logger.error("[x_x] Your platform currently does not support.")) except Exception as e: logger.error("[x_x] Something went wrong, please check your error message.\n Message - {0}".format(e)) diff --git a/frida-ios-hook/core/utils/suggestion.py b/frida-ios-hook/core/utils/suggestion.py new file mode 100644 index 0000000..53bc3ab --- /dev/null +++ b/frida-ios-hook/core/utils/suggestion.py @@ -0,0 +1,19 @@ +import os +from utils.config import * + +GLOBAL_CONFIG = config.loadConfig() +APP_FRIDA_SCRIPTS = GLOBAL_CONFIG['fridaScripts'] + +list_Script = os.listdir(APP_FRIDA_SCRIPTS) + +def suggestion_script(word): + i = 0 + while i < len(list_Script): + if word[0] == list_Script[i][0] and word[1] == list_Script[i][1]: + return list_Script[i] + i += 1 + else: + return False + +# if __name__ == '__main__': +# suggestion_script() \ No newline at end of file