IDAPython 및 Ghidra 스크립팅
IDAPython과 Ghidra에서 반복적인 분석 작업을 자동화하고 정보를 추출하는 Python 스크립트를 작성합니다.
IDAPython 및 Ghidra 스크립팅은(는) CoddyKit의 무료 Reverse Engineering & Binary Analysis Basics 강의입니다. 이것은 4개 중 1번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Reverse Engineering & Binary Analysis Basics 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Reverse Engineering & Binary Analysis Basics 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
Intro to RE Scripting
Welcome! In this lesson, we'll dive into the world of scripting for reverse engineering. Scripting allows you to automate tasks and extend the capabilities of your favorite RE tools.
Think of it as teaching your tools new tricks!
Why Scripting is Powerful
Why bother with scripting?
- Automation: Repetitive tasks like extracting specific data or renaming functions can be automated.
- Custom Analysis: Perform unique analyses that aren't built into the tool.
- Efficiency: Save countless hours by letting scripts do the heavy lifting.
- Consistency: Ensure the same analysis steps are applied every time.
IDAPython: Getting Started
IDAPython is the Python scripting API for IDA Pro, a popular disassembler. It allows you to interact with IDA's database, manipulate views, and automate complex workflows.
You'll typically import two main modules: idc (IDA C-like functions) and idaapi (IDA API functions).
IDAPython: Listing Functions
Let's write a simple IDAPython script to list all functions in the currently loaded binary. This shows how to iterate through the program's functions.
import idc
print("Functions found in IDA Pro:")
func_ea = idc.get_first_func()
while func_ea != idc.BADADDR:
func_name = idc.get_func_name(func_ea)
print(f" 0x{func_ea:X}: {func_name}")
func_ea = idc.get_next_func(func_ea)
print("Script finished.")Ghidra Scripting: Introduction
Ghidra, another powerful reverse engineering tool, also supports scripting! You can write scripts in Python (using Jython) or Java.
Ghidra scripts are managed through its built-in Script Manager, making them easy to execute and share.
Ghidra Scripting: Listing Functions
Here's a Ghidra Python script that achieves a similar goal: listing all functions in the currently open program. Notice how it interacts with Ghidra's API.
# Ghidra Python script
from ghidra.program.model.listing import Function
print("Functions found in Ghidra:")
functionManager = currentProgram.getFunctionManager()
functions = functionManager.getFunctions(True) # True for ascending order
for func in functions:
print(f" {func.getEntryPoint()}: {func.getName()}")
print("Script finished.")Core Scripting Objects
Both IDA and Ghidra expose core objects to interact with the loaded binary:
- IDA:
idc(for C-like functions, e.g.,get_func_name),idaapi(for higher-level API access). - Ghidra:
currentProgram(the loaded binary),currentAddress(the cursor's current address),monitor(for progress updates).
Beyond Listing: Modifying Data
Scripting isn't just for reading information. You can also modify the analysis database!
- Adding Comments: Attach insightful comments to addresses or functions.
- Renaming Items: Give meaningful names to variables, functions, or structures.
- Applying Types: Define data structures or function prototypes to improve decompilation.
Practical Use Cases
What else can you do with scripting?
- String Extraction: Automatically pull out all readable strings from a specific section.
- API Call Identification: Find all calls to a particular library function (e.g.,
CreateFileW). - Pattern Matching: Search for specific byte sequences or instruction patterns.
- Signature Application: Automatically apply known function signatures.
Scripting Benefits Check
It's time for a quick check on what we've learned about the advantages of using scripting in reverse engineering.
Recap: Scripting Power
You've taken your first steps into the powerful world of reverse engineering scripting!
- We explored why scripting is crucial for efficiency and custom analysis.
- You saw basic examples for both IDAPython and Ghidra Python scripting.
- We touched on how scripts interact with the analysis database and common use cases.
Keep practicing, and you'll unlock even more potential in your RE journey!
자주 묻는 질문
“IDAPython 및 Ghidra 스크립팅” 강의는 무료인가요?
네 — “IDAPython 및 Ghidra 스크립팅” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Reverse Engineering & Binary Analysis Basics 강의 전체를 잠금 해제할 수 있습니다. Reverse Engineering & Binary Analysis Basics 강의에는 총 4개의 강의가 포함되어 있습니다.
“IDAPython 및 Ghidra 스크립팅”에서 뭘 배우나요?
IDAPython과 Ghidra에서 반복적인 분석 작업을 자동화하고 정보를 추출하는 Python 스크립트를 작성합니다. 브라우저에서 직접 실행하는 실습 코드로 Reverse Engineering & Binary Analysis Basics을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Reverse Engineering & Binary Analysis Basics을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Reverse Engineering & Binary Analysis Basics은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 1번째 강의입니다.
“IDAPython 및 Ghidra 스크립팅” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Reverse Engineering & Binary Analysis Basics 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Reverse Engineering & Binary Analysis Basics 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- IDAPython 및 Ghidra 스크립팅
- 데이터 구조 복구 자동화
- 바이너리 패치 기법
- FLIRT 시그니처와 라이브러리 함수 식별