SlideShare a Scribd company logo
Macoun
⌘
lldb - Debugger auf Abwegen
Oliver Bayer
inovex GmbH
Disclaimer: Nur weil es technisch
geht, muss es noch lange nicht
sinnvoll sein!
Ablauf
•Breakpoints per CLI
•Metabreakpoints
•Kontrollfluss Manipulation / Demo
Breakpoints
•Software Breakpoint
•Symbolic Breakpoint
•Non-Symbolic Breakpoint
Conditional Breakpoints
foo("")
func foo(_ value: String) {
...
}
foo("bar")
Foo.swift Bar.swift
Conditional Breakpoints
Conditional Breakpoints
Conditional Breakpoints
Non-Symbolic Breakpoint
Conditional Breakpoints
Symbolic Breakpoint
Metabreakpoints
foo("bar")
func foo(_ value: String) {
...
}
foo("bar")
Foo.swift Bar.swift
br s -n foo -N macoun -d
MetabreakpointsMetabreakpoints
foo("bar")
func foo(_ value: String) {
...
}
Bar.swift
br set -n foo -N macoun -d
br s -f Bar.swift -l 42 -C "br en macoun" -G
true
MetabreakpointsMetabreakpoints
foo("bar")
func foo(_ value: String) {
...
}
Bar.swift
Metabreakpoints
func seiteneffekteFuer100() {
print("1")
do()
print("2")
something()
print("3")
forMe()
}
Metabreakpoints
func seiteneffekteFuer100() {
do()
something()
forMe()
}
br s -p . -X seiteneffekteFuer100 -f Foo.swift -G true
br command add -s python
print("Line: {}".format(frame.GetLineEntry().GetLine()))
DONE
Metabreakpoints
func seiteneffekteFuer100() {
do()
something()
forMe()
}
br s -p . -X seiteneffekteFuer100 -f Foo.swift -G true
br command add -s python
print("Line: {}".format(frame.GetLineEntry().GetLine()))
DONE
Metabreakpoints
func seiteneffekteFuer100() {
do()
something()
forMe()
}
br s -p . -X seiteneffekteFuer100 -f Foo.swift -G true
br command add -s python
print("Line: {}".format(frame.GetLineEntry().GetLine()))
DONE
Metabreakpoints
func seiteneffekteFuer100() {
do()
something()
forMe()
}
br s -p . -X seiteneffekteFuer100 -f Foo.swift -G true
br command add -s python
print("Line: {}".format(frame.GetLineEntry().GetLine()))
DONE
Metabreakpoints
func do() {
…
let player = AVPlayer(playerItem: item)
…
player.play()
…
}
Metabreakpoints
func do() {
…
let player = AVPlayer(playerItem: item)
…
}
br s -f Player.swift -l 4 -C "call player.isMuted = false"
-G true
Metabreakpoints
func do() {
…
let player = AVPlayer(playerItem: item)
// Hier der Breakpoint
…
}
br s -f Player.swift -p "// Hier der Breakpoint" -X do
-C "call player.isMuted = true" -G true
Metabreakpoints
•Auf dem Stack1 steht die Rücksprungadresse des Aufrufenden
•Nach dem Rücksprung steht die Adresse der AVPlayer Instanz in
Register rax1
[1] x86 Architekturen
Metabreakpoints
br s -S "-[AVPlayer init]" -K false
br command add
settings set target.language objc
br s -a `(unsigned long)*(unsigned long *)$rsp` -o true
-C "exp -l objc -- [(AVPlayer *)$rax setMuted: @YES]" -G
true
settings set target.language swift
continue
Metabreakpoints
br s -S "-[AVPlayer init]" -K false
br command add
settings set target.language objc
br s -a `(unsigned long)*(unsigned long *)$rsp` -o true
-C "exp -l objc -- [(AVPlayer *)$rax setMuted: @YES]" -G
true
settings set target.language swift
continue
Metabreakpoints
br s -S "-[AVPlayer init]" -K false
br command add
settings set target.language objc
br s -a `(unsigned long)*(unsigned long *)$rsp` -o true
-C "exp -l objc -- [(AVPlayer *)$rax setMuted: @YES]" -G
true
settings set target.language swift
continue
Metabreakpoints
br s -S "-[AVPlayer init]" -K false
br command add
settings set target.language objc
br s -a `(unsigned long)*(unsigned long *)$rsp` -o true
-C "exp -l objc -- [(AVPlayer *)$rax setMuted: @YES]" -G
true
settings set target.language swift
continue
Metabreakpoints
br s -S "-[AVPlayer init]" -K false
br command add
settings set target.language objc
br s -a `(unsigned long)*(unsigned long *)$rsp` -o true
-C "exp -l objc -- [(AVPlayer *)$rax setMuted: @YES]" -G
true
settings set target.language swift
continue
Metabreakpoints
br s -S "-[AVPlayer init]" -K false
br command add
settings set target.language objc
br s -a `(unsigned long)*(unsigned long *)$rsp` -o true
-C "exp -l objc -- [(AVPlayer *)$rax setMuted: @YES]" -G
true
settings set target.language swift
continue
Metabreakpoints
br s -S "-[AVPlayer init]" -K false
br command add
settings set target.language objc
br s -a `(unsigned long)*(unsigned long *)$rsp` -o true
-C "exp -l objc -- [(AVPlayer *)$rax setMuted: @YES]" -G
true
settings set target.language swift
continue
Neue Wege gehen mit thread
•Codepfade zur Laufzeit manipulieren
•Methoden kurzschließen
•Rückgabewerte ändern
Demo
Neue Wege gehen mit thread
•Nachteil an thread return et al. → bremst das Ausführen des Codes
aus

•Idee: (Binary) Patch → genauso schnell wie vorher
Binary Patch Breakpoint
private func isExpectedInput(_ value: String) -> Bool {
if value.lowercased() == secret {
return true
} else {
return false
}
}
Binary Patch Breakpoint
private func isExpectedInput(_ value: String) -> Bool {
return true
}
Binary Patch Breakpoint
push rbp

mov rbp, rsp
push 0x1
pop rax
pop rbp
ret
'x55x6ax01x58x5dxc3'
Binary Patch Breakpoint
br s -n isExpectedInput -o true -K false
br command add -s python
patch = 'x55xB8x01x00x00x00x5dxc3'
addr = bp_loc.GetLoadAddress()
error = lldb.SBError()
proc = frame.GetThread().GetProcess()
result = proc.WriteMemory(addr, patch, error)
proc.Continue()
DONE
Binary Patch Breakpoint
br s -n isExpectedInput -o true -K false
br command add -s python
patch = 'x55xB8x01x00x00x00x5dxc3'
addr = bp_loc.GetLoadAddress()
error = lldb.SBError()
proc = frame.GetThread().GetProcess()
result = proc.WriteMemory(addr, patch, error)
proc.Continue()
DONE
Binary Patch Breakpoint
br s -n isExpectedInput -o true -K false
br command add -s python
patch = 'x55xB8x01x00x00x00x5dxc3'
addr = bp_loc.GetLoadAddress()
error = lldb.SBError()
proc = frame.GetThread().GetProcess()
result = proc.WriteMemory(addr, patch, error)
proc.Continue()
DONE
Binary Patch Breakpoint
br s -n isExpectedInput -o true -K false
br command add -s python
patch = 'x55xB8x01x00x00x00x5dxc3'
addr = bp_loc.GetLoadAddress()
error = lldb.SBError()
proc = frame.GetThread().GetProcess()
result = proc.WriteMemory(addr, patch, error)
proc.Continue()
DONE
Binary Patch Breakpoint
br s -n isExpectedInput -o true -K false
br command add -s python
patch = 'x55xB8x01x00x00x00x5dxc3'
addr = bp_loc.GetLoadAddress()
error = lldb.SBError()
proc = frame.GetThread().GetProcess()
result = proc.WriteMemory(addr, patch, error)
proc.Continue()
DONE
Binary Patch Breakpoint
br s -n isExpectedInput -o true -K false
br command add -s python
patch = 'x55xB8x01x00x00x00x5dxc3'
addr = bp_loc.GetLoadAddress()
error = lldb.SBError()
proc = frame.GetThread().GetProcess()
result = proc.WriteMemory(addr, patch, error)
proc.Continue()
DONE
Binary Patch Breakpoint
br s -n isExpectedInput -o true -K false
br command add -s python
patch = 'x55xB8x01x00x00x00x5dxc3'
addr = bp_loc.GetLoadAddress()
error = lldb.SBError()
proc = frame.GetThread().GetProcess()
result = proc.WriteMemory(addr, patch, error)
proc.Continue()
DONE
Binary Patch Breakpoint
br s -n isExpectedInput -o true -K false
br command add -s python
patch = 'x55xB8x01x00x00x00x5dxc3'
addr = bp_loc.GetLoadAddress()
error = lldb.SBError()
proc = frame.GetThread().GetProcess()
result = proc.WriteMemory(addr, patch, error)
proc.Continue()
DONE
Patch Breakpoint
private let secret = "foo" —> "macoun"
Patch Breakpoint
private let secret = "foo" // —> "macoun"
br s -F "Swift.String.init(_builtinStringLiteral:
Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word,
isASCII: Builtin.Int1) -> Swift.String" -c "0 ==
(int)strcmp("foo", (char *)$rdi)" -o true
br command add
exp -- char * $value = (char *)"macoun"
register write $rdi `(unsigned long *)$value`
register write $rsi 6
continue
DONE
Patch Breakpoint
private let secret = "foo" // —> "macoun"
br s -F "Swift.String.init(_builtinStringLiteral:
Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word,
isASCII: Builtin.Int1) -> Swift.String" -c "0 ==
(int)strcmp("foo", (char *)$rdi)" -o true
br command add
exp -- char * $value = (char *)"macoun"
register write $rdi `(unsigned long *)$value`
register write $rsi 6
continue
DONE
Patch Breakpoint
private let secret = "foo" // —> "macoun"
br s -F "Swift.String.init(_builtinStringLiteral:
Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word,
isASCII: Builtin.Int1) -> Swift.String" -c "0 ==
(int)strcmp("foo", (char *)$rdi)" -o true
br command add
exp -- char * $value = (char *)"macoun"
register write $rdi `(unsigned long *)$value`
register write $rsi 6
continue
DONE
Patch Breakpoint
private let secret = "foo" // —> "macoun"
br s -F "Swift.String.init(_builtinStringLiteral:
Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word,
isASCII: Builtin.Int1) -> Swift.String" -c "0 ==
(int)strcmp("foo", (char *)$rdi)" -o true
br command add
exp -- char * $value = (char *)"macoun"
register write $rdi `(unsigned long *)$value`
register write $rsi 6
continue
DONE
Patch Breakpoint
private let secret = "foo" // —> "macoun"
br s -F "Swift.String.init(_builtinStringLiteral:
Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word,
isASCII: Builtin.Int1) -> Swift.String" -c "0 ==
(int)strcmp("foo", (char *)$rdi)" -o true
br command add
exp -- char * $value = (char *)"macoun"
register write $rdi `(unsigned long *)$value`
register write $rsi 6
continue
DONE
Patch Breakpoint
private let secret = "foo" // —> "macoun"
br s -F "Swift.String.init(_builtinStringLiteral:
Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word,
isASCII: Builtin.Int1) -> Swift.String" -c "0 ==
(int)strcmp("foo", (char *)$rdi)" -o true
br command add
exp -- char * $value = (char *)"macoun"
register write $rdi `(unsigned long *)$value`
register write $rsi 6
continue
DONE
Schlussworte
•Automatismen
•https://github.com/obayer/Trampoline
• .lldbinit
• command source <filename>
• für alles andere: lldb help
Fragen?
Vielen Dank
Oliver Bayer
inovex GmbH
Macoun
⌘

More Related Content

What's hot

Implementing Software Machines in C and Go
Implementing Software Machines in C and GoImplementing Software Machines in C and Go
Implementing Software Machines in C and Go
Eleanor McHugh
 
typemap in Perl/XS
typemap in Perl/XS  typemap in Perl/XS
typemap in Perl/XS
charsbar
 
A CTF Hackers Toolbox
A CTF Hackers ToolboxA CTF Hackers Toolbox
A CTF Hackers Toolbox
Stefan
 
Static Optimization of PHP bytecode (PHPSC 2017)
Static Optimization of PHP bytecode (PHPSC 2017)Static Optimization of PHP bytecode (PHPSC 2017)
Static Optimization of PHP bytecode (PHPSC 2017)
Nikita Popov
 
Powered by Python - PyCon Germany 2016
Powered by Python - PyCon Germany 2016Powered by Python - PyCon Germany 2016
Powered by Python - PyCon Germany 2016
Steffen Wenz
 
Exploit techniques - a quick review
Exploit techniques - a quick reviewExploit techniques - a quick review
Exploit techniques - a quick review
Ce.Se.N.A. Security
 
Trading with opensource tools, two years later
Trading with opensource tools, two years laterTrading with opensource tools, two years later
Trading with opensource tools, two years later
clkao
 
Go a crash course
Go   a crash courseGo   a crash course
Go a crash course
Eleanor McHugh
 
Python meetup: coroutines, event loops, and non-blocking I/O
Python meetup: coroutines, event loops, and non-blocking I/OPython meetup: coroutines, event loops, and non-blocking I/O
Python meetup: coroutines, event loops, and non-blocking I/O
Buzzcapture
 
Barely Legal Xxx Perl Presentation
Barely Legal Xxx Perl PresentationBarely Legal Xxx Perl Presentation
Barely Legal Xxx Perl Presentation
Attila Balazs
 
Working with databases in Perl
Working with databases in PerlWorking with databases in Perl
Working with databases in Perl
Laurent Dami
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and C
Eleanor McHugh
 
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
kinan keshkeh
 
Cluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in CCluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in C
Steffen Wenz
 
What's new in PHP 8.0?
What's new in PHP 8.0?What's new in PHP 8.0?
What's new in PHP 8.0?
Nikita Popov
 
Bytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterBytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreter
akaptur
 
NativeBoost
NativeBoostNativeBoost
NativeBoost
ESUG
 
C言語静的解析ツールと Ruby 1.9 trunk
C言語静的解析ツールと Ruby 1.9 trunkC言語静的解析ツールと Ruby 1.9 trunk
C言語静的解析ツールと Ruby 1.9 trunk
ikegami__
 
Créer une base NoSQL en 1 heure
Créer une base NoSQL en 1 heureCréer une base NoSQL en 1 heure
Créer une base NoSQL en 1 heure
Amaury Bouchard
 
Python
PythonPython
Python
Wei-Bo Chen
 

What's hot (20)

Implementing Software Machines in C and Go
Implementing Software Machines in C and GoImplementing Software Machines in C and Go
Implementing Software Machines in C and Go
 
typemap in Perl/XS
typemap in Perl/XS  typemap in Perl/XS
typemap in Perl/XS
 
A CTF Hackers Toolbox
A CTF Hackers ToolboxA CTF Hackers Toolbox
A CTF Hackers Toolbox
 
Static Optimization of PHP bytecode (PHPSC 2017)
Static Optimization of PHP bytecode (PHPSC 2017)Static Optimization of PHP bytecode (PHPSC 2017)
Static Optimization of PHP bytecode (PHPSC 2017)
 
Powered by Python - PyCon Germany 2016
Powered by Python - PyCon Germany 2016Powered by Python - PyCon Germany 2016
Powered by Python - PyCon Germany 2016
 
Exploit techniques - a quick review
Exploit techniques - a quick reviewExploit techniques - a quick review
Exploit techniques - a quick review
 
Trading with opensource tools, two years later
Trading with opensource tools, two years laterTrading with opensource tools, two years later
Trading with opensource tools, two years later
 
Go a crash course
Go   a crash courseGo   a crash course
Go a crash course
 
Python meetup: coroutines, event loops, and non-blocking I/O
Python meetup: coroutines, event loops, and non-blocking I/OPython meetup: coroutines, event loops, and non-blocking I/O
Python meetup: coroutines, event loops, and non-blocking I/O
 
Barely Legal Xxx Perl Presentation
Barely Legal Xxx Perl PresentationBarely Legal Xxx Perl Presentation
Barely Legal Xxx Perl Presentation
 
Working with databases in Perl
Working with databases in PerlWorking with databases in Perl
Working with databases in Perl
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and C
 
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
 
Cluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in CCluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in C
 
What's new in PHP 8.0?
What's new in PHP 8.0?What's new in PHP 8.0?
What's new in PHP 8.0?
 
Bytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterBytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreter
 
NativeBoost
NativeBoostNativeBoost
NativeBoost
 
C言語静的解析ツールと Ruby 1.9 trunk
C言語静的解析ツールと Ruby 1.9 trunkC言語静的解析ツールと Ruby 1.9 trunk
C言語静的解析ツールと Ruby 1.9 trunk
 
Créer une base NoSQL en 1 heure
Créer une base NoSQL en 1 heureCréer une base NoSQL en 1 heure
Créer une base NoSQL en 1 heure
 
Python
PythonPython
Python
 

Similar to lldb – Debugger auf Abwegen

Debug Information And Where They Come From
Debug Information And Where They Come FromDebug Information And Where They Come From
Debug Information And Where They Come From
Min-Yih Hsu
 
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
DevGAMM Conference
 
Best Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesBest Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' Mistakes
Andrey Karpov
 
A Self Replicating Serverless Function
A Self Replicating Serverless FunctionA Self Replicating Serverless Function
A Self Replicating Serverless Function
Michael Adda
 
Damn Fine CoffeeScript
Damn Fine CoffeeScriptDamn Fine CoffeeScript
Damn Fine CoffeeScript
niklal
 
Perl training-in-navi mumbai
Perl training-in-navi mumbaiPerl training-in-navi mumbai
Perl training-in-navi mumbai
vibrantuser
 
Hypers and Gathers and Takes! Oh my!
Hypers and Gathers and Takes! Oh my!Hypers and Gathers and Takes! Oh my!
Hypers and Gathers and Takes! Oh my!
Workhorse Computing
 
JavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovyJavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovy
Yasuharu Nakano
 
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!..."A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
akaptur
 
我在豆瓣使用Emacs
我在豆瓣使用Emacs我在豆瓣使用Emacs
我在豆瓣使用Emacs
董 伟明
 
Ruby 1.9
Ruby 1.9Ruby 1.9
Ruby 1.9
guestaef7ea
 
Refactor like a boss
Refactor like a bossRefactor like a boss
Refactor like a boss
gsterndale
 
How to Add Original Library to Android NDK
How to Add Original Library to Android NDKHow to Add Original Library to Android NDK
Let's play a game with blackfire player
Let's play a game with blackfire playerLet's play a game with blackfire player
Let's play a game with blackfire player
Marcin Czarnecki
 
How to not write a boring test in Golang
How to not write a boring test in GolangHow to not write a boring test in Golang
How to not write a boring test in Golang
Dan Tran
 
How to write rust instead of c and get away with it
How to write rust instead of c and get away with itHow to write rust instead of c and get away with it
How to write rust instead of c and get away with it
Flavien Raynaud
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
tomcopeland
 
Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1
Tom Paulus
 
Concurrent applications with free monads and stm
Concurrent applications with free monads and stmConcurrent applications with free monads and stm
Concurrent applications with free monads and stm
Alexander Granin
 
Mpi cheat sheet
Mpi cheat sheetMpi cheat sheet
Mpi cheat sheet
Cristian Chilipirea
 

Similar to lldb – Debugger auf Abwegen (20)

Debug Information And Where They Come From
Debug Information And Where They Come FromDebug Information And Where They Come From
Debug Information And Where They Come From
 
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
 
Best Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' MistakesBest Bugs from Games: Fellow Programmers' Mistakes
Best Bugs from Games: Fellow Programmers' Mistakes
 
A Self Replicating Serverless Function
A Self Replicating Serverless FunctionA Self Replicating Serverless Function
A Self Replicating Serverless Function
 
Damn Fine CoffeeScript
Damn Fine CoffeeScriptDamn Fine CoffeeScript
Damn Fine CoffeeScript
 
Perl training-in-navi mumbai
Perl training-in-navi mumbaiPerl training-in-navi mumbai
Perl training-in-navi mumbai
 
Hypers and Gathers and Takes! Oh my!
Hypers and Gathers and Takes! Oh my!Hypers and Gathers and Takes! Oh my!
Hypers and Gathers and Takes! Oh my!
 
JavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovyJavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovy
 
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!..."A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
 
我在豆瓣使用Emacs
我在豆瓣使用Emacs我在豆瓣使用Emacs
我在豆瓣使用Emacs
 
Ruby 1.9
Ruby 1.9Ruby 1.9
Ruby 1.9
 
Refactor like a boss
Refactor like a bossRefactor like a boss
Refactor like a boss
 
How to Add Original Library to Android NDK
How to Add Original Library to Android NDKHow to Add Original Library to Android NDK
How to Add Original Library to Android NDK
 
Let's play a game with blackfire player
Let's play a game with blackfire playerLet's play a game with blackfire player
Let's play a game with blackfire player
 
How to not write a boring test in Golang
How to not write a boring test in GolangHow to not write a boring test in Golang
How to not write a boring test in Golang
 
How to write rust instead of c and get away with it
How to write rust instead of c and get away with itHow to write rust instead of c and get away with it
How to write rust instead of c and get away with it
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1Getting Started with Raspberry Pi - DCC 2013.1
Getting Started with Raspberry Pi - DCC 2013.1
 
Concurrent applications with free monads and stm
Concurrent applications with free monads and stmConcurrent applications with free monads and stm
Concurrent applications with free monads and stm
 
Mpi cheat sheet
Mpi cheat sheetMpi cheat sheet
Mpi cheat sheet
 

More from inovex GmbH

Are you sure about that?! Uncertainty Quantification in AI
Are you sure about that?! Uncertainty Quantification in AIAre you sure about that?! Uncertainty Quantification in AI
Are you sure about that?! Uncertainty Quantification in AI
inovex GmbH
 
Why natural language is next step in the AI evolution
Why natural language is next step in the AI evolutionWhy natural language is next step in the AI evolution
Why natural language is next step in the AI evolution
inovex GmbH
 
WWDC 2019 Recap
WWDC 2019 RecapWWDC 2019 Recap
WWDC 2019 Recap
inovex GmbH
 
Network Policies
Network PoliciesNetwork Policies
Network Policies
inovex GmbH
 
Interpretable Machine Learning
Interpretable Machine LearningInterpretable Machine Learning
Interpretable Machine Learning
inovex GmbH
 
Jenkins X – CI/CD in wolkigen Umgebungen
Jenkins X – CI/CD in wolkigen UmgebungenJenkins X – CI/CD in wolkigen Umgebungen
Jenkins X – CI/CD in wolkigen Umgebungen
inovex GmbH
 
AI auf Edge-Geraeten
AI auf Edge-GeraetenAI auf Edge-Geraeten
AI auf Edge-Geraeten
inovex GmbH
 
Prometheus on Kubernetes
Prometheus on KubernetesPrometheus on Kubernetes
Prometheus on Kubernetes
inovex GmbH
 
Deep Learning for Recommender Systems
Deep Learning for Recommender SystemsDeep Learning for Recommender Systems
Deep Learning for Recommender Systems
inovex GmbH
 
Azure IoT Edge
Azure IoT EdgeAzure IoT Edge
Azure IoT Edge
inovex GmbH
 
Representation Learning von Zeitreihen
Representation Learning von ZeitreihenRepresentation Learning von Zeitreihen
Representation Learning von Zeitreihen
inovex GmbH
 
Talk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale AssistentenTalk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale Assistenten
inovex GmbH
 
Künstlich intelligent?
Künstlich intelligent?Künstlich intelligent?
Künstlich intelligent?
inovex GmbH
 
Dev + Ops = Go
Dev + Ops = GoDev + Ops = Go
Dev + Ops = Go
inovex GmbH
 
Das Android Open Source Project
Das Android Open Source ProjectDas Android Open Source Project
Das Android Open Source Project
inovex GmbH
 
Machine Learning Interpretability
Machine Learning InterpretabilityMachine Learning Interpretability
Machine Learning Interpretability
inovex GmbH
 
Performance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use casePerformance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use case
inovex GmbH
 
People & Products – Lessons learned from the daily IT madness
People & Products – Lessons learned from the daily IT madnessPeople & Products – Lessons learned from the daily IT madness
People & Products – Lessons learned from the daily IT madness
inovex GmbH
 
Infrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with PulumiInfrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with Pulumi
inovex GmbH
 
Remote First – Der Arbeitsplatz in der Cloud
Remote First – Der Arbeitsplatz in der CloudRemote First – Der Arbeitsplatz in der Cloud
Remote First – Der Arbeitsplatz in der Cloud
inovex GmbH
 

More from inovex GmbH (20)

Are you sure about that?! Uncertainty Quantification in AI
Are you sure about that?! Uncertainty Quantification in AIAre you sure about that?! Uncertainty Quantification in AI
Are you sure about that?! Uncertainty Quantification in AI
 
Why natural language is next step in the AI evolution
Why natural language is next step in the AI evolutionWhy natural language is next step in the AI evolution
Why natural language is next step in the AI evolution
 
WWDC 2019 Recap
WWDC 2019 RecapWWDC 2019 Recap
WWDC 2019 Recap
 
Network Policies
Network PoliciesNetwork Policies
Network Policies
 
Interpretable Machine Learning
Interpretable Machine LearningInterpretable Machine Learning
Interpretable Machine Learning
 
Jenkins X – CI/CD in wolkigen Umgebungen
Jenkins X – CI/CD in wolkigen UmgebungenJenkins X – CI/CD in wolkigen Umgebungen
Jenkins X – CI/CD in wolkigen Umgebungen
 
AI auf Edge-Geraeten
AI auf Edge-GeraetenAI auf Edge-Geraeten
AI auf Edge-Geraeten
 
Prometheus on Kubernetes
Prometheus on KubernetesPrometheus on Kubernetes
Prometheus on Kubernetes
 
Deep Learning for Recommender Systems
Deep Learning for Recommender SystemsDeep Learning for Recommender Systems
Deep Learning for Recommender Systems
 
Azure IoT Edge
Azure IoT EdgeAzure IoT Edge
Azure IoT Edge
 
Representation Learning von Zeitreihen
Representation Learning von ZeitreihenRepresentation Learning von Zeitreihen
Representation Learning von Zeitreihen
 
Talk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale AssistentenTalk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale Assistenten
 
Künstlich intelligent?
Künstlich intelligent?Künstlich intelligent?
Künstlich intelligent?
 
Dev + Ops = Go
Dev + Ops = GoDev + Ops = Go
Dev + Ops = Go
 
Das Android Open Source Project
Das Android Open Source ProjectDas Android Open Source Project
Das Android Open Source Project
 
Machine Learning Interpretability
Machine Learning InterpretabilityMachine Learning Interpretability
Machine Learning Interpretability
 
Performance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use casePerformance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use case
 
People & Products – Lessons learned from the daily IT madness
People & Products – Lessons learned from the daily IT madnessPeople & Products – Lessons learned from the daily IT madness
People & Products – Lessons learned from the daily IT madness
 
Infrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with PulumiInfrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with Pulumi
 
Remote First – Der Arbeitsplatz in der Cloud
Remote First – Der Arbeitsplatz in der CloudRemote First – Der Arbeitsplatz in der Cloud
Remote First – Der Arbeitsplatz in der Cloud
 

Recently uploaded

SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
Yara Milbes
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
TaghreedAltamimi
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
YousufSait3
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
Peter Muessig
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
mz5nrf0n
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
ssuserad3af4
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 

Recently uploaded (20)

SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
316895207-SAP-Oil-and-Gas-Downstream-Training.pptx
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 

lldb – Debugger auf Abwegen

  • 2. lldb - Debugger auf Abwegen Oliver Bayer inovex GmbH
  • 3. Disclaimer: Nur weil es technisch geht, muss es noch lange nicht sinnvoll sein!
  • 6. Conditional Breakpoints foo("") func foo(_ value: String) { ... } foo("bar") Foo.swift Bar.swift
  • 11. Metabreakpoints foo("bar") func foo(_ value: String) { ... } foo("bar") Foo.swift Bar.swift
  • 12. br s -n foo -N macoun -d MetabreakpointsMetabreakpoints foo("bar") func foo(_ value: String) { ... } Bar.swift
  • 13. br set -n foo -N macoun -d br s -f Bar.swift -l 42 -C "br en macoun" -G true MetabreakpointsMetabreakpoints foo("bar") func foo(_ value: String) { ... } Bar.swift
  • 15. Metabreakpoints func seiteneffekteFuer100() { do() something() forMe() } br s -p . -X seiteneffekteFuer100 -f Foo.swift -G true br command add -s python print("Line: {}".format(frame.GetLineEntry().GetLine())) DONE
  • 16. Metabreakpoints func seiteneffekteFuer100() { do() something() forMe() } br s -p . -X seiteneffekteFuer100 -f Foo.swift -G true br command add -s python print("Line: {}".format(frame.GetLineEntry().GetLine())) DONE
  • 17. Metabreakpoints func seiteneffekteFuer100() { do() something() forMe() } br s -p . -X seiteneffekteFuer100 -f Foo.swift -G true br command add -s python print("Line: {}".format(frame.GetLineEntry().GetLine())) DONE
  • 18. Metabreakpoints func seiteneffekteFuer100() { do() something() forMe() } br s -p . -X seiteneffekteFuer100 -f Foo.swift -G true br command add -s python print("Line: {}".format(frame.GetLineEntry().GetLine())) DONE
  • 19. Metabreakpoints func do() { … let player = AVPlayer(playerItem: item) … player.play() … }
  • 20. Metabreakpoints func do() { … let player = AVPlayer(playerItem: item) … } br s -f Player.swift -l 4 -C "call player.isMuted = false" -G true
  • 21. Metabreakpoints func do() { … let player = AVPlayer(playerItem: item) // Hier der Breakpoint … } br s -f Player.swift -p "// Hier der Breakpoint" -X do -C "call player.isMuted = true" -G true
  • 22. Metabreakpoints •Auf dem Stack1 steht die Rücksprungadresse des Aufrufenden •Nach dem Rücksprung steht die Adresse der AVPlayer Instanz in Register rax1 [1] x86 Architekturen
  • 23. Metabreakpoints br s -S "-[AVPlayer init]" -K false br command add settings set target.language objc br s -a `(unsigned long)*(unsigned long *)$rsp` -o true -C "exp -l objc -- [(AVPlayer *)$rax setMuted: @YES]" -G true settings set target.language swift continue
  • 24. Metabreakpoints br s -S "-[AVPlayer init]" -K false br command add settings set target.language objc br s -a `(unsigned long)*(unsigned long *)$rsp` -o true -C "exp -l objc -- [(AVPlayer *)$rax setMuted: @YES]" -G true settings set target.language swift continue
  • 25. Metabreakpoints br s -S "-[AVPlayer init]" -K false br command add settings set target.language objc br s -a `(unsigned long)*(unsigned long *)$rsp` -o true -C "exp -l objc -- [(AVPlayer *)$rax setMuted: @YES]" -G true settings set target.language swift continue
  • 26. Metabreakpoints br s -S "-[AVPlayer init]" -K false br command add settings set target.language objc br s -a `(unsigned long)*(unsigned long *)$rsp` -o true -C "exp -l objc -- [(AVPlayer *)$rax setMuted: @YES]" -G true settings set target.language swift continue
  • 27. Metabreakpoints br s -S "-[AVPlayer init]" -K false br command add settings set target.language objc br s -a `(unsigned long)*(unsigned long *)$rsp` -o true -C "exp -l objc -- [(AVPlayer *)$rax setMuted: @YES]" -G true settings set target.language swift continue
  • 28. Metabreakpoints br s -S "-[AVPlayer init]" -K false br command add settings set target.language objc br s -a `(unsigned long)*(unsigned long *)$rsp` -o true -C "exp -l objc -- [(AVPlayer *)$rax setMuted: @YES]" -G true settings set target.language swift continue
  • 29. Metabreakpoints br s -S "-[AVPlayer init]" -K false br command add settings set target.language objc br s -a `(unsigned long)*(unsigned long *)$rsp` -o true -C "exp -l objc -- [(AVPlayer *)$rax setMuted: @YES]" -G true settings set target.language swift continue
  • 30. Neue Wege gehen mit thread •Codepfade zur Laufzeit manipulieren •Methoden kurzschließen •Rückgabewerte ändern
  • 31. Demo
  • 32. Neue Wege gehen mit thread •Nachteil an thread return et al. → bremst das Ausführen des Codes aus
 •Idee: (Binary) Patch → genauso schnell wie vorher
  • 33. Binary Patch Breakpoint private func isExpectedInput(_ value: String) -> Bool { if value.lowercased() == secret { return true } else { return false } }
  • 34. Binary Patch Breakpoint private func isExpectedInput(_ value: String) -> Bool { return true }
  • 35. Binary Patch Breakpoint push rbp
 mov rbp, rsp push 0x1 pop rax pop rbp ret 'x55x6ax01x58x5dxc3'
  • 36. Binary Patch Breakpoint br s -n isExpectedInput -o true -K false br command add -s python patch = 'x55xB8x01x00x00x00x5dxc3' addr = bp_loc.GetLoadAddress() error = lldb.SBError() proc = frame.GetThread().GetProcess() result = proc.WriteMemory(addr, patch, error) proc.Continue() DONE
  • 37. Binary Patch Breakpoint br s -n isExpectedInput -o true -K false br command add -s python patch = 'x55xB8x01x00x00x00x5dxc3' addr = bp_loc.GetLoadAddress() error = lldb.SBError() proc = frame.GetThread().GetProcess() result = proc.WriteMemory(addr, patch, error) proc.Continue() DONE
  • 38. Binary Patch Breakpoint br s -n isExpectedInput -o true -K false br command add -s python patch = 'x55xB8x01x00x00x00x5dxc3' addr = bp_loc.GetLoadAddress() error = lldb.SBError() proc = frame.GetThread().GetProcess() result = proc.WriteMemory(addr, patch, error) proc.Continue() DONE
  • 39. Binary Patch Breakpoint br s -n isExpectedInput -o true -K false br command add -s python patch = 'x55xB8x01x00x00x00x5dxc3' addr = bp_loc.GetLoadAddress() error = lldb.SBError() proc = frame.GetThread().GetProcess() result = proc.WriteMemory(addr, patch, error) proc.Continue() DONE
  • 40. Binary Patch Breakpoint br s -n isExpectedInput -o true -K false br command add -s python patch = 'x55xB8x01x00x00x00x5dxc3' addr = bp_loc.GetLoadAddress() error = lldb.SBError() proc = frame.GetThread().GetProcess() result = proc.WriteMemory(addr, patch, error) proc.Continue() DONE
  • 41. Binary Patch Breakpoint br s -n isExpectedInput -o true -K false br command add -s python patch = 'x55xB8x01x00x00x00x5dxc3' addr = bp_loc.GetLoadAddress() error = lldb.SBError() proc = frame.GetThread().GetProcess() result = proc.WriteMemory(addr, patch, error) proc.Continue() DONE
  • 42. Binary Patch Breakpoint br s -n isExpectedInput -o true -K false br command add -s python patch = 'x55xB8x01x00x00x00x5dxc3' addr = bp_loc.GetLoadAddress() error = lldb.SBError() proc = frame.GetThread().GetProcess() result = proc.WriteMemory(addr, patch, error) proc.Continue() DONE
  • 43. Binary Patch Breakpoint br s -n isExpectedInput -o true -K false br command add -s python patch = 'x55xB8x01x00x00x00x5dxc3' addr = bp_loc.GetLoadAddress() error = lldb.SBError() proc = frame.GetThread().GetProcess() result = proc.WriteMemory(addr, patch, error) proc.Continue() DONE
  • 44. Patch Breakpoint private let secret = "foo" —> "macoun"
  • 45. Patch Breakpoint private let secret = "foo" // —> "macoun" br s -F "Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String" -c "0 == (int)strcmp("foo", (char *)$rdi)" -o true br command add exp -- char * $value = (char *)"macoun" register write $rdi `(unsigned long *)$value` register write $rsi 6 continue DONE
  • 46. Patch Breakpoint private let secret = "foo" // —> "macoun" br s -F "Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String" -c "0 == (int)strcmp("foo", (char *)$rdi)" -o true br command add exp -- char * $value = (char *)"macoun" register write $rdi `(unsigned long *)$value` register write $rsi 6 continue DONE
  • 47. Patch Breakpoint private let secret = "foo" // —> "macoun" br s -F "Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String" -c "0 == (int)strcmp("foo", (char *)$rdi)" -o true br command add exp -- char * $value = (char *)"macoun" register write $rdi `(unsigned long *)$value` register write $rsi 6 continue DONE
  • 48. Patch Breakpoint private let secret = "foo" // —> "macoun" br s -F "Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String" -c "0 == (int)strcmp("foo", (char *)$rdi)" -o true br command add exp -- char * $value = (char *)"macoun" register write $rdi `(unsigned long *)$value` register write $rsi 6 continue DONE
  • 49. Patch Breakpoint private let secret = "foo" // —> "macoun" br s -F "Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String" -c "0 == (int)strcmp("foo", (char *)$rdi)" -o true br command add exp -- char * $value = (char *)"macoun" register write $rdi `(unsigned long *)$value` register write $rsi 6 continue DONE
  • 50. Patch Breakpoint private let secret = "foo" // —> "macoun" br s -F "Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String" -c "0 == (int)strcmp("foo", (char *)$rdi)" -o true br command add exp -- char * $value = (char *)"macoun" register write $rdi `(unsigned long *)$value` register write $rsi 6 continue DONE