sqlmap
本文最后更新于:2023年5月6日 晚上
Usage: python3 sqlmap [options]
Options:
设置
-h, --help 基础帮助页面 Show basic help message and exit
-hh 高级帮助页面 Show advanced help message and exit
--version 显示版本 Show program's version number and exit
-v VERBOSE 输出详细等级 Verbosity level: 0-6 (default 1)
Target:
目标
-u URL, --url=URL 目标url地址 Target URL (e.g. "http://www.site.com/vuln.php?id=1")
-d DIRECT 指定数据库的连接字符串 Connection string for direct database connection
-l LOGFILE 解析burp或webscarab日志文件 Parse target(s) from Burp or WebScarab proxy log file
-m BULKFILE 指定文本加载目标 Scan multiple targets given in a textual file
-r REQUESTFILE 指定文件加载http请求 Load HTTP request from a file
-g GOOGLEDORK 指定google搜索加载目标 Process Google dork results as target URLs
-c CONFIGFILE 加载配置文件 Load options from a configuration INI file
Request:
请求
-A AGENT, --user.. 指定User-Agent HTTP User-Agent header value
-H HEADER, --hea.. 附加HTTP header Extra header (e.g. "X-Forwarded-For: 127.0.0.1")
--method=METHOD 指定请求方法 Force usage of given HTTP method (e.g. PUT)
--data=DATA 指定POST请求内容 Data string to be sent through POST (e.g. "id=1")
--param-del=PARA.. 拆分参数值字符 Character used for splitting parameter values (e.g. &)
--cookie=COOKIE 指定cookie HTTP Cookie header value (e.g. "PHPSESSID=a8d127e..")
--cookie-del=COO.. 拆分cookie字符 Character used for splitting cookie values (e.g. ;)
--live-cookies=L.. 加载实时cookie Live cookies file used for loading up-to-date values
--load-cookies=L.. 从文件加载cookie File containing cookies in Netscape/wget format
--drop-set-cookie 忽略Set=Cookie Ignore Set-Cookie header from response
--mobile 伪造为移动手机 Imitate smartphone through HTTP User-Agent header
--random-agent 随机User-Agent Use randomly selected HTTP User-Agent header value
--host=HOST 指定Host HTTP Host header value
--referer=REFERER 指定Referer HTTP Referer header value
--headers=HEADERS 附加header Extra headers (e.g. "Accept-Language: fr\nETag: 123")
--auth-type=AUTH.. 指定HTTP 身份验证类型 HTTP authentication type (Basic, Digest, Bearer, ...)
--auth-cred=AUTH.. 指定HTTP 身份验证凭据 HTTP authentication credentials (name:password)
--auth-file=AUTH.. 从文件加载PEM 证书/私钥 HTTP authentication PEM cert/private key file
--abort-code=401.. 响应代码中止 Abort on (problematic) HTTP error code(s) (e.g. 401)
--ignore-code=40.. 忽略响应代码 Ignore (problematic) HTTP error code(s) (e.g. 401)
--ignore-proxy 忽略系统代理 Ignore system default proxy settings
--ignore-redirects 忽略重定向 Ignore redirection attempts
--ignore-timeouts 忽略超时 Ignore connection timeouts
--proxy=PROXY 使用代理 Use a proxy to connect to the target URL
--proxy-cred=PRO.. 指定代理身份验证 Proxy authentication credentials (name:password)
--proxy-file=PRO.. 从文件加载代理列表 Load proxy list from a file
--proxy-freq=PRO.. 从列表更改代理请求 Requests between change of proxy from a given list
--tor 使用 Tor 匿名网络 Use Tor anonymity network
--tor-port=TORPORT 指定 Tor 端口 Set Tor proxy port other than default
--tor-type=TORTYPE 指定 Tor 代理类型 Set Tor proxy type (HTTP, SOCKS4 or SOCKS5 (default))
--check-tor 检查 Tor 可用性 Check to see if Tor is used properly
--delay=DELAY 指定请求延时 Delay in seconds between each HTTP request
--timeout=TIMEOUT 指定超时时间(默认值 30) Seconds to wait before timeout connection (default 30)
--retries=RETRIES 连接超时时重试(默认值 3) Retries when the connection timeouts (default 3)
--retry-on= 指定收到响应时,重送载荷 Retry request on regexp matching content (e.g. "drop")
--randomize=RPARAM 参数值随机 Randomly change value for given parameter(s)
--safe-url=SAFEURL 访问安全连接 URL address to visit frequently during testing
--safe-post=SAFE.. POST 访问安全链接 POST data to send to a safe URL
--safe-req=SAFER.. 从文件加载安全链接 Load safe HTTP request from a file
--safe-freq=SAFE.. 访问安全链接次数 Regular requests between visits to a safe URL
--skip-urlencode 跳过url编码 Skip URL encoding of payload data
--csrf-token=CSR.. 指定token Parameter used to hold anti-CSRF token
--csrf-url=CSRFURL 从url获取token URL address to visit for extraction of anti-CSRF token
--csrf-method=CS.. 指定方法 HTTP method to use during anti-CSRF token page visit
--csrf-data=CSRF.. 指定POST数据 POST data to send during anti-CSRF token page visit
--csrf-retries=C.. 指定获取token次数 Retries for anti-CSRF token retrieval (default 0)
--force-ssl 强制使用SSL Force usage of SSL/HTTPS
--chunked 使用分块传输 Use HTTP chunked transfer encoded (POST) requests
--hpp 使用HTTP参数污染 Use HTTP parameter pollution method
--eval=EVALCODE 指定Python表达式 Evaluate provided Python code before the request (e.g.
"import hashlib;id2=hashlib.md5(id).hexdigest()")
Optimization:
性能
-o 打开所有优化 Turn on all optimization switches
--predict-output 预测常见的查询的输出 Predict common queries output
--keep-alive 保活 Use persistent HTTP(s) connections
--null-connection 获取响应大小,不获取内容 Retrieve page length without actual HTTP response body
--threads=THREADS 线程 Max number of concurrent HTTP(s) requests (default 1)
Injection:
注入
-p TESTPARAMETER 指定参数 Testable parameter(s)
--skip=SKIP 跳过指定参数 Skip testing for given parameter(s)
--skip-static 跳过静态参数 Skip testing parameters that not appear to be dynamic
--param-exclude=.. 正则跳过参数 Regexp to exclude parameters from testing (e.g. "ses")
--param-filter=P.. 过滤器 Select testable parameter(s) by place (e.g. "POST")
--dbms=DBMS 指定数据库类型 Force back-end DBMS to provided value
--dbms-cred=DBMS.. 指定数据库身份验证 DBMS authentication credentials (user:password)
--os=OS 指定OS Force back-end DBMS operating system to provided value
--invalid-bignum 使用大数 Use big numbers for invalidating values
--invalid-logical 使用逻辑运算 Use logical operations for invalidating values
--invalid-string 使用随机字符串 Use random strings for invalidating values
--no-cast 不使用类型转换函数 Turn off payload casting mechanism
--no-escape 不使用转义 Turn off string escaping mechanism
--prefix=PREFIX 添加前缀 Injection payload prefix string
--suffix=SUFFIX 添加后缀 Injection payload suffix string
--tamper=TAMPER 指定使用脚本 Use given script(s) for tampering injection data
Detection:
自定义检测
--level=LEVEL 测试级别 Level of tests to perform (1-5, default 1)
--risk=RISK 风险值 Risk of tests to perform (1-3, default 1)
--string=STRING 匹配有效字符串 String to match when query is evaluated to True
--not-string=NOT.. 匹配无效字符串 String to match when query is evaluated to False
--regexp=REGEXP 有效正则匹配 Regexp to match when query is evaluated to True
--code=CODE 响应码匹配 HTTP code to match when query is evaluated to True
--smart 只选择基于错误的检测结果 Perform thorough tests only if positive heuristic(s)
--text-only 基于文本内容比较网页 Compare pages based only on the textual content
--titles 基于标题比较网页 Compare pages based only on their titles
Techniques:
特殊注入
--technique=TECH.. 指定注入类型 SQL injection techniques to use (default "BEUSTQ")
--time-sec=TIMESEC 响应延迟 Seconds to delay the DBMS response (default 5)
--union-cols=UCOLS 联合查询列范围 Range of columns to test for UNION query SQL injection
--union-char=UCHAR 暴力破解列数 Character to use for bruteforcing number of columns
--union-from=UFROM 联合查询表明 Table to use in FROM part of UNION query SQL injection
--dns-domain=DNS.. 指定dns Domain name used for DNS exfiltration attack
--second-url=SEC.. 二次注入地址 Resulting page URL searched for second-order response
--second-req=SEC.. 从文件加载二次注入地址 Load second-order HTTP request from file
Fingerprint:
指纹识别
-f, --fingerprint 数据库指纹识别 Perform an extensive DBMS version fingerprint
Enumeration:
列举
-a, --all 查询所有数据 Retrieve everything
-b, --banner 查询数据库banner Retrieve DBMS banner
--current-user 查询当前数据库用户 Retrieve DBMS current user
--current-db 查询当前数据库 Retrieve DBMS current database
--hostname 查询主机名 Retrieve DBMS server hostname
--is-dba 查询是否为DBA Detect if the DBMS current user is DBA
--users 枚举用户名 Enumerate DBMS users
--passwords 枚举用户密码 Enumerate DBMS users password hashes
--privileges 枚举用户权限 Enumerate DBMS users privileges
--roles 枚举用户角色 Enumerate DBMS users roles
--dbs 枚举数据库 Enumerate DBMS databases
--tables 枚举表 Enumerate DBMS database tables
--columns 枚举列 Enumerate DBMS database table columns
--schema 枚举数据库架构 Enumerate DBMS schema
--count 查询表数量 Retrieve number of entries for table(s)
--dump 转储表目录 Dump DBMS database table entries
--dump-all 转储所有表 Dump all DBMS databases tables entries
--search 搜索 Search column(s), table(s) and/or database name(s)
--comments 检索注释 Check for DBMS comments during enumeration
--statements 检索目标数据库中的SQL语句 Retrieve SQL statements being run on DBMS
-D DB 指定数据库 DBMS database to enumerate
-T TBL 指定表 DBMS database table(s) to enumerate
-C COL 指定列 DBMS database table column(s) to enumerate
-X EXCLUDE 不枚举标识符 DBMS database identifier(s) to not enumerate
-U USER 指定用户 DBMS user to enumerate
--exclude-sysdbs 排除数据库名 Exclude DBMS system databases when enumerating tables
--pivot-column=P.. 指定一个中轴列 Pivot column name
--where=DUMPWHERE 转储时使用where Use WHERE condition while table dumping
--start=LIMITSTART 转储开始表名 First dump table entry to retrieve
--stop=LIMITSTOP 转储结束表名 Last dump table entry to retrieve
--first=FIRSTCHAR 转储时检索的第一个条目的位置 First query output word character to retrieve
--last=LASTCHAR 转储时检索的最后一个条目的位 Last query output word character to retrieve
--sql-query=SQLQ.. 自定义sql语句 SQL statement to be executed
--sql-shell 加载sql shell Prompt for an interactive SQL shell
--sql-file=SQLFILE 从文件加载sql语句 Execute SQL statements from given file(s)
Brute force:
暴力破解
--common-tables 暴力破解表名 Check existence of common tables
--common-columns 暴力破解列名 Check existence of common columns
--common-files 暴力破文件名 Check existence of common files
User-defined function injection:
用户自定义函数
--udf-inject 注入udf Inject custom user-defined functions
--shared-lib=SHLIB 指定共享库的本地路径 Local path of the shared library
File system access:
文件访问
--file-read=FILE.. 读取文件 Read a file from the back-end DBMS file system
--file-write=FIL.. 写入文件 Write a local file on the back-end DBMS file system
--file-dest=FILE.. 绝对路径写入文件 Back-end DBMS absolute filepath to write to
Operating system access:
操作系统访问
--os-cmd=OSCMD 执行系统命令 Execute an operating system command
--os-shell 加载系统shell Prompt for an interactive operating system shell
--os-pwn 执行shell code Prompt for an OOB shell, Meterpreter or VNC
--os-smbrelay SMB 中继提权 One click prompt for an OOB shell, Meterpreter or VNC
--os-bof 存储过程缓冲区溢出利用 Stored procedure buffer overflow exploitation
--priv-esc 数据库进程用户权限提升 Database process user privilege escalation
--msf-path=MSFPATH 指定msf的地址 Local path where Metasploit Framework is installed
--tmp-path=TMPPATH 指定临时文件目录 Remote absolute path of temporary files directory
Windows registry access:
Windows 注册表
--reg-read 读取注册表值 Read a Windows registry key value
--reg-add 写入注册表值 Write a Windows registry key value data
--reg-del 删除注册表值 Delete a Windows registry key value
--reg-key=REGKEY 修改注册表key Windows registry key
--reg-value=REGVAL 修改注册表value Windows registry key value
--reg-data=REGDATA 修改注册表data Windows registry key value data
--reg-type=REGTYPE 修改注册表数据类型 Windows registry key value type
General:
通用
-s SESSIONFILE 从.sqlite加载session Load session from a stored (.sqlite) file
-t TRAFFICFILE 将流量记录到文件 Log all HTTP traffic into a textual file
--abort-on-empty 无注入中止 Abort data retrieval on empty results
--answers=ANSWERS 设置预设答案 Set predefined answers (e.g. "quit=N,follow=N")
--base64=BASE64P.. 参数编码 Parameter(s) containing Base64 encoded data
--base64-safe url安全编码 Use URL and filename safe Base64 alphabet (RFC 4648)
--batch 全局默认 Never ask for user input, use the default behavior
--binary-fields=.. 二进制检索 Result fields having binary values (e.g. "digest")
--check-internet 检查网络 Check Internet connection before assessing the target
--cleanup 清除UDF与临时表 Clean up the DBMS from sqlmap specific UDF and tables
--crawl=CRAWLDEPTH 爬取url Crawl the website starting from the target URL
--crawl-exclude=.. 爬取排除 Regexp to exclude pages from crawling (e.g. "logout")
--csv-del=CSVDEL CSV输出分隔符 Delimiting character used in CSV output (default ",")
--charset=CHARSET 盲注字符集 Blind SQL injection charset (e.g. "0123456789abcdef")
--dump-file=DUMP.. 转储到文件 Store dumped data to a custom file
--dump-format=DU.. 转储格式 Format of dumped data (CSV (default), HTML or SQLITE)
--encoding=ENCOD.. 解码 Character encoding used for data retrieval (e.g. GBK)
--eta 输出预计时间 Display for each output the estimated time of arrival
--flush-session 刷新session Flush session files for current target
--forms 解析表单 Parse and test forms on target URL
--fresh-queries 忽略缓存中的查询结果 Ignore query results stored in session file
--gpage=GOOGLEPAGE 指定google搜索页码 Use Google dork results from specified page number
--har=HARFILE 将流量记录到HAR文件 Log all HTTP traffic into a HAR file
--hex 检索十六进制转换 Use hex conversion during data retrieval
--output-dir=OUT.. 自定义输出目录 Custom output directory path
--parse-errors 解析显示errors Parse and display DBMS error messages from responses
--preprocess=PRE.. 使用脚本预处理请求 Use given script(s) for preprocessing (request)
--postprocess=PO.. 使用脚本预处理响应 Use given script(s) for postprocessing (response)
--repair 重新dump 未知字符标记的条目 Redump entries having unknown character marker (?)
--save=SAVECONFIG 保存设置到INI文件 Save options to a configuration INI file
--scope=SCOPE 使用正则过滤目标 Regexp for filtering targets
--skip-heuristics 跳过启发式漏洞检测 Skip heuristic detection of vulnerabilities
--skip-waf 跳过 WAF/IPS 防护的启发式检测 Skip heuristic detection of WAF/IPS protection
--table-prefix=T.. 设置临时表前缀 Prefix used for temporary tables (default: "sqlmap")
--test-filter=TE.. payloads 选择 Select tests by payloads and/or titles (e.g. ROW)
--test-skip=TEST.. payloads 跳过 Skip tests by payloads and/or titles (e.g. BENCHMARK)
--web-root=WEBROOT 指定web根目录 Web server document root directory (e.g. "/var/www")
Miscellaneous:
杂项
-z MNEMONICS 短选项字符串 Use short mnemonics (e.g. "flu,bat,ban,tec=EU")
--alert=ALERT 有注入时执行系统命令 Run host OS command(s) when SQL injection is found
--beep 发现漏洞时发出蜂鸣声 Beep on question and/or when vulnerability is found
--dependencies 检查缺少的依赖项 Check for missing (optional) sqlmap dependencies
--disable-coloring 禁用彩色 Disable console output coloring
--list-tampers 显示脚本列表 Display list of available tamper scripts
--no-logging 禁用文件记录日志 Disable logging to a file
--offline 离线模式 Work in offline mode (only use session data)
--purge 删除数据目录内容 Safely remove all content from sqlmap data directory
--results-file=R.. 指定结果文件 Location of CSV results file in multiple targets mode
--shell 获取数据库服务器的shell Prompt for an interactive sqlmap shell
--tmp-dir=TMPDIR 临时文件目录 Local directory for storing temporary files
--unstable 不稳定的网络环境选项 Adjust options for unstable connections
--update 更新 Update sqlmap
--wizard 导向 Simple wizard interface for beginner users
sqlmap
https://shenysec.github.io/2023/05/06/sqlmap/