From d576cd183568a13b595bd8477b01d90fb20e647c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=8D=8E?= <547996854@qq.com> Date: Tue, 14 Jun 2022 23:39:15 +0800 Subject: [PATCH 1/4] Update hook.py i always forget shell this word, because i use ssh root@127.0.0.1 -p 2222 many times so i think should add --ssh command --- frida-ios-hook/core/hook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frida-ios-hook/core/hook.py b/frida-ios-hook/core/hook.py index 6fc50f5..1bd5d4b 100755 --- a/frida-ios-hook/core/hook.py +++ b/frida-ios-hook/core/hook.py @@ -106,7 +106,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") From 3804724d256b4a9d04a89147a4cceb2a35e86aa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=8D=8E?= <547996854@qq.com> Date: Wed, 15 Jun 2022 16:26:54 +0800 Subject: [PATCH 2/4] Update hook.py when i use ioshook -n "xxx" -s backtrace.js show [ERROR] - [?] Script not found! i don't want to wirte so long dir --- frida-ios-hook/core/hook.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frida-ios-hook/core/hook.py b/frida-ios-hook/core/hook.py index 6fc50f5..8c43970 100755 --- a/frida-ios-hook/core/hook.py +++ b/frida-ios-hook/core/hook.py @@ -178,6 +178,8 @@ def main(): #Spawning application and load script elif options.package and options.script: + if not os.path.isfile(options.script): + options.script = APP_FRIDA_SCRIPTS +'/'+options.script if os.path.isfile(options.script): logger.info('[*] Spawning: ' + options.package) logger.info('[*] Script: ' + options.script) @@ -196,6 +198,8 @@ def main(): #Attaching script to application elif options.name and options.script: + if not os.path.isfile(options.script): + options.script = APP_FRIDA_SCRIPTS + '/'+options.script if os.path.isfile(options.script): logger.info('[*] Attaching: ' + options.name) logger.info('[*] Script: ' + options.script) From f42445716a4f0d7f13d42d4bd60e7224f7b7d179 Mon Sep 17 00:00:00 2001 From: noobpk Date: Sat, 18 Jun 2022 00:16:53 +0700 Subject: [PATCH 3/4] bump to version 3.7 --- .vscode/settings.json | 12 ++++++ CHANGELOG.md | 14 +++++++ LICENSE | 2 +- README.md | 20 +++++---- frida-ios-hook/core/hook.json | 2 +- frida-ios-hook/core/hook.py | 56 ++++++++++++++++++------- frida-ios-hook/core/utils/config.py | 10 ++--- frida-ios-hook/core/utils/suggestion.py | 19 +++++++++ 8 files changed, 105 insertions(+), 30 deletions(-) create mode 100644 frida-ios-hook/core/utils/suggestion.py 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..3dfc3fc 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 dbd5f4a..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() @@ -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,12 +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): - options.script = APP_FRIDA_SCRIPTS +'/'+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) @@ -192,14 +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): - options.script = APP_FRIDA_SCRIPTS + '/'+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) @@ -210,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": @@ -225,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": @@ -243,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": @@ -255,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": @@ -271,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": @@ -289,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: @@ -361,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, @@ -390,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 From 02fb440a2bfef43e815972a4d1067bd0902bc00e Mon Sep 17 00:00:00 2001 From: lethanhphuc <31820707+noobpk@users.noreply.github.com> Date: Sat, 18 Jun 2022 00:18:23 +0700 Subject: [PATCH 4/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3dfc3fc..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, --ssh Get the shell of connect device + --shell, --ssh Get the shell of connect device [*] Quick method: