Radare2

Reverse Engineering Framework

🛠️ Radare2 क्या है?

Radare2 (r2) एक powerful open-source command-line reverse engineering framework है। इसका काम binaries को analyze करना, disassemble करना, debug करना, और patch करना है। यह Ghidra का CLI alternative माना जाता है।

👉 Termux पर perfect है - यह purely command-line based है इसलिए mobile पर easily use हो जाता है।

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

Disassemble

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

Analyze Binary

Functions, strings, imports detect करना

Debug

Program को step-by-step run करना

Patch Binary

Assembly में instructions modify करना

String Search

Embedded strings find करना

Multi-Architecture Support

x86, x64, ARM, MIPS, PowerPC, Java, Shellcode, और कई अन्य formats

⚙️ Radare2 Install करना

aptInstallation Commands

Update System

apt update

Install Radare2

apt install radare2

Check Installation

r2 -v

👉 Radare2 तीन main tools में आता है: r2 (main shell), ragg2 (shellcode generator), rahash2 (hash tool)

💻 Basic Commands (Use)

👉 Radare2 shell में ये commands use होते हैं:

Open binary in r2 shell

r2 /path/to/binary

Auto analyze (aaa = analyze all)

aaa

List all functions (afl = analyze functions list)

afl

Disassemble function (pdf = print disassembly function)

pdf @ main

Search for strings (izz = search in all strings)

izz

Print info (ii = info imports, iE = info exports)

ii

Quit r2

q

🌐 Real Example (Practical समझ)

Example🎯 CrackMe को Reverse Engineer करना

मान लो तुम्हें एक crackme दिया है और तुम्हें password find करना है:

Step 1: Radare2 से open करो

r2 crackme

Step 2: Auto analysis run करो

[0x00000000]> aaa
; analyze all

Step 3: Functions list देखो

[0x00000000]> afl
0x00001000  1  44  main
0x00001050  1  32  check_password

Step 4: Main function disassemble करो

[0x00000000]> pdf @ main
; int main(int argc, char **argv) {
;    char buf[100];
;    printf("Enter password: ");
;    scanf("%s", buf);
;    if (check_password(buf) == 0) {
;        printf("Correct!
");
;    } else {
;        printf("Wrong!
");
;    }
; }

Step 5: Password check function देखो

[0x00000000]> pdf @ check_password
; int check_password(char *input) {
;    return strcmp(input, "HACK123") != 0;
; }

Step 6: Strings search करो

[0x00000000]> izz
355  0x00002056  0x00002056  0x00002056  ascii  HACK123
356  0x0000205e  0x0000205e  0x0000205e  ascii  Enter password:
🧠 Output समझो

इसका मतलब:

Password

"HACK123"

String search में hidden password मिल गया

check_password()

Password Verification Function

strcmp() से "HACK123" से compare कर रहा है

strcmp() != 0

Return 0 if password matches

0 return होगा तो password सही है

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

  • • Exact password "HACK123" निकाल लिया
  • • Program flow समझ लिया
  • • Radare2 में सब कुछ सीख लिया

🔥 Advanced Features

Visual Mode (VV)

Interactive GUI-like view जिससे code graphically देख सकते हो

Pattern Search

Hex patterns, strings, औरROP chains find करना

r2pipe API

Python/JavaScript से radare2 को programmatically control करना

Debugger Mode

r2db के साथ debugging और breakpoints set करना

⚠️ Important Warning

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

Practice के लिए use करो:

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

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

🧩 Related Tools

Ghidra

GUI-based reverse engineering tool

GDB

GNU Debugger for debugging

objdump

Display object file information

strings

Extract printable strings from files

💡 Simple समझ

Radare2 = "Binary का Command-Line X-ray"

यह Terminal से binary को analyze करता है, disassemble करता है, और पूरी जानकारी निकाल देता है।