Ghidra

Reverse Engineering Framework

🛠️ Ghidra क्या है?

Ghidra एक powerful open-source reverse engineering framework है जो NSA (National Security Agency) ने develop किया था। इसका काम compiled programs को analyze करना, decompile करना, और source code दोबारा generate करना है।

👉 Malware analysis, software vulnerability research, और binary exploitation के लिए यह सबसे powerful tool माना जाता है।

🔍 Ghidra क्या-क्या कर सकता है

Decompile

Machine code को C-like code में convert करना

Disassemble

Binary को assembly code में convert करना

Analyze Binary

Functions, strings, data structures detect करना

Malware Analysis

Malicious code को देखकर समझना

Patch Binary

Binary को modify करना (crack keygens बनाना)

Multi-Architecture Support

x86, x64, ARM, MIPS, PowerPC, और कई अन्य architectures

⚙️ Ghidra Install करना

Java RequiredInstallation Commands

Java Install (required for Ghidra)

apt install openjdk-17-jre

Ghidra Download (from official GitHub)

wget https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_11.2_build/ghidra_11.2_PUBLIC_20241107.zip

Unzip

unzip ghidra_11.2_PUBLIC_20241107.zip

Run Ghidra

cd ghidra_11.2_PUBLIC
./ghidraRun

👉 Termux में GUI version चलाना मुश्किल है - बेहतर है desktop पर use करो या headless mode use करो।

💻 Basic Commands (Use)

👉 Ghidra GUI-based tool है, लेकिन headless mode में CLI commands use होते हैं:

Headless Analysis (Non-GUI)

./analyzeHeadless path/to/project_dir ProjectName -import binary_file.exe -postScript AnalyzeScript.java

Export Decompiled Code

./analyzeHeadless path/to/project_dir ProjectName -exportDecompile output_dir

Run Specific Analysis Script

./analyzeHeadless path/to/project_dir ProjectName -postScript ScriptName.java

🌐 Real Example (Practical समझ)

Example🎯 Simple CrackMe Reverse Engineering

मान लो तुम्हें एक simple crackme.exe दिया है जो password चाहता है:

Step 1: Ghidra में import करो

File → Import File → crackme.exe select करो

Step 2: Auto Analysis run करो

Window में "Yes" click करो, यह automatically analyze करेगा

Step 3: Main function खोजो

Symbol Tree → Functions → main या entry point देखो

Step 4: Decompiled code देखो

void main(void) {
  char input[100];
  printf("Enter password: ");
  scanf("%s", input);

  if (strcmp(input, "SECRET123") == 0) {
    printf("Access Granted!
");
  } else {
    printf("Access Denied!
");
  }
}
🧠 Output समझो

इसका मतलब:

Password

"SECRET123"

यह hardcoded password है

strcmp()

String Compare Function

Input को "SECRET123" से compare कर रहा है

if-else

Password Check Logic

सही password पर "Access Granted" दिखाएगा

👉 इससे हमें पता चल गया:

  • • Exact password निकाल लिया
  • • Program का logic समझ लिया
  • • अगर चाहे तो patch करके password check हटा सकते हैं

🔥 Advanced Features

Decompiler

Machine code को readable C-like code में convert करता है

String Searching

Embedded strings, passwords, messages find करना

Cross-References

Functions को call करने वाले places देखना

Ghidra Scripts

Java/Python scripts से automate करना

⚠️ Important Warning

Reverse engineering किसी भी software के license terms का violation हो सकता है

Practice के लिए use करो:

  • CTF challenges और crackme challenges
  • Malware analysis training labs
  • Open-source programs जिनका license allow करता है
  • अपने बनाए हुए programs

⚠️ Commercial software, licensed apps, और malware analysis without authorization illegal हो सकता है

🧩 Related Tools

Radare2

Command-line reverse engineering framework

IDA Pro

Commercial (paid) reverse engineering tool

Binary Ninja

Modern, fast reverse engineering tool

x64dbg

Debugger for Windows executables

💡 Simple समझ

Ghidra = "Software का X-ray Scanner"

यह compiled binary को देखकर बता देता है कि अंदर क्या code है, क्या logic है, और कैसे काम करता है।