SlideShare a Scribd company logo
Introduction to IDAPython
Byoungyoung Lee
POSTECH
PLUS 038
override@postech.ac.kr
Overview
• Brief intro to IDAPython
• How to install
• Examples
– Searching disassembly patterns
– Searching system calls in the binary
– Deobfuscation
Automatic Reversing with IDA
• To do automatic reversing ?
– you need to write scripts

• IDA supports multiple interfaces
– Plugins (C++)
– IDC (C-like scripting)
– IDAPython (Python)
Brief intro to IDAPython
• Most things you can do w/ your hands
– can be done w/ IDAPython
How to install
• COPY ‘python’ directory
– to %IDA_DIR%

• PUT ‘python.plw’
– to %IDA_DIR%/plugins
• ex) C:Program FilesIDA52plugins
How to execute
1. Press ‘ALT+9’ in IDA
2. Choose Python file you’d like to execute
 Results would be printed in the log window
Simple example
– walking the functions
# walkFunctions.py
### Walk the functions
# Get the segment's starting address
ea = ScreenEA()
# Loop through all the functions
for function_ea in Functions(SegStart(ea), SegEnd(ea)):
# Print the address and the function name.
print hex(function_ea), GetFunctionName(function_ea)
Simple example
– walking the instructions
# walkInstructions.py
# For each of the segments
for seg_ea in Segments():
# For each of the defined elements
for head in Heads(seg_ea, SegEnd(seg_ea)):
# If it's an instruction
if isCode(GetFlags(head)):
# Get the Disasm and print it
disasm = GetDisasm(head)
print disasm
Application
- Find ‘CALL’ instructions
# searchSystemCalls.py
from idautils import *
seg_ea = SegByName(".text")
# For each instruction
for addr in Heads(seg_ea, SegEnd(seg_ea)):
# Get disassembly
disasmStr = GetDisasm(addr)
if disasmStr.startswith( "int ") == True:
# Print if it is a system call
print "0x%08x [%s]" % (addr, disasmStr)
Deobfuscation
• What is obfuscation?
– To transform binary into something
• which has the same executing behavior
• which has very different outer representation

– To disrupt disassemblers
Deobfuscation
• How to obfuscate the binary
– Simple obfuscation methods
JMP X

=

PUSH X
RET

JMP X

=

XOR
JZ

original

ECX, ECX
X

obfuscated
Deobfuscation
• What happens due to these obfuscation?
– IDA failed to analyze the binary properly
• which means ..
• YOU CANNOT USE CFG LAYOUT
• YOU CANNOT EASILY FOLLOW THE CONTROL
FLOW
Deobfuscation
• Let’s learn deobfuscation w/ an example
– 1.
– 2.
– 3.
– 4.

load reversing500 in IDA
move to 0x08049891, and see ‘PUSH/RET’
execute ‘deobfuscation_simple.py’
see the instructions of 0x08049891

– For full deobfuscation
• execute ‘deobfuscation_full.py’
Exercises (more applications)
• 1. To list all string copy functions?
– such as strcpy(), strncpy(), strcat(), and etc.
– YES ,this is for finding Stack Overflow vulns.

• 2. To examine all malloc() calls?
– whose arg. is determined dynamically
– YES ,this is for finding Heap Overflow vulns.

• 3. Memory/Register Computation Back Tracer
Reference
• “Introduction to IDAPython”
by Ero Carrera
Ad

Recommended

Ida python intro
Ida python intro
小静 安
 
Reversing & Malware Analysis Training Part 4 - Assembly Programming Basics
Reversing & Malware Analysis Training Part 4 - Assembly Programming Basics
securityxploded
 
Basics of ANT
Basics of ANT
Puneet Sharma - Steepgraph Systems
 
[2014 CodeEngn Conference 10] 정광운 - 안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
[2014 CodeEngn Conference 10] 정광운 - 안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
GangSeok Lee
 
Return oriented programming (ROP)
Return oriented programming (ROP)
Pipat Methavanitpong
 
VB2013 - Security Research and Development Framework
VB2013 - Security Research and Development Framework
Amr Thabet
 
Snake bites : Python for Pentesters
Snake bites : Python for Pentesters
Anant Shrivastava
 
Reversing & Malware Analysis Training Part 6 - Practical Reversing (I)
Reversing & Malware Analysis Training Part 6 - Practical Reversing (I)
securityxploded
 
Introduction to Python for Bioinformatics
Introduction to Python for Bioinformatics
José Héctor Gálvez
 
Perl Modules
Perl Modules
stn_tkiller
 
Anti-Virus Evasion Techniques and Countermeasures
Anti-Virus Evasion Techniques and Countermeasures
n|u - The Open Security Community
 
Reversing & malware analysis training part 2 introduction to windows internals
Reversing & malware analysis training part 2 introduction to windows internals
securityxploded
 
Os Vanrossum
Os Vanrossum
oscon2007
 
Buffer overflow attacks
Buffer overflow attacks
Japneet Singh
 
Captain Hook: Pirating AVs to Bypass Exploit Mitigations
Captain Hook: Pirating AVs to Bypass Exploit Mitigations
enSilo
 
Dynamic Binary Instrumentation
Dynamic Binary Instrumentation
Cysinfo Cyber Security Community
 
Tranning-2
Tranning-2
Ali Hussain
 
Buffer Overflow Demo by Saurabh Sharma
Buffer Overflow Demo by Saurabh Sharma
n|u - The Open Security Community
 
Improving DroidBox
Improving DroidBox
Kelwin Yang
 
Buffer Overflows
Buffer Overflows
Sumit Kumar
 
Richard wartell malware is hard. let's go shopping!!
Richard wartell malware is hard. let's go shopping!!
Shakacon
 
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis EN
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis EN
GangSeok Lee
 
Elixir
Elixir
Robert Brown
 
PyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtime
National Cheng Kung University
 
Exploiting stack overflow 101
Exploiting stack overflow 101
n|u - The Open Security Community
 
Stack-Based Buffer Overflows
Stack-Based Buffer Overflows
Daniel Tumser
 
Effective testing with pytest
Effective testing with pytest
Hector Canto
 
Buffer overflow
Buffer overflow
قصي نسور
 
Advanced Malware Analysis Training Session 5 - Reversing Automation
Advanced Malware Analysis Training Session 5 - Reversing Automation
securityxploded
 
Dytan: A Generic Dynamic Taint Analysis Framework (ISSTA 2007)
Dytan: A Generic Dynamic Taint Analysis Framework (ISSTA 2007)
James Clause
 

More Related Content

What's hot (20)

Introduction to Python for Bioinformatics
Introduction to Python for Bioinformatics
José Héctor Gálvez
 
Perl Modules
Perl Modules
stn_tkiller
 
Anti-Virus Evasion Techniques and Countermeasures
Anti-Virus Evasion Techniques and Countermeasures
n|u - The Open Security Community
 
Reversing & malware analysis training part 2 introduction to windows internals
Reversing & malware analysis training part 2 introduction to windows internals
securityxploded
 
Os Vanrossum
Os Vanrossum
oscon2007
 
Buffer overflow attacks
Buffer overflow attacks
Japneet Singh
 
Captain Hook: Pirating AVs to Bypass Exploit Mitigations
Captain Hook: Pirating AVs to Bypass Exploit Mitigations
enSilo
 
Dynamic Binary Instrumentation
Dynamic Binary Instrumentation
Cysinfo Cyber Security Community
 
Tranning-2
Tranning-2
Ali Hussain
 
Buffer Overflow Demo by Saurabh Sharma
Buffer Overflow Demo by Saurabh Sharma
n|u - The Open Security Community
 
Improving DroidBox
Improving DroidBox
Kelwin Yang
 
Buffer Overflows
Buffer Overflows
Sumit Kumar
 
Richard wartell malware is hard. let's go shopping!!
Richard wartell malware is hard. let's go shopping!!
Shakacon
 
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis EN
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis EN
GangSeok Lee
 
Elixir
Elixir
Robert Brown
 
PyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtime
National Cheng Kung University
 
Exploiting stack overflow 101
Exploiting stack overflow 101
n|u - The Open Security Community
 
Stack-Based Buffer Overflows
Stack-Based Buffer Overflows
Daniel Tumser
 
Effective testing with pytest
Effective testing with pytest
Hector Canto
 
Buffer overflow
Buffer overflow
قصي نسور
 
Introduction to Python for Bioinformatics
Introduction to Python for Bioinformatics
José Héctor Gálvez
 
Reversing & malware analysis training part 2 introduction to windows internals
Reversing & malware analysis training part 2 introduction to windows internals
securityxploded
 
Os Vanrossum
Os Vanrossum
oscon2007
 
Buffer overflow attacks
Buffer overflow attacks
Japneet Singh
 
Captain Hook: Pirating AVs to Bypass Exploit Mitigations
Captain Hook: Pirating AVs to Bypass Exploit Mitigations
enSilo
 
Improving DroidBox
Improving DroidBox
Kelwin Yang
 
Buffer Overflows
Buffer Overflows
Sumit Kumar
 
Richard wartell malware is hard. let's go shopping!!
Richard wartell malware is hard. let's go shopping!!
Shakacon
 
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis EN
[2014 CodeEngn Conference 11] 김호빈 - Android Bootkit Analysis EN
GangSeok Lee
 
PyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtime
National Cheng Kung University
 
Stack-Based Buffer Overflows
Stack-Based Buffer Overflows
Daniel Tumser
 
Effective testing with pytest
Effective testing with pytest
Hector Canto
 

Viewers also liked (7)

Advanced Malware Analysis Training Session 5 - Reversing Automation
Advanced Malware Analysis Training Session 5 - Reversing Automation
securityxploded
 
Dytan: A Generic Dynamic Taint Analysis Framework (ISSTA 2007)
Dytan: A Generic Dynamic Taint Analysis Framework (ISSTA 2007)
James Clause
 
Packer Genetics: The selfish code
Packer Genetics: The selfish code
jduart
 
Malware Detection With Multiple Features
Malware Detection With Multiple Features
Muhammad Najmi Ahmad Zabidi
 
H@dfex 2015 malware analysis
H@dfex 2015 malware analysis
Charles Lim
 
Control Flow Analysis
Control Flow Analysis
Edgar Barbosa
 
Practical Malware Analysis: Ch 0: Malware Analysis Primer & 1: Basic Static T...
Practical Malware Analysis: Ch 0: Malware Analysis Primer & 1: Basic Static T...
Sam Bowne
 
Advanced Malware Analysis Training Session 5 - Reversing Automation
Advanced Malware Analysis Training Session 5 - Reversing Automation
securityxploded
 
Dytan: A Generic Dynamic Taint Analysis Framework (ISSTA 2007)
Dytan: A Generic Dynamic Taint Analysis Framework (ISSTA 2007)
James Clause
 
Packer Genetics: The selfish code
Packer Genetics: The selfish code
jduart
 
H@dfex 2015 malware analysis
H@dfex 2015 malware analysis
Charles Lim
 
Control Flow Analysis
Control Flow Analysis
Edgar Barbosa
 
Practical Malware Analysis: Ch 0: Malware Analysis Primer & 1: Basic Static T...
Practical Malware Analysis: Ch 0: Malware Analysis Primer & 1: Basic Static T...
Sam Bowne
 
Ad

Similar to Introduction to ida python (20)

Half-automatic Compilable Source Code Recovery
Half-automatic Compilable Source Code Recovery
Joxean Koret
 
Binary obfuscation using signals
Binary obfuscation using signals
UltraUploader
 
Slide Reverse Engineering an APT Malware targeting Vietnamese
Slide Reverse Engineering an APT Malware targeting Vietnamese
Minh-Triet Pham Tran
 
MODERN MALWARE: OBFUSCATION AND EMULATION DEF CON CHINA 1.0 (2019)
MODERN MALWARE: OBFUSCATION AND EMULATION DEF CON CHINA 1.0 (2019)
Alexandre Borges
 
MODERN MALWARE THREAT: HANDLING OBFUSCATED CODE -- CONFIDENCE CONFERENCE (2019)
MODERN MALWARE THREAT: HANDLING OBFUSCATED CODE -- CONFIDENCE CONFERENCE (2019)
Alexandre Borges
 
Advanced malware analysis training session5 reversing automation
Advanced malware analysis training session5 reversing automation
Cysinfo Cyber Security Community
 
MODERN TECHNIQUES TO DEOBFUSCATE AND UEFI/BIOS MALWARE -- HITB 2019 AMSTERDAM
MODERN TECHNIQUES TO DEOBFUSCATE AND UEFI/BIOS MALWARE -- HITB 2019 AMSTERDAM
Alexandre Borges
 
Steelcon 2014 - Process Injection with Python
Steelcon 2014 - Process Injection with Python
infodox
 
On deobfuscation in practice
On deobfuscation in practice
Dmitry Schelkunov
 
Reversing & malware analysis training part 5 reverse engineering tools basics
Reversing & malware analysis training part 5 reverse engineering tools basics
Abdulrahman Bassam
 
Automatic binary deobfuscation
Automatic binary deobfuscation
UltraUploader
 
Reverse Engineering 101
Reverse Engineering 101
GDSC UofT Mississauga
 
Hacking with Reverse Engineering and Defense against it
Hacking with Reverse Engineering and Defense against it
Prakashchand Suthar
 
Return Oriented Programming - ROP
Return Oriented Programming - ROP
Mihir Shah
 
Ben Agre - Adding Another Level of Hell to Reverse Engineering
Ben Agre - Adding Another Level of Hell to Reverse Engineering
Source Conference
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Silabus Training Reverse Engineering
Silabus Training Reverse Engineering
Satria Ady Pradana
 
Applying Anti-Reversing Techniques to Machine Code
Applying Anti-Reversing Techniques to Machine Code
Teodoro Cipresso
 
Demystifying Binary Reverse Engineering - Pixels Camp
Demystifying Binary Reverse Engineering - Pixels Camp
André Baptista
 
Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]
Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]
RootedCON
 
Half-automatic Compilable Source Code Recovery
Half-automatic Compilable Source Code Recovery
Joxean Koret
 
Binary obfuscation using signals
Binary obfuscation using signals
UltraUploader
 
Slide Reverse Engineering an APT Malware targeting Vietnamese
Slide Reverse Engineering an APT Malware targeting Vietnamese
Minh-Triet Pham Tran
 
MODERN MALWARE: OBFUSCATION AND EMULATION DEF CON CHINA 1.0 (2019)
MODERN MALWARE: OBFUSCATION AND EMULATION DEF CON CHINA 1.0 (2019)
Alexandre Borges
 
MODERN MALWARE THREAT: HANDLING OBFUSCATED CODE -- CONFIDENCE CONFERENCE (2019)
MODERN MALWARE THREAT: HANDLING OBFUSCATED CODE -- CONFIDENCE CONFERENCE (2019)
Alexandre Borges
 
Advanced malware analysis training session5 reversing automation
Advanced malware analysis training session5 reversing automation
Cysinfo Cyber Security Community
 
MODERN TECHNIQUES TO DEOBFUSCATE AND UEFI/BIOS MALWARE -- HITB 2019 AMSTERDAM
MODERN TECHNIQUES TO DEOBFUSCATE AND UEFI/BIOS MALWARE -- HITB 2019 AMSTERDAM
Alexandre Borges
 
Steelcon 2014 - Process Injection with Python
Steelcon 2014 - Process Injection with Python
infodox
 
On deobfuscation in practice
On deobfuscation in practice
Dmitry Schelkunov
 
Reversing & malware analysis training part 5 reverse engineering tools basics
Reversing & malware analysis training part 5 reverse engineering tools basics
Abdulrahman Bassam
 
Automatic binary deobfuscation
Automatic binary deobfuscation
UltraUploader
 
Hacking with Reverse Engineering and Defense against it
Hacking with Reverse Engineering and Defense against it
Prakashchand Suthar
 
Return Oriented Programming - ROP
Return Oriented Programming - ROP
Mihir Shah
 
Ben Agre - Adding Another Level of Hell to Reverse Engineering
Ben Agre - Adding Another Level of Hell to Reverse Engineering
Source Conference
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Silabus Training Reverse Engineering
Silabus Training Reverse Engineering
Satria Ady Pradana
 
Applying Anti-Reversing Techniques to Machine Code
Applying Anti-Reversing Techniques to Machine Code
Teodoro Cipresso
 
Demystifying Binary Reverse Engineering - Pixels Camp
Demystifying Binary Reverse Engineering - Pixels Camp
André Baptista
 
Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]
Sergi Álvarez & Roi Martín - Radare2 Preview [RootedCON 2010]
RootedCON
 
Ad

More from geeksec80 (19)

Sipoc diagram (1)
Sipoc diagram (1)
geeksec80
 
Sipoc diagram (1)
Sipoc diagram (1)
geeksec80
 
Sipoc diagram
Sipoc diagram
geeksec80
 
Python arsenal for re (1)
Python arsenal for re (1)
geeksec80
 
Python arsenal for re
Python arsenal for re
geeksec80
 
02 banking trojans-thomassiebert
02 banking trojans-thomassiebert
geeksec80
 
44 con slides (1)
44 con slides (1)
geeksec80
 
44 con slides
44 con slides
geeksec80
 
Fuzz nt
Fuzz nt
geeksec80
 
Rpc调试通用
Rpc调试通用
geeksec80
 
Bh us 11_tsai_pan_weapons_targeted_attack_wp
Bh us 11_tsai_pan_weapons_targeted_attack_wp
geeksec80
 
Taking browsers fuzzing new
Taking browsers fuzzing new
geeksec80
 
529 owasp top 10 2013 - rc1[1]
529 owasp top 10 2013 - rc1[1]
geeksec80
 
Deep sec 2012_rosario_valotta_-_taking_browsers_fuzzing_to_the_next_(dom)_level
Deep sec 2012_rosario_valotta_-_taking_browsers_fuzzing_to_the_next_(dom)_level
geeksec80
 
2012 04-16-ultrasurf-analysis (2)
2012 04-16-ultrasurf-analysis (2)
geeksec80
 
12058 woot13-kholia
12058 woot13-kholia
geeksec80
 
Https interception proxies
Https interception proxies
geeksec80
 
Taint scope
Taint scope
geeksec80
 
Automated antlr tree walker
Automated antlr tree walker
geeksec80
 
Sipoc diagram (1)
Sipoc diagram (1)
geeksec80
 
Sipoc diagram (1)
Sipoc diagram (1)
geeksec80
 
Sipoc diagram
Sipoc diagram
geeksec80
 
Python arsenal for re (1)
Python arsenal for re (1)
geeksec80
 
Python arsenal for re
Python arsenal for re
geeksec80
 
02 banking trojans-thomassiebert
02 banking trojans-thomassiebert
geeksec80
 
44 con slides (1)
44 con slides (1)
geeksec80
 
44 con slides
44 con slides
geeksec80
 
Rpc调试通用
Rpc调试通用
geeksec80
 
Bh us 11_tsai_pan_weapons_targeted_attack_wp
Bh us 11_tsai_pan_weapons_targeted_attack_wp
geeksec80
 
Taking browsers fuzzing new
Taking browsers fuzzing new
geeksec80
 
529 owasp top 10 2013 - rc1[1]
529 owasp top 10 2013 - rc1[1]
geeksec80
 
Deep sec 2012_rosario_valotta_-_taking_browsers_fuzzing_to_the_next_(dom)_level
Deep sec 2012_rosario_valotta_-_taking_browsers_fuzzing_to_the_next_(dom)_level
geeksec80
 
2012 04-16-ultrasurf-analysis (2)
2012 04-16-ultrasurf-analysis (2)
geeksec80
 
12058 woot13-kholia
12058 woot13-kholia
geeksec80
 
Https interception proxies
Https interception proxies
geeksec80
 
Automated antlr tree walker
Automated antlr tree walker
geeksec80
 

Recently uploaded (20)

Revista digital preescolar en transformación
Revista digital preescolar en transformación
guerragallardo26
 
Nice Dream.pdf /
Nice Dream.pdf /
ErinUsher3
 
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
 
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
RAKESH SAJJAN
 
How to Manage Inventory Movement in Odoo 18 POS
How to Manage Inventory Movement in Odoo 18 POS
Celine George
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
How to Manage Multi Language for Invoice in Odoo 18
How to Manage Multi Language for Invoice in Odoo 18
Celine George
 
JHS SHS Back to School 2024-2025 .pptx
JHS SHS Back to School 2024-2025 .pptx
melvinapay78
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
2025 June Year 9 Presentation: Subject selection.pptx
2025 June Year 9 Presentation: Subject selection.pptx
mansk2
 
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
 
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
Quiz Club of PSG College of Arts & Science
 
Exploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle School
Marie
 
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Pragya - UEM Kolkata Quiz Club
 
How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18
Celine George
 
Wax Moon, Richmond, VA. Terrence McPherson
Wax Moon, Richmond, VA. Terrence McPherson
TerrenceMcPherson1
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
Introduction to problem solving Techniques
Introduction to problem solving Techniques
merlinjohnsy
 
Revista digital preescolar en transformación
Revista digital preescolar en transformación
guerragallardo26
 
Nice Dream.pdf /
Nice Dream.pdf /
ErinUsher3
 
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
 
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
Assisting Individuals and Families to Promote and Maintain Health – Unit 7 | ...
RAKESH SAJJAN
 
How to Manage Inventory Movement in Odoo 18 POS
How to Manage Inventory Movement in Odoo 18 POS
Celine George
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
How to Manage Multi Language for Invoice in Odoo 18
How to Manage Multi Language for Invoice in Odoo 18
Celine George
 
JHS SHS Back to School 2024-2025 .pptx
JHS SHS Back to School 2024-2025 .pptx
melvinapay78
 
june 10 2025 ppt for madden on art science is over.pptx
june 10 2025 ppt for madden on art science is over.pptx
roger malina
 
2025 June Year 9 Presentation: Subject selection.pptx
2025 June Year 9 Presentation: Subject selection.pptx
mansk2
 
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
 
Exploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle School
Marie
 
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Pragya - UEM Kolkata Quiz Club
 
How to Configure Vendor Management in Lunch App of Odoo 18
How to Configure Vendor Management in Lunch App of Odoo 18
Celine George
 
Wax Moon, Richmond, VA. Terrence McPherson
Wax Moon, Richmond, VA. Terrence McPherson
TerrenceMcPherson1
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
Introduction to problem solving Techniques
Introduction to problem solving Techniques
merlinjohnsy
 

Introduction to ida python

  • 2. Overview • Brief intro to IDAPython • How to install • Examples – Searching disassembly patterns – Searching system calls in the binary – Deobfuscation
  • 3. Automatic Reversing with IDA • To do automatic reversing ? – you need to write scripts • IDA supports multiple interfaces – Plugins (C++) – IDC (C-like scripting) – IDAPython (Python)
  • 4. Brief intro to IDAPython • Most things you can do w/ your hands – can be done w/ IDAPython
  • 5. How to install • COPY ‘python’ directory – to %IDA_DIR% • PUT ‘python.plw’ – to %IDA_DIR%/plugins • ex) C:Program FilesIDA52plugins
  • 6. How to execute 1. Press ‘ALT+9’ in IDA 2. Choose Python file you’d like to execute  Results would be printed in the log window
  • 7. Simple example – walking the functions # walkFunctions.py ### Walk the functions # Get the segment's starting address ea = ScreenEA() # Loop through all the functions for function_ea in Functions(SegStart(ea), SegEnd(ea)): # Print the address and the function name. print hex(function_ea), GetFunctionName(function_ea)
  • 8. Simple example – walking the instructions # walkInstructions.py # For each of the segments for seg_ea in Segments(): # For each of the defined elements for head in Heads(seg_ea, SegEnd(seg_ea)): # If it's an instruction if isCode(GetFlags(head)): # Get the Disasm and print it disasm = GetDisasm(head) print disasm
  • 9. Application - Find ‘CALL’ instructions # searchSystemCalls.py from idautils import * seg_ea = SegByName(".text") # For each instruction for addr in Heads(seg_ea, SegEnd(seg_ea)): # Get disassembly disasmStr = GetDisasm(addr) if disasmStr.startswith( "int ") == True: # Print if it is a system call print "0x%08x [%s]" % (addr, disasmStr)
  • 10. Deobfuscation • What is obfuscation? – To transform binary into something • which has the same executing behavior • which has very different outer representation – To disrupt disassemblers
  • 11. Deobfuscation • How to obfuscate the binary – Simple obfuscation methods JMP X = PUSH X RET JMP X = XOR JZ original ECX, ECX X obfuscated
  • 12. Deobfuscation • What happens due to these obfuscation? – IDA failed to analyze the binary properly • which means .. • YOU CANNOT USE CFG LAYOUT • YOU CANNOT EASILY FOLLOW THE CONTROL FLOW
  • 13. Deobfuscation • Let’s learn deobfuscation w/ an example – 1. – 2. – 3. – 4. load reversing500 in IDA move to 0x08049891, and see ‘PUSH/RET’ execute ‘deobfuscation_simple.py’ see the instructions of 0x08049891 – For full deobfuscation • execute ‘deobfuscation_full.py’
  • 14. Exercises (more applications) • 1. To list all string copy functions? – such as strcpy(), strncpy(), strcat(), and etc. – YES ,this is for finding Stack Overflow vulns. • 2. To examine all malloc() calls? – whose arg. is determined dynamically – YES ,this is for finding Heap Overflow vulns. • 3. Memory/Register Computation Back Tracer
  • 15. Reference • “Introduction to IDAPython” by Ero Carrera