Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Reverse Engineering: from Objective-C to Swift
Search
Hank Bao
April 23, 2016
Programming
2
400
Reverse Engineering: from Objective-C to Swift
逆向工程:从 Objective-C 到 Swift
2016年4月23日在 SwiftCon China 2016 上的分享
Hank Bao
April 23, 2016
Tweet
Share
More Decks by Hank Bao
See All by Hank Bao
Notes on Gamification
hankbao
0
110
Functional Programming Practice in Swift
hankbao
4
98
Type-safe Programming Practice in Swift
hankbao
0
100
Other Decks in Programming
See All in Programming
はてなにおける CSS Modules、及び CSS Modules に足りないもの / CSS Modules in Hatena, and CSS Modules missing parts
mizdra
7
940
#phpcon_odawara オープン・クローズドなテストフィクスチャを求めて / open closed test fixtures
77web
3
230
Scalable Customer Journey Orchestration (CJO)
lewuathe
0
340
Milestoner
bkuhlmann
1
410
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
110
VSCodeでのDatabricks開発もお勧めしたい/I would also recommend Databricks development with VSCode.
kazumain
0
260
GitHub Copilotのススメ
marcy731
1
200
Micro Frontends for Java Microservices - Devnexus 2024
mraible
PRO
0
500
AWS CDKコントリビュートTIPS / aws-cdk-contribution-tips
gotok365
2
200
サイコロで理解する統計的仮説検定の考え方
tatamiya
4
950
Ruby Pattern Matching
bkuhlmann
0
930
ゆるい個人開発のススメ
kuroppe1819
10
990
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
221
21k
Faster Mobile Websites
deanohume
299
30k
The Invisible Side of Design
smashingmag
294
49k
How to name files
jennybc
65
93k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
116
18k
Clear Off the Table
cherdarchuk
84
310k
Music & Morning Musume
bryan
41
5.6k
Infographics Made Easy
chrislema
238
18k
Navigating Team Friction
lara
178
13k
BBQ
matthewcrist
80
8.8k
How To Stay Up To Date on Web Technology
chriscoyier
782
250k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
227
16k
Transcript
逆向⼯程 从 OBJ-C 到 SWIFT @HANKBAO 瀑布IM
什么是逆向⼯程? Ӟᐿದᬦᑕ҅ܨӞᶱፓຽԾߝᬰᤈᭋݻړຉ݊Ꮈᑪ҅ᘒᄍ ᕩଚڊᧆԾߝጱ॒ቘၞᑕ̵ᕟᕢᕮ̵ۑᚆᚆᥢ໒ᒵᦡᦇᥝ ᔰ҅զګ֢ڊۑᚆፘᬪ݈҅֕ӧਠقӞጱԾߝ̶ — ᖌचጯᑀ
逆向⼯程的⽬标 ▸ ԟ ▸ ᦡᦇ ▸ ਫሿ ▸ ᓒဩ ▸
ᴻᲙ ▸ ಘ ▸ ൊկ
APP 插件
None
DEMO
DEMO: NON-FRAGILE LAYOUT
X86_64 调⽤约定 ▸ arg1: $rdi ▸ arg2: $rsi ▸ arg3:
$rdx ▸ arg4: $rcx ▸ arg5: $r8 ▸ arg6: $r9 ▸ ret1: $rax ▸ ret2: $rdx ▸ indirect: $rax (== $rdi)
OBJECTIVE-C 调⽤约定 ▸ arg1: $rdi -> self ▸ arg2: $rsi
-> _cmd ▸ arg3: $rdx ▸ arg4: $rcx ▸ arg5: $r8 ▸ arg6: $r9 ▸ ret: $rax
SWIFT REPL
DEMO: STRUCT
DEMO
SWIFT-DEMANGLE $ xcrun swift-demangle _TFV9DictSwift11QueryRecordg4termSS _TFV9DictSwift11QueryRecordg4termSS ---> DictSwift.QueryRecord.term.getter : Swift.String
DEMO
SWIFT NATIVE 调⽤约定 ▸ arg1: $rdi ▸ arg2: $rsi ▸
arg3: $rdx ▸ arg4: $rcx ▸ arg5: $r8 ▸ arg6: $r9 ▸ ret1: $rax ▸ ret2: $rdx ▸ ret3: $rcx ▸ indirect: $rax (== $rdi)
DEMO
DEMO
DEMO
DEMO
DEMO
DEMO
DEMO
DEMO
ᕑੰҘѺ
DEMO
DEMO
逆向⼯程理论基础 ▸ C / C++ / Objective-C / Swift ▸
Assembly (x86, x86_64, arm / thumb, arm64) ▸ ଘݣ ABI / ᇙਧ ABI ▸ ᖫᦲս۸ ▸ ֢ᔮᕹ
逆向⼯程⽅法和⼯具 ▸ ᶉாړຉ ▸ Hopper Disassembler ▸ IDA Pro ▸
otool ▸ class-dump ▸ ۖா᧣ᦶ ▸ lldb / gdb ▸ F-Script ▸ cycript
参考资料 ▸ Wikipedia ▸ System V Application Binary Interface (AMD64)
▸ Procedure Call Standard for the ARM 64-bit Architecture ▸ iOS ABI Function Call Guide ▸ The Swift ABI ▸ The Swift Calling Convention ▸ Friday Q&A
相关资源 ▸ https://github.com/apple/swift ▸ https://github.com/hankbao/DictObjc ▸ https://github.com/hankbao/DictSwift
THANKS Q & A