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
440
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
120
Functional Programming Practice in Swift
hankbao
4
110
Type-safe Programming Practice in Swift
hankbao
0
110
Other Decks in Programming
See All in Programming
PipeCDのプラグイン化で目指すところ
warashi
1
260
PHPでWebSocketサーバーを実装しよう2025
kubotak
0
260
High-Level Programming Languages in AI Era -Human Thought and Mind-
hayat01sh1da
PRO
0
720
20250628_非エンジニアがバイブコーディングしてみた
ponponmikankan
0
650
AIプログラマーDevinは PHPerの夢を見るか?
shinyasaita
1
190
エンジニア向け採用ピッチ資料
inusan
0
180
童醫院敏捷轉型的實踐經驗
cclai999
0
210
Railsアプリケーションと パフォーマンスチューニング ー 秒間5万リクエストの モバイルオーダーシステムを支える事例 ー Rubyセミナー 大阪
falcon8823
5
1.1k
iOS 26にアップデートすると実機でのHot Reloadができない?
umigishiaoi
0
110
技術同人誌をMCP Serverにしてみた
74th
1
610
AWS CDKの推しポイント 〜CloudFormationと比較してみた〜
akihisaikeda
3
320
PHPで始める振る舞い駆動開発(Behaviour-Driven Development)
ohmori_yusuke
2
300
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Optimizing for Happiness
mojombo
379
70k
Embracing the Ebb and Flow
colly
86
4.7k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Raft: Consensus for Rubyists
vanstee
140
7k
For a Future-Friendly Web
brad_frost
179
9.8k
Designing Experiences People Love
moore
142
24k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Six Lessons from altMBA
skipperchong
28
3.9k
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