Skip to content

SSZcreate/Pentab_server / .agents/skills/cybersecurity/skills/exploiting-sql-injection-with-sqlmap

exploiting-sql-injection-with-sqlmap

Verified

Detecting and exploiting SQL injection vulnerabilities using sqlmap to extract database contents during authorized penetration tests.

FileKindSize
LICENSEother11.0 KB
SKILL.mdskill md9.0 KB
references/api-reference.mdmarkdown2.1 KB
scripts/agent.pyscript8.1 KB

references/api-reference.md

View on GitHub
# API Reference: sqlmap Automation Agent

## Dependencies

| Library | Version | Purpose |
|---------|---------|---------|
| sqlmap | >=1.7 | SQL injection detection and exploitation (subprocess) |

## CLI Usage

```bash
# Detection scan
python scripts/agent.py --url "https://target.com/page?id=1" --param id --action detect

# Enumerate databases
python scripts/agent.py --url "https://target.com/page?id=1" --action dbs

# List tables
python scripts/agent.py --url "https://target.com/page?id=1" --action tables --database target_db

# Dump table rows
python scripts/agent.py --url "https://target.com/page?id=1" --action dump \
  --database target_db --table users

# Check privileges
python scripts/agent.py --url "https://target.com/page?id=1" --action privs
```

## Functions

### `find_sqlmap() -> str`
Searches common paths for the sqlmap binary.

### `run_detection_scan(sqlmap_bin, url, param, request_file, cookie, tamper) -> dict`
Runs `sqlmap --batch --random-agent` and parses output for injectability, DB type, and techniques.

### `enumerate_databases(sqlmap_bin, url, param, cookie) -> list`
Runs `sqlmap --dbs` and extracts database names from output.

### `enumerate_tables(sqlmap_bin, url, database, param, cookie) -> list`
Runs `sqlmap -D db --tables` and parses table names.

### `dump_table(sqlmap_bin, url, database, table, columns, limit, param, cookie) -> dict`
Runs `sqlmap -D db -T tbl --dump --start=1 --stop=N`.

### `check_privileges(sqlmap_bin, url, param, cookie) -> dict`
Runs `--current-user --current-db --is-dba` to assess DB privileges.

## sqlmap Flags Used

| Flag | Purpose |
|------|---------|
| `--batch` | Non-interactive mode |
| `--random-agent` | Randomize User-Agent header |
| `-p` | Specify injectable parameter |
| `--tamper` | Apply WAF bypass tamper scripts |
| `--dbs` | Enumerate databases |
| `--tables` | Enumerate tables |
| `--dump` | Extract table data |
| `--is-dba` | Check DBA privileges |

## Output Schema

```json
{
  "action": "detect",
  "url": "https://target.com/page?id=1",
  "result": {
    "injectable": true,
    "database": "MySQL",
    "techniques": ["boolean-based", "UNION query"]
  }
}
```
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 465kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 465kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 465kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 192kUpdated Claude CodeCodexVerifiedInstall