批量追蹤objc的方法調用記錄

ios objc 方法調用記錄插件: itracer v1.2ios

若是你想逆向 某些app的調用流程 或者 系統app的一些功能的 私有 framework class api 調用流程, 能夠試試此工具git

只須要 配置須要掛接的 類名和app名, 就能夠實時追蹤 相關功能的 調用流程。 支持批量 hook n多個類名github

特性:spring

  • 批量跟蹤ios下指定class對象的全部調用流程
  • 支持ios for armv6,armv7,arm64 以及mac for x86, x64
  • 自動探測參數類型,而且打印全部參數的詳細信息

更新內容:api

  • 增長對arm64的支持,剛調通穩定性有待測試。 arm64進程注入沒時間作了,暫時用了substrate的hookprocess, 因此你們須要先裝下libsubstrate.dylib armv7的版本是徹底不依賴substrate的。app

  • arm64的版本對參數的信息打印稍微作了些加強。工具

注:此項目已再也不維護,僅供參考。post

  1. 配置須要掛接的class測試

    修改itrace.xml配置文件,增長鬚要hook的類名:插件

    <?xml version="1.0" encoding="utf-8"?>

    <itrace> <class> <SSDevice/> <SSDownload/> <SSDownloadManager/> <SSDownloadQueue/> <CPDistributedMessagingCenter/> <CPDistributedNotificationCenter/> <NSString args="0"/> </class> </itrace>

    注: 儘可能不要去hook, 頻繁調用的class, 好比 UIView NSString, 不然會很卡,操做就不方便了。 注: 若是掛接某個class, 中途打印參數信息掛了, 能夠在對應的類名後面 加上 args="0" 屬性, 來禁止打印參數信息, 這樣會穩定點。 若是要讓全部類都不打印參數信息, 能夠直接設置: <class args="0">

  2. 安裝文件

    將整個itracer目錄下的全部文件用手機助手工具,上傳到ios系統上的 /tmp 下面: /tmp/itracer /tmp/itrace.dylib /tmp/itrace.xml

  3. 進行trace

    進入itracer所在目錄: cd /tmp

    修改執行權限: chmod 777 ./itracer

    運行程序:

    ./itracer springboard (spingboard 爲須要掛接的進程名, 支持簡單的模糊匹配)

  4. 查看 trace log, 注: log 的實際輸出在: Xcode-Windows菜單-Organizer-Console 中:

    Jan 21 11:12:58 unknown SpringBoard[5706] <Warning>: [itrace]: [3edc9d98]: [SSDownloadQueue downloads] Jan 21 11:12:58 unknown SpringBoard[5706] <Warning>: [itrace]: [3edc9d98]: [SSDownloadManager downloads] Jan 21 11:12:58 unknown SpringBoard[5706] <Warning>: [itrace]: [3edc9d98]: [SSDownloadManager _copyDownloads] Jan 21 11:12:58 unknown SpringBoard[5706] <Warning>: [itrace]: [3edc9d98]: [SSDownloadQueue _sendDownloadStatusChangedAtIndex:]: 0 Jan 21 11:12:58 unknown SpringBoard[5706] <Warning>: [itrace]: [3edc9d98]: [SSDownloadQueue _messageObserversWithFunction:context:]: 0x334c5d51: 0x2fe89de0 Jan 21 11:12:58 unknown SpringBoard[5706] <Warning>: [itrace]: [3edc9d98]: [SSDownloadQueue downloads] Jan 21 11:12:58 unknown SpringBoard[5706] <Warning>: [itrace]: [3edc9d98]: [SSDownloadManager downloads] Jan 21 11:12:58 unknown SpringBoard[5706] <Warning>: [itrace]: [3edc9d98]: [SSDownloadManager _copyDownloads] Jan 21 11:12:58 unknown SpringBoard[5706] <Warning>: [itrace]: [3edc9d98]: [SSDownload cachedApplicationIdentifier] Jan 21 11:12:58 unknown SpringBoard[5706] <Warning>: [itrace]: [3edc9d98]: [SSDownload status] Jan 21 11:12:58 unknown SpringBoard[5706] <Warning>: [itrace]: [3edc9d98]: [SSDownload cachedApplicationIdentifier] Jan 21 11:12:58 unknown SpringBoard[5706] <Warning>: [itrace]: [3edc9d98]: [CPDistributedNotificationCenter postNotificationName:userInfo:]: SBApplicationNotificationStateChanged: { SBApplicationStateDisplayIDKey = "com.apple.AppStore"; SBApplicationStateKey = 2; SBApplicationStateProcessIDKey = 5868; SBMostElevatedStateForProcessID = 2; } Jan 21 11:12:58 unknown SpringBoard[5706] <Warning>: [itrace]: [3edc9d98]: [CPDistributedNotificationCenter postNotificationName:userInfo:toBundleIdentifier:]: SBApplicationNotificationStateChanged: { SBApplicationStateDisplayIDKey = "com.apple.AppStore"; SBApplicationStateKey = 2; SBApplicationStateProcessIDKey = 5868; SBMostElevatedStateForProcessID = 2; }: null Jan 21 11:12:59 unknown SpringBoard[5706] <Warning>: [itrace]: [105d7000]: [SSDownloadManager _handleMessage:fromServerConnection:]: 0xe6920b0: 0xe007040 Jan 21 11:12:59 unknown SpringBoard[5706] <Warning>: [itrace]: [105d7000]: [SSDownloadManager _handleDownloadStatesChanged:]: 0xe6920b0 Jan 21 11:12:59 unknown SpringBoard[5706] <Warning>: [itrace]: [105d7000]: [SSDownloadManager _copyDownloads] Jan 21 11:12:59 unknown SpringBoard[5706] <Warning>: [itrace]: [105d7000]: [SSDownload persistentIdentifier] Jan 21 11:12:59 unknown SpringBoard[5706] <Warning>: [itrace]: [105d7000]: [SSDownload _addCachedPropertyValues:]: { I = SSDownloadPhaseDownloading; } Jan 21 11:12:59 unknown SpringBoard[5706] <Warning>: [itrace]: [105d7000]: [SSDownload _applyPhase:toStatus:]: SSDownloadPhaseDownloading: <SSDownloadStatus: 0xe6b8e80> Jan 21 11:12:59 unknown SpringBoard[5706] <Warning>: [itrace]: [105d7000]: [SSDownloadQueue downloadManager:downloadStatesDidChange:]: <SSDownloadManager: 0x41ea60>: ( "<SSDownload: 0xe6bd970>: -4085275246093726486" )

源碼:https://github.com/waruqi/itrace

相關文章
相關標籤/搜索