{"id":13638493,"url":"https://github.com/Soulghost/iblessing","last_synced_at":"2025-04-19T18:30:39.361Z","repository":{"id":37315153,"uuid":"281391604","full_name":"Soulghost/iblessing","owner":"Soulghost","description":"iblessing is an iOS security exploiting toolkit, it mainly includes application information gathering, static analysis and dynamic analysis. It can be used for reverse engineering, binary analysis and vulnerability mining.","archived":false,"fork":false,"pushed_at":"2022-02-08T13:02:20.000Z","size":38095,"stargazers_count":626,"open_issues_count":3,"forks_count":91,"subscribers_count":24,"default_branch":"master","last_synced_at":"2024-11-09T08:39:49.264Z","etag":null,"topics":["exploit","ios","reverse-engineering","scanner","vulnerability","vulnerability-scanners"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Soulghost.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-21T12:27:29.000Z","updated_at":"2024-11-08T14:39:55.000Z","dependencies_parsed_at":"2022-07-14T00:50:34.692Z","dependency_job_id":null,"html_url":"https://github.com/Soulghost/iblessing","commit_stats":null,"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soulghost%2Fiblessing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soulghost%2Fiblessing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soulghost%2Fiblessing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Soulghost%2Fiblessing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Soulghost","download_url":"https://codeload.github.com/Soulghost/iblessing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249764702,"owners_count":21322286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["exploit","ios","reverse-engineering","scanner","vulnerability","vulnerability-scanners"],"created_at":"2024-08-02T01:00:46.796Z","updated_at":"2025-04-19T18:30:38.452Z","avatar_url":"https://github.com/Soulghost.png","language":"C++","funding_links":[],"categories":["C++","C++ (225)","Weapons"],"sub_categories":["iOS"],"readme":"           ☠️\n           ██╗██████╗ ██╗     ███████╗███████╗███████╗██╗███╗   ██╗ ██████╗\n           ██║██╔══██╗██║     ██╔════╝██╔════╝██╔════╝██║████╗  ██║██╔════╝\n           ██║██████╔╝██║     █████╗  ███████╗███████╗██║██╔██╗ ██║██║  ███╗\n           ██║██╔══██╗██║     ██╔══╝  ╚════██║╚════██║██║██║╚██╗██║██║   ██║\n           ██║██████╔╝███████╗███████╗███████║███████║██║██║ ╚████║╚██████╔╝\n           ╚═╝╚═════╝ ╚══════╝╚══════╝╚══════╝╚══════╝╚═╝╚═╝  ╚═══╝ ╚═════╝\n\n[![Build Status](https://api.travis-ci.com/Soulghost/iblessing.svg?branch=master)](https://app.travis-ci.com/github/Soulghost/iblessing)\n[![Releases](https://img.shields.io/github/v/release/Soulghost/iblessing?include_prereleases)](https://github.com/Soulghost/iblessing/releases)\n\n# iblessing\n- `iblessing` is an iOS security exploiting toolkit, it mainly includes **application information gathering**, **static analysis** and **dynamic analysis**.\n- `iblessing` is based on [unicorn engine](https://github.com/unicorn-engine/unicorn), [capstone engine](https://github.com/aquynh/capstone) and [keystone engine](https://github.com/keystone-engine/keystone).\n\n# Features\n- [x] 🔥 Cross-platform: Tested on macOS and Ubuntu.\n- [x] iOS App static info extract, including metadata, deeplinks, urls, etc.\n- [x] Mach-O parser and dyld symbol bind simulator\n- [x] Objective-C class realizing and parsing\n- [x] Scanners making dynamic analysis for arm64 assembly code and find key information or attack surface\n- [x] Scanners using unicorn to partially simulate Mach-O arm64 code execution and find some features\n- [x] Generators that can provide secondary processing on scanner's report to start a query server, or generate script for IDA\n\n- Super objc_msgSend xrefs scanner 😄\n    - [x] objc methods and subs (such as blocks) emulation to generate xrefs like flare-emu\n    - [x] objc function wrapper detect and ida usercall generate\n    - [x] objc_msgSend sub functions analysis\n    - [x] objc block to objc_msgSend xrefs in args and capture list\n    - [x] report format including json, etc.\n    - [ ] Swift class and method parsing\n    - [ ] following branches and calls\n    - [ ] SimProcedures for extern symbols\n\n- [x] Tests \n- [ ] Android Scanners Suport\n- [ ] Diagnostic logs\n- [ ] More flexible scanner infrastructure for new scanner plugins\n\n# Support \nIn case you need support regarding iblessing or anything associated with it, you can:\n- create an issue and provide necessary information\n- contact [Sou1gh0st](https://twitter.com/Sou1gh0st) on Twitter \n- send mail to xiuyutong1994#163.com \n- send mail to xiuyutong1994#gmail.com\n\n# Changelog\n- 2021.06.27 - New arch (Shell Programm + Core Library) and plugin support (beta)\n- 2021.01.23 - Add method signatures for system libraries (Foundation, UIKit), further enhanced analytical capabilities (https://github.com/Soulghost/iblessing/wiki/System-Libraries-(Foundation,-UIKit)-Simple-SimProcedure)\n- 2020.11.30 - Objc reflection info (https://github.com/Soulghost/iblessing/wiki/Objc-Reflection-Info)\n- 2020.10.24 - Objc call snapshots (https://github.com/Soulghost/iblessing/wiki/Objc-Call-Snapshots)\n- 2020.10.04 - Objc category list support\n- 2020.09.28 - Static library and fat mach-o support\n- 2020.09.22 - Basic program state and condition branching\n- 2020.09.04 - Method validation, infering, objc_msgSendSuper support\n- 2020.08.11 - Now iblessing is a cross-platform tool, support both macOS and Linux 😆\n- 2020.08.08 - Improve objc_msgSend xref scanner, add sub xref supoort, including block arguments and capture list\n- 2020.07.30 - Improve symbol-wrapper scanner, and add ida scripts for symbol wrapper rename and prototype modification\n- 2020.07.21 - First release \n\n# Get started\n⚠️⚠️⚠️ **Binary Scanners require 12GB of virtual memory space to loading a mach-o file, but won't consume so much. So you need to ensure that the physical memory of your working machine is greater than 12GB, or ensure that allocatable virtual memory is greater than 12GB through the swap file mechanism.**\n1. You can download the [pre-released iblessing binary](https://github.com/Soulghost/iblessing/releases) and enjoy it.\n2. run chmod +x for the binary\n3. For more tutorails, please check the [Documentation \u0026 Help](https://github.com/Soulghost/iblessing#documentation--help) below.\n\n# How to Use\n- Releases https://github.com/Soulghost/iblessing/releases\n\n## All in One Binary\n- iblessing-darwin-all/iblessing-linux\n\n## Shell Program + Dylib\n- untar iblessing-framework.tar.gz\n- iblessing-darwin/iblessing-linux + libiblessing-core.dylib/libiblessing-core.so\n\n## Develop Your Own Tools based on iblessing Framework\n- untar iblessing-framework.tar.gz\n- your binary + libiblessing-core.dylib/libiblessing-core.so + include/iblessing-core\n- sample code: iblessing-core/otool.cpp\n\n# How to Build\n## CMake\n- Platform: macOS, Linux\n\nTo get started compiling iblessing, please follow the steps below:\n```\ngit clone --recursive -j4 https://github.com/Soulghost/iblessing\ncd iblessing\n./compile-cmake.sh\n```\n\n## Shortcuts\n- [Basic Concepts](https://github.com/Soulghost/iblessing#basic-concepts)\n- Scanners\n  - [Scan for AppInfos](https://github.com/Soulghost/iblessing#scan-for-appinfos) ⚠️ Not currently available on Linux\n  - [Scan for Class XREFs](https://github.com/Soulghost/iblessing#scan-for-class-xrefs)\n  - [Scan for All objc_msgSend XREFs](https://github.com/Soulghost/iblessing#scan-for-all-objc_msgsend-xrefs)\n  - [Scan for Simple Symbol Wrappers](https://github.com/Soulghost/iblessing/blob/features/anti_wrapper/README.md#scan-for-symbol-wrappers)\n \n- Generators\n  - [Generate objc_msgSend Xrefs Query Server](https://github.com/Soulghost/iblessing#generate-objc_msgsend-xrefs-query-server)\n  - [Generate IDA Scripts for objc_msgSend xrefs](https://github.com/Soulghost/iblessing#generate-ida-scripts-for-objc_msgsend-xrefs)\n  - [Generate IDA Scripts for objc function wrapper rename and prototype modification](https://github.com/Soulghost/iblessing/blob/features/anti_wrapper/README.md#genereate-ida-script-for-objc-runtime-function-rename-and-prototype-modification)\n\n***If there are any errors, you can manully compile capstone and unicorn, then drag libcapstone.a and libunicorn.a to the Xcode project's vendor/libs.***\n\nIf all of this run successfully, you can find the binary in build directory:\n```\n\u003e ls ./build\niblessing\n\n\u003e file ./build/iblessing\n./build/iblessing: Mach-O 64-bit executable x86_64\n```\n\n# Documentation \u0026 Help\n## Preview\n```\n$ iblessing -h\n\n           ☠️\n           ██╗██████╗ ██╗     ███████╗███████╗███████╗██╗███╗   ██╗ ██████╗\n           ██║██╔══██╗██║     ██╔════╝██╔════╝██╔════╝██║████╗  ██║██╔════╝\n           ██║██████╔╝██║     █████╗  ███████╗███████╗██║██╔██╗ ██║██║  ███╗\n           ██║██╔══██╗██║     ██╔══╝  ╚════██║╚════██║██║██║╚██╗██║██║   ██║\n           ██║██████╔╝███████╗███████╗███████║███████║██║██║ ╚████║╚██████╔╝\n           ╚═╝╚═════╝ ╚══════╝╚══════╝╚══════╝╚══════╝╚═╝╚═╝  ╚═══╝ ╚═════╝\n\n[***] iblessing iOS Security Exploiting Toolkit Beta 0.1.1 (http://blog.asm.im)\n[***] Author: Soulghost (高级页面仔) @ (https://github.com/Soulghost)\n\nUsage: iblessing [options...]\nOptions:\n    -m, --mode             mode selection:\n                                * scan: use scanner\n                                * generator: use generator\n    -i, --identifier       choose module by identifier:\n                                * \u003cscanner-id\u003e: use specific scanner\n                                * \u003cgenerator-id\u003e: use specific generator\n    -f, --file             input file path\n    -o, --output           output file path\n    -l, --list             list available scanners\n    -d, --data             extra data\n    -h, --help             Shows this page\n```\n\n## Basic Concepts\n### Scanner\nA scanner is a component used to output analysis report through static and dynamic analysis of binary files, for example, the objc-msg-xref scanner can dynamiclly analyze most objc_msgSend cross references.\n\n```\n[*] Scanner List:\n    - app-info: extract app infos\n    - objc-class-xref: scan for class xrefs\n    - objc-msg-xref: generate objc_msgSend xrefs record\n    - predicate: scan for NSPredicate xrefs and sql injection surfaces\n    - symbol-wrapper: detect symbol wrappers\n```\n\n### Generator\nA generator is a component that performs secondary processing on the report generated by the scanner, for example, it can generate IDA scripts based on the the objc-msg-xref scanner's cross references report.\n\n```\n[*] Generator List:\n    - ida-objc-msg-xref: generator ida scripts to add objc_msgSend xrefs from objc-msg-xref scanner's report\n    - objc-msg-xref-server: server to query objc-msg xrefs\n    - objc-msg-xref-statistic: statistics among objc-msg-send reports\n```\n\n## Basic Usage\n### Scan for AppInfos\n⚠️ **Because some of the dependence on Cocoa has not been lifted (such as bplist parser), it is not currently available on Linux.**\n```\n\u003e iblessing -m scan -i app-info -f \u003cpath-to-app-bundle\u003e\n```\n\nLet's take WeChat as an example:\n```\n\u003e iblessing -m scan -i app-info -f WeChat.app\n[*] set output path to /opt/one-btn/tmp/apps/WeChat/Payload\n[*] input file is WeChat.app\n[*] start App Info Scanner\n[+] find default plist file Info.plist!\n[*] find version info: Name: 微信(WeChat)\nVersion: 7.0.14(18E226)\nExecutableName: WeChat\n[*] Bundle Identifier: com.tencent.xin\n[*] the app allows HTTP requests **without** exception domains!\n[+] find app deeplinks\n |-- wechat://\n |-- weixin://\n |-- fb290293790992170://\n |-- weixinapp://\n |-- prefs://\n |-- wexinVideoAPI://\n |-- QQ41C152CF://\n |-- wx703://\n |-- weixinULAPI://\n[*] find app callout whitelist\n |-- qqnews://\n |-- weixinbeta://\n |-- qqnewshd://\n |-- qqmail://\n |-- whatsapp://\n |-- wxwork://\n |-- wxworklocal://\n |-- wxcphonebook://\n |-- mttbrowser://\n |-- mqqapi://\n |-- mqzonev2://\n |-- qqmusic://\n |-- tenvideo2://\n ...\n[+] find 507403 string literals in binary\n[*] process with string literals, this maybe take some time\n[+] find self deeplinks URLs:\n |-- weixin://opennativeurl/devicerankview\n |-- weixin://dl/offlinepay/?appid=%@\n |-- weixin://opennativeurl/rankmyhomepage\n ...\n [+] find other deeplinks URLs:\n |-- wxpay://f2f/f2fdetail\n |-- file://%@?lang=%@\u0026fontRatio=%.2f\u0026scene=%u\u0026version=%u\u0026type=%llu\u0026%@=%d\u0026qqFaceFolderPath=%@\u0026platform=iOS\u0026netType=%@\u0026query=%@\u0026searchId=%@\u0026isHomePage=%d\u0026isWeAppMore=%d\u0026subType=%u\u0026extParams=%@\u0026%@=%@\u0026%@=%@\n ...\n [*] write report to path /opt/one-btn/tmp/apps/WeChat/Payload/WeChat.app_info.iblessing.txt\n \n\u003e ls -alh \n-rw-r--r--@ 1 soulghost  wheel    29K Jul 23 14:01 WeChat.app_info.iblessing.txt\n```\n\n### Scan for Class XREFs\n***Notice: ARM64 Binaries Only***\n```\niblessing -m scan -i objc-class-xref -f \u003cpath-to-binary\u003e -d 'classes=\u003cclassname_to_scan\u003e,\u003cclassname_to_scan\u003e,...'\n```\n\n```\n\u003e restore-symbol WeChat -o WeChat.restored\n\u003e iblessing -m scan -i objc-class-xref -f WeChat.restored -d 'classes=NSPredicate'\n[*] set output path to /opt/one-btn/tmp/apps/WeChat/Payload\n[*] input file is WeChat\n[+] detect mach-o header 64\n[+] detect litten-endian\n[*] start Objc Class Xref Scanner\n  [*] try to find _OBJC_CLASS_$_NSPredicate\n  [*] Step 1. locate class refs\n\t[+] find _OBJC_CLASS_$_NSPredicate at 0x108eb81d8\n  [*] Step 2. find __TEXT,__text\n\t[+] find __TEXT,__text at 0x4000\n  [*] Step 3. scan in __text\n\t[*] start disassembler at 0x100004000\n\t[*] \\ 0x1002e1a50/0x1069d9874 (2.71%)\t[+] find _OBJC_CLASS_$_NSPredicate ref at 0x1002e1a54\n           ...\n  [*] Step 4. symbolicate ref addresses\n           [+] _OBJC_CLASS_$_NSPredicate -|\n           [+] find _OBJC_CLASS_$_NSPredicate ref -[WCWatchNotificationMgr addYoCount:contact:type:] at 0x1002e1a54\n           [+] find _OBJC_CLASS_$_NSPredicate ref -[NotificationActionsMgr handleSendMsgResp:] at 0x1003e0e28\n           [+] find _OBJC_CLASS_$_NSPredicate ref -[FLEXClassesTableViewController searchBar:textDidChange:] at 0x1004a090c\n           [+] find _OBJC_CLASS_$_NSPredicate ref +[GameCenterUtil parameterValueForKey:fromQueryItems:] at 0x1005a823c\n           [+] find _OBJC_CLASS_$_NSPredicate ref +[GameCenterUtil getNavigationBarColorForUrl:defaultColor:] at 0x1005a8cd8\n           ...\n```\n\n### Scan for All objc_msgSend XREFs\n***Notice: ARM64 Binaries Only***\n\n#### Simple Mode\n```\niblessing -m scan -i objc-msg-xref -f \u003cpath-to-binary\u003e\n```\n\n#### Anti-Wrapper Mode\n```\niblessing -m scan -i objc-msg-xref -f WeChat -d 'antiWrapper=1'\n```\nThe anti-wrapper mode will detect objc_msgSend wrappers and make transforms, such as:\n```arm\n; __int64 __usercall objc_msgSend_X0_X22_X20@\u003cX0\u003e(void *obj@\u003cX0\u003e, const char *sel@\u003cX22\u003e, id anyObj@\u003cX20\u003e, ...)\nobjc_msgSend_X0_X22_X20:\nMOV             X1, X22\nMOV             X2, X20\nB               objc_msgSend\n```\n\n#### Usage Example:\n```\n\u003e iblessing -m scan -i objc-msg-xref -f WeChat -d 'antiWrapper=1'\n[*] set output path to /opt/one-btn/tmp/apps/WeChat/Payload\n[*] input file is WeChat\n[+] detect mach-o header 64\n[+] detect litten-endian\n\n[*] !!! Notice: enter anti-wrapper mode, start anti-wrapper scanner\n[*] start Symbol Wrapper Scanner\n  [*] try to find wrappers for_objc_msgSend\n  [*] Step1. find __TEXT,__text\n\t[+] find __TEXT,__text at 0x100004000\n\t[+] mapping text segment 0x100000000 ~ 0x107cb0000 to unicorn engine\n  [*] Step 2. scan in __text\n\t[*] start disassembler at 0x100004000\n\t[*] / 0x1069d986c/0x1069d9874 (100.00%)\n\t[*] reach to end of __text, stop\n  [+] anti-wrapper finished\n  \n[*] start ObjcMethodXrefScanner Exploit Scanner\n  [*] Step 1. realize all app classes\n\t[*] realize classes 14631/14631 (100.00%)\n\t[+] get 667318 methods to analyze\n  [*] Step 2. dyld load non-lazy symbols\n  [*] Step 3. track all calls\n\t[*] progress: 667318 / 667318 (100.00%)\n  [*] Step 4. serialize call chains to file\n  [*] saved to /opt/one-btn/tmp/apps/WeChat/Payload/WeChat_method-xrefs.iblessing.txt\n  \n\u003e ls -alh WeChat_method-xrefs.iblessing.txt\n-rw-r--r--  1 soulghost  wheel    63M Jul 23 14:46 WeChat_method-xrefs.iblessing.txt \n\n\u003e head WeChat_method-xrefs.iblessing.txt\niblessing methodchains,ver:0.2;\nchainId,sel,prefix,className,methodName,prevMethods,nextMethods\n182360,0x1008a0ab8,+[A8KeyControl initialize],+,A8KeyControl,initialize,[],[4429#0x1008a1064@4376#0x1008a1050@13769#0x1008a10d0]\n182343,0x1008a0ad0,+[A8KeyControl_QueryStringTransferCookie initialize],+,A8KeyControl_QueryStringTransferCookie,initialize,[],[4429#0x1008a1064@4376#0x1008a1050@13769#0x1008a10d0]\n145393,0x1008c2220,+[A8KeyResultCookieWriter initWithDomain:weakWebView:andCompleteBlock:],+,A8KeyResultCookieWriter,initWithDomain:weakWebView:andCompleteBlock:,[145386#0x10036367c],[]\n145396,0x1008c3df8,+[A8KeyResultCookieWriter setA8KeyCookieExpireTime:],+,A8KeyResultCookieWriter,setA8KeyCookieExpireTime:,[145386#0x1003636e8],[]\n145397,0x1008c27e8,+[A8KeyResultCookieWriter writeCompleteMarkerCookieValue:forKey:],+,A8KeyResultCookieWriter,writeCompleteMarkerCookieValue:forKey:,[145386#0x10036380c],[]\n253456,0x0,+[AAOperationReq init],+,AAOperationReq,init,[253455#0x1039a9d30],[]\n253457,0x0,+[AAOperationReq setBaseRequest:],+,AAOperationReq,setBaseRequest:,[253455#0x1039a9d8c],[]\n186847,0x0,+[AAOperationRes length],+,AAOperationRes,length,[186845#0x10342aa54],[]\n```\n\nThe report can be used by the generators, now let's go.\n\n### Generate objc_msgSend Xrefs Query Server\nYou can start a server through iblessing's objc-msg-xref-server generator to query all objc_msgSend xrefs.\n```\niblessing -m generator -i objc-msg-xref-server -f \u003cpath-to-report-generated-by-objc-msg-xref-scanner\u003e\n```\n\n#### Specify the Listening Host and Port\nThe default listening address is 127.0.0.1:2345, you can specify it by -d option.\n```\niblessing -m generator -i objc-msg-xref-server -f WeChat_method-xrefs.iblessing.txt -d 'host=0.0.0.0;port=12345'\n```\n\n#### Usage Example\n***Notice: the objc-msg-xref is based on unicorn, to speed up the analyze, we do not follow any calls, so the result is partially missing.***\n```\n\u003e iblessing -m generator -i objc-msg-xref-server -f WeChat_method-xrefs.iblessing.txt\n[*] set output path to /opt/one-btn/tmp/apps/WeChat/Payload\n[*] input file is WeChat_method-xrefs.iblessing.txt\n[*] start ObjcMsgXREFServerGenerator\n  [*] load method-chain db for version iblessing methodchains,ver:0.2;\n  [*] table keys chainId,sel,prefix,className,methodName,prevMethods,nextMethods\n\t[-] bad line 104467,0x0,+[TPLock P,\t],+,TPLock,P,\t,[104426#0x1043b9904],[]\n\t[-] bad line 114905,0x0,?[0x108ce1578 (,],?,0x108ce1578,(,,[114900#0x1011e8c68],[]\n\t[-] bad line 104464,0x0,?[? P,\t],?,?,P,\t,[104426#0x1043b98a8],[]\n\t[-] bad line 139234,0x0,?[? X\n\t[-] bad line ],?,?,X\n\t[-] bad line ,[139205#0x1013c222c],[]\n\t[+] load storage from disk succeeded!\n  [*] listening on http://127.0.0.1:2345\n```\nNext you can open `http://127.0.0.1:2345` with a browser to query any objc_msgSend xrefs you like:\n![](https://github.com/Soulghost/iblessing/blob/master/resource/images/objc_msgSend_xref_server.png?raw=true)\n\n### Generate IDA Scripts for objc_msgSend xrefs\nYou can add objc_msgSend xrefs generated from objc-msg-xref scanner to make your reverse engineering journey more faster and comfortable.\n```\niblessing -m generator -i ida-objc-msg-xref -f \u003cpath-to-report-generated-by-objc-msg-xref-scanner\u003e\n```\n\n#### Usage Example\n***Notice: the objc-msg-xref is based on unicorn, to speed up the analyze, we do not follow any calls, so the result is partially missing.***\n```\n\u003e iblessing -m generator -i ida-objc-msg-xref -f WeChat_method-xrefs.iblessing.txt\n[*] set output path to /opt/one-btn/tmp/apps/WeChat/Payload\n[*] input file is WeChat_method-xrefs.iblessing.txt\n[*] start IDAObjMsgXREFGenerator\n  [*] load method-chain db for version iblessing methodchains,ver:0.2;\n  [*] table keys chainId,sel,prefix,className,methodName,prevMethods,nextMethods\n\t[-] bad line 104467,0x0,+[TPLock P,\t],+,TPLock,P,\t,[104426#0x1043b9904],[]\n\t[-] bad line 114905,0x0,?[0x108ce1578 (,],?,0x108ce1578,(,,[114900#0x1011e8c68],[]\n\t[-] bad line 104464,0x0,?[? P,\t],?,?,P,\t,[104426#0x1043b98a8],[]\n\t[-] bad line 139234,0x0,?[? X\n\t[-] bad line ],?,?,X\n\t[-] bad line ,[139205#0x1013c222c],[]\n\t [+] load storage from disk succeeded!\n  [*] Generating XREF Scripts ...\n  [*] saved to /opt/one-btn/tmp/apps/WeChat/Payload/WeChat_method-xrefs.iblessing.txt_ida_objc_msg_xrefs.iblessing.py\n  \n\u003e ls -alh WeChat_method-xrefs.iblessing.txt_ida_objc_msg_xrefs.iblessing.py\n-rw-r--r--  1 soulghost  wheel    23M Jul 23 16:16 WeChat_method-xrefs.iblessing.txt_ida_objc_msg_xrefs.iblessing.py\n\n\u003e head WeChat_method-xrefs.iblessing.txt_ida_objc_msg_xrefs.iblessing.py\ndef add_objc_xrefs():\n    ida_xref.add_cref(0x10036367c, 0x1008c2220, XREF_USER)\n    ida_xref.add_cref(0x1003636e8, 0x1008c3df8, XREF_USER)\n    ida_xref.add_cref(0x10036380c, 0x1008c27e8, XREF_USER)\n    ida_xref.add_cref(0x103add16c, 0x700006e187a8, XREF_USER)\n    ida_xref.add_cref(0x102cbee0c, 0x101143ee8, XREF_USER)\n    ida_xref.add_cref(0x10085c92c, 0x1005e9360, XREF_USER)\n    ida_xref.add_cref(0x10085c8bc, 0x1005e9274, XREF_USER)\n    ida_xref.add_cref(0x10085c8dc, 0x1005e92bc, XREF_USER)\n    ida_xref.add_cref(0x10085c8cc, 0x1005e9298, XREF_USER)\n```\n\nNext open your IDA -\u003e File -\u003e Script File and load the script, this step may take a long time. And when it is done, you can find many xrefs for objc method:\n![](https://github.com/Soulghost/iblessing/blob/master/resource/images/ida_objc_msgSend_xrefs.png?raw=true)\n\n### Scan for symbol wrappers\nA Mach-O file may contain multiple wrappers of commonly used dynamic library imported symbols, such as:\n```arm\n__text:00000001003842D8 sub_1003842CC                           ; CODE XREF: -[BDARVLynxTracker eventV3:params:adExtraData:]+168↑p\n__text:00000001003842D8                                         ; -[BDARVLynxTracker eventV3:params:adExtraData:]+214↑p ...\n__text:00000001003842D8                 MOV             X1, X27\n__text:00000001003842DC                 MOV             X2, X19\n__text:00000001003842E0                 B               objc_msgSend\n```\n\nWe can convert the wrapper by usercall:\n```arm\n__text:00000001003842CC ; id __usercall objc_msgSend_61@\u003cX0\u003e(id@\u003cX23\u003e, const char *@\u003cX28\u003e, ...)\n__text:00000001003842CC _objc_msgSend_61                        ; CODE XREF: -[BDARVLynxTracker eventV3:params:adExtraData:]+2CC↑p\n__text:00000001003842CC                                         ; -[BDARVLynxTracker eventV3:params:adExtraData:]+320↑p ...\n__text:00000001003842CC                 MOV             X0, X23\n__text:00000001003842D0                 MOV             X1, X28\n__text:00000001003842D4                 B               objc_msgSend\n```\n\nThe scanner can generate a report to record all wrappers, then you can use `ida-symbol-wrapper-naming` generator to generate ida scripts and implement this wrapper rename and prototype change.\n\n#### How to Use\n```\niblessing -m scan -i symbol-wrapper -f \u003cpath-to-binary\u003e -d 'symbols=_objc_msgSend,_objc_retain,_objc_release'\niblessing -m scan -i symbol-wrapper -f \u003cpath-to-binary\u003e -d 'symbols=*'\n```\n\n#### Usage Example\nWe will take TikTok China as an example:\n```\n\u003e iblessing -m scan -i symbol-wrapper -f /opt/one-btn/tmp/apps/抖音短视频/Payload/Aweme -d 'symbols=*'\n[*] set output path to /Users/soulghost/Desktop/git/iblessing-public/iblessing/build/Debug\n[*] input file is /opt/one-btn/tmp/apps/抖音短视频/Payload/Aweme\n[+] detect mach-o header 64\n[+] detect litten-endian\n[*] start Symbol Wrapper Scanner\n  [*] try to find wrappers for_objc_autoreleaseReturnValue, _objc_msgSend, _objc_release, _objc_releaseAndReturn, _objc_retain, _objc_retainAutorelease, _objc_retainAutoreleaseAndReturn, _objc_retainAutoreleaseReturnValue, _objc_retainAutoreleasedReturnValue\n  [*] Step1. find __TEXT,__text\n\t[+] find __TEXT,__text at 0x100004000\n\t[+] mapping text segment 0x100000000 ~ 0x106da0000 to unicorn engine\n  [*] Step 2. scan in __text\n\t[*] start disassembler at 0x100004000\n\t[*] / 0x106b68a54/0x106b68a58 (100.00%)\n\t[*] reach to end of __text, stop\n\n  [*] Step 3. serialize wrapper graph to file\n\t[*] saved to /Users/soulghost/Desktop/git/iblessing-public/iblessing/build/Debug/Aweme_wrapper-graph.iblessing.txt\n\n\u003e head Aweme_wrapper-graph.iblessing.txt\niblessing symbol-wrappers,ver:0.1;\nwrapperId;address;name;prototype\n0;0x100022190;_objc_retainAutoreleasedReturnValue;id __usercall f@\u003cx0\u003e(id@\u003cx0\u003e)\n1;0x100022198;_objc_retainAutoreleasedReturnValue;id __usercall f@\u003cx0\u003e(id@\u003cx0\u003e)\n2;0x1000221a0;_objc_release;id __usercall f@\u003cx0\u003e(id@\u003cx22\u003e)\n3;0x1000221a8;_objc_msgSend;id __usercall f@\u003cx0\u003e(id@\u003cx0\u003e, const char*@\u003cx20\u003e, ...)\n4;0x100022448;_objc_release;id __usercall f@\u003cx0\u003e(id@\u003cx21\u003e)\n5;0x10009c19c;_objc_autoreleaseReturnValue;id __usercall f@\u003cx0\u003e(id@\u003cx0\u003e)\n6;0x1000b6f94;_objc_msgSend;id __usercall f@\u003cx0\u003e(id@\u003cx0\u003e, const char*@\u003cx1\u003e, ...)\n7;0x100100248;_objc_autoreleaseReturnValue;id __usercall f@\u003cx0\u003e(id@\u003cx0\u003e)\n```\n\nNext, we can generate ida scripts from this report.\n\n### Genereate IDA Script for Objc Runtime Function Rename and Prototype Modification \n```\niblessing -m generator -i ida-symbol-wrapper-naming -f \u003cpath-to-report-from-symbol-wrapper\u003e\n```\n\n#### Usage Example\n```\n\u003e iblessing -m generator -i ida-symbol-wrapper-naming -f Aweme_wrapper-graph.iblessing.txt\n[*] set output path to /Users/soulghost/Desktop/git/iblessing-public/iblessing/build/Debug\n[*] input file is Aweme_wrapper-graph.iblessing.txt\n[*] start IDAObjMsgXREFGenerator\n  [*] load symbol-wrappers db for version iblessing symbol-wrappers,ver:0.1;\n  [*] table keys wrapperId;address;name;prototype\n  [*] Generating Naming Scripts ...\n  [*] saved to /Users/soulghost/Desktop/git/iblessing-public/iblessing/build/Debug/Aweme_wrapper-graph.iblessing.txt_ida_symbol_wrapper_naming.iblessing.py\n  \n\u003e head Aweme_wrapper-graph.iblessing.txt_ida_symbol_wrapper_naming.iblessing.py\ndef namingWrappers():\n    idc.set_name(0x100022190, '_objc_retainAutoreleasedReturnValue', ida_name.SN_FORCE)\n    idc.apply_type(0x100022190, idc.parse_decl('id __usercall f@\u003cx0\u003e(id@\u003cx0\u003e)', idc.PT_SILENT))\n    idc.set_name(0x100022198, '_objc_retainAutoreleasedReturnValue', ida_name.SN_FORCE)\n    idc.apply_type(0x100022198, idc.parse_decl('id __usercall f@\u003cx0\u003e(id@\u003cx0\u003e)', idc.PT_SILENT))\n    idc.set_name(0x1000221a0, '_objc_release', ida_name.SN_FORCE)\n    idc.apply_type(0x1000221a0, idc.parse_decl('id __usercall f@\u003cx0\u003e(id@\u003cx22\u003e)', idc.PT_SILENT))\n    idc.set_name(0x1000221a8, '_objc_msgSend', ida_name.SN_FORCE)\n    idc.apply_type(0x1000221a8, idc.parse_decl('id __usercall f@\u003cx0\u003e(id@\u003cx0\u003e, const char*@\u003cx20\u003e, ...)', idc.PT_SILENT))\n    idc.set_name(0x100022448, '_objc_release', ida_name.SN_FORCE)\n```\n\nNext open your IDA -\u003e File -\u003e Script File and load the script, this step may take a long time. And when it is done, You can observe some decompiled code changes:\n![](https://github.com/Soulghost/iblessing/blob/features/anti_wrapper/resource/images/ida_wrapped_call_before.png?raw=true)\n\n:arrow_down: :arrow_down: :arrow_down:\n\n![](https://github.com/Soulghost/iblessing/blob/features/anti_wrapper/resource/images/ida_wrapped_call_after.png?raw=true)\n\n# To be continued\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSoulghost%2Fiblessing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSoulghost%2Fiblessing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSoulghost%2Fiblessing/lists"}