iOS逆向之WeChat頭文件導(dǎo)出
操作環(huán)境
- iPhone5 (系統(tǒng)10.0.2) 越獄機
- mac pro (系統(tǒng)10.12.3)
準備工作
-
軟件
class-dump 安裝過程中的坑
把下載下來 class-dump腳本復(fù)制到~/User/lib,注意哎壳!前方高能摘悴,這一步就有坑了K钔!!
- 10.11后 mac 的機制變了 bin 目錄root權(quán)限也不可以修改了
點擊上面的下載地址后
```
第一步从媚,打開Terminal,輸入mkdir ~/bin患整,在當前用戶根目錄下創(chuàng)建一個bin目錄拜效;
命令: mkdir ~/bin
第二步喷众,把class-dump給拷貝到這個目錄里,并賦予其可執(zhí)行權(quán)限;
命令一: mv /.../class-dump ~/bin (/.../class-dump是指的class-dump的完整路徑)
命令二: chmod +x ~/bin/class-dump
第三步紧憾,打開~/.bash_profile文件到千,配置環(huán)境變量
命令一: vi ~/.bash_profile
命令二: 按 i 鍵進入編輯模式,寫入下面一行代碼赴穗, export PATH=$HOME/bin/:$PATH 按ESC然后輸入冒號(shift+;),然后輸入wq,退出即可憔四。
第四步,在Terminal中執(zhí)行source命令
命令:source ~/.bash_profile
完成以上步驟般眉,在terminal中執(zhí)行class-dump實驗一下了赵,應(yīng)該就可以了。
```
屏幕快照 2017-08-04 下午4.59.26.png
執(zhí)行class-dump能看到上面的也頁面就說明你安裝成功了
-
dumpdecrypted.dylib的坑
網(wǎng)上的教程和dumpdecrypted.dylib文件太舊了甸赃,上面加了我找到的最新的文件柿汛,大家可以用了,
準備工作完成(其他沒難度埠对,就不介紹了络断,有問題留言哈)
砸殼開始
-
將 dumpdecrypted.dylib復(fù)制到手機上
我是用usb連接的,所以終端輸入
ssh root@localhost -p 2222 密碼:alpine
看下是否連接上了
Snip20170804_14.png
前綴變成手機的名稱,就說明連接成功了项玛,可以開始拷貝了貌笨。
連接后輸入 ps -e
查看進程
Snip20170804_15.png
看到這個 后command + f 搜索weChat
Snip20170804_16.png
記住:
603 ?? 0:58.86 /var/containers/Bundle/Application/B9ABE60D-681A-4A72-A87E-1C16D3DC1D3A/WeChat.app/WeChat
看到這個603的進程了襟沮,然后執(zhí)行命令躁绸,勾住進程
cycript -p 603
Snip20170804_17.png
出現(xiàn)
cy#
cycript 啟動,獲取沙盒路徑
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES)[0]
終端打印
file:///var/mobile/Containers/Data/Application/0B9ED868-97DE-4D2B-9FF7-91CA5CC05BB5/Documents/
WeChat 沙盒路徑獲取到了,
切換另一個page
終端輸入
scp -P 2222 dumpdecrypted.dylib root@localhost:/var/mobile/Containers/Data/Application/0B9ED868-97DE-4D2B-9FF7-91CA5CC05BB5/Documents/
Snip20170804_19.png
將dumpdecrypted.dylib拷貝到沙河
開始敲殼
以上都是準備工作臣嚣,接下來可以正式砸殼了净刮。
Snip20170804_20.png
DYLD_INSERT_LIBRARIES=/User/dumpdecrypted.dylib
后拼接 603 進程后面的app路徑
[+] detected 64bit ARM binary in memory.
[+] offset to cryptid found: @0x1000a0ca8(from 0x1000a0000) = ca8
[+] Found encrypted data at address 00004000 of length 53149696 bytes - type 1.
[+] Opening /private/var/containers/Bundle/Application/46316B03-5DC3-4534-8D40-A29FE9315E22/WeChat.app/WeChat for reading.
[+] Reading header
[+] Detecting header type
[+] Executable is a FAT image - searching for right architecture
[+] Correct arch is at offset 58195968 in the file
[+] Opening WeChat.decrypted for writing.
[+] Copying the not encrypted start of the file
[+] Dumping the decrypted data into the file
[+] Copying the not encrypted remainder of the file
[+] Setting the LC_ENCRYPTION_INFO->cryptid to 0 at offset 3780ca8
[+] Closing original file
[+] Closing dump file
查看成果
砸殼完畢,會自動在當前目錄生成砸殼后的二進制文件 WeChat.decrypted
回到我們的電腦
終端輸入
class-dump -H WeChat.decrypted(砸殼后的文件路徑) -o [文件夾路徑]
等一會硅则。淹父。。怎虫。暑认。
然后見證驚喜吧
Snip20170804_21.png
文章中的路徑不是固定的 ,自行修改哦