Skip to content

Commit

Permalink
Merge pull request #53 from noobpk/dev
Browse files Browse the repository at this point in the history
Bump to version 3.7
  • Loading branch information
noobpk committed Jun 17, 2022
2 parents faf006c + 02fb440 commit 7f5ae63
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 29 deletions.
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
"."
]
}
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion frida-ios-hook/core/hook.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frida-ios-hook",
"version": "3.6",
"version": "3.7",
"cliVersion": "1.0",
"author": "noobpk",
"license": "LICENSE",
Expand Down
58 changes: 44 additions & 14 deletions frida-ios-hook/core/hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from utils.log import *
from utils.config import *
from utils.cli import *
from utils.suggestion import *

GLOBAL_CONFIG = config.loadConfig()

Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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":
Expand All @@ -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":
Expand All @@ -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":
Expand All @@ -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":
Expand All @@ -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":
Expand All @@ -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:
Expand Down Expand Up @@ -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,
Expand All @@ -386,5 +417,4 @@ def run():
main()

if __name__ == '__main__':
run()

run()
10 changes: 5 additions & 5 deletions frida-ios-hook/core/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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):
Expand All @@ -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']
Expand All @@ -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
Expand Down Expand Up @@ -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))
Expand Down
19 changes: 19 additions & 0 deletions frida-ios-hook/core/utils/suggestion.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 7f5ae63

Please sign in to comment.