SQLMap Fundamentals and Command-Line Basics
You'll learn: How to install and use SQLMap's core commands to automate SQL injection testing against web applications.
What is SQLMap?
SQLMap is an open-source penetration testing tool that automates the process of detecting and exploiting SQL injection vulnerabilities. Think of it as a "smart assistant" that performs hundreds of SQL injection tests for you—checking different injection techniques, database types, and payloads—while you focus on analyzing results rather than manually crafting payloads.
Installation
SQLMap comes pre-installed on Kali Linux and similar security distributions. Otherwise, install via:
git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git
cd sqlmap
python sqlmap.py --help
Basic Command Syntax
The fundamental syntax follows this pattern:
sqlmap -u "TARGET_URL" [OPTIONS]
Core Target Specification
Specify your target with -u for a single URL:
sqlmap -u "http://example.com/page?id=1"
For POST requests, use --data:
sqlmap -u "http://example.com/login" --data="username=admin&password=test"
Essential Options
--dbs— enumerate available databases--tables— list tables in a database--columns— show columns in a table--dump— extract data from tables--batch— run without user interaction (accept defaults)--level(1-5) — test depth and payload complexity--risk(1-3) — risk level of tests (higher = more dangerous queries)
Example combining options:
sqlmap -u "http://target.com/item?id=5" --dbs --batch
Key Takeaway: SQLMap automates SQL injection testing through simple command-line syntax—specify your target with -u, choose enumeration options like --dbs or --dump, and let SQLMap handle detection, fingerprinting, and exploitation automatically.