Command library / sqlmap
sqlmap
Detect and exploit SQL injection automatically
Tests a URL parameter for SQL injection and, if vulnerable, can automatically enumerate databases, tables and rows. -u is the only required flag; --batch stops it from ever pausing to ask an interactive question, which matters for scripted lab runs.
Practice sqlmapUsage
Options and flags
-u, --urlURLthe target URL, with the parameter to test — required
--dbsenumerate the names of available databases
--dumpdump the contents of the discovered table(s)
--batchnever prompt — accept sqlmap's default answer to every question
Examples
sqlmap -u "http://target/page.php?id=1"Test the id parameter for SQL injection.
sqlmap -u "http://target/page.php?id=1" --dbsIt's vulnerable — now list the database names.
sqlmap -u "http://target/page.php?id=1" --batch --dbsSame enumeration, but never stop to ask — good for an unattended lab run.
Common mistakes
The target is never a bare argument — sqlmap always needs it introduced with -u.