Course contentsShow
← Security
Lesson 588 of 3,05213. Web Security - Injection AttacksFree lesson

SQLMap Data Extraction and Enumeration

Extract databases, tables, columns, and data using SQLMap's enumeration flags and output formatting options.

SQLMap Data Extraction and Enumeration

You'll learn how to systematically extract database contents using SQLMap's built-in enumeration flags.

Once SQLMap identifies a SQL injection vulnerability and fingerprints the database, you can use its powerful enumeration features to extract specific data without manually crafting SQL queries. Think of SQLMap as an automated excavator that can dig through database layers—first finding the site (databases), then the buildings (tables), then the rooms (columns), and finally the contents (actual data).

Core Enumeration Flags

SQLMap provides hierarchical flags for extraction:

  • --dbs — Lists all databases on the server
  • --tables — Lists tables (use with -D database_name to specify which database)
  • --columns — Lists columns (use with -D database -T table_name)
  • --dump — Extracts actual data (use with -D, -T, and optionally -C column_name)

Extraction Workflow

Start broad and narrow down:

sqlmap -u "http://example.com/page?id=1" --dbs
sqlmap -u "http://example.com/page?id=1" -D webapp --tables
sqlmap -u "http://example.com/page?id=1" -D webapp -T users --columns
sqlmap -u "http://example.com/page?id=1" -D webapp -T users --dump

Output Options

SQLMap formats results automatically but you can control output:

  • Results display in terminal with formatted tables
  • Automatically saves to ~/.sqlmap/output/ directory
  • Use --batch to avoid interactive prompts
  • Password hashes are automatically detected and can be cracked with --passwords

Key Takeaway: SQLMap's enumeration flags (--dbs, --tables, --columns, --dump) let you systematically extract database structures and data in a hierarchical manner, automating what would otherwise require complex manual SQL queries.