Sqlmap中文使用手册 - Enumeration模块参数使用

目录

  • [1. Enumeration模块的帮助文档](#1. Enumeration模块的帮助文档)
  • [2. 各个参数的介绍](#2. 各个参数的介绍)
    • [2.1 -a, --all](#2.1 -a, --all)
    • [2.2 -b, --banner](#2.2 -b, --banner)
    • [2.3 --current-user](#2.3 --current-user)
    • [2.4 --current-db](#2.4 --current-db)
    • [2.5 --hostname](#2.5 --hostname)
    • [2.6 --is-dba](#2.6 --is-dba)
    • [2.7 --users](#2.7 --users)
    • [2.8 --passwords](#2.8 --passwords)
    • [2.9 --privileges](#2.9 --privileges)
    • [2.10 --roles](#2.10 --roles)
    • [2.11 --dbs](#2.11 --dbs)
    • [2.12 --tables](#2.12 --tables)
    • [2.13 --columns](#2.13 --columns)
    • [2.14 --schema](#2.14 --schema)
    • [2.15 --count](#2.15 --count)
    • [2.16 --dump](#2.16 --dump)
    • [2.17 --dump-all](#2.17 --dump-all)
    • [2.18 --search](#2.18 --search)

1. Enumeration模块的帮助文档

bash 复制代码
Enumeration:
    These options can be used to enumerate the back-end database
    management system information, structure and data contained in the
    tables

    -a, --all           Retrieve everything
    -b, --banner        Retrieve DBMS banner
    --current-user      Retrieve DBMS current user
    --current-db        Retrieve DBMS current database
    --hostname          Retrieve DBMS server hostname
    --is-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        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   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 statement to be executed
    --sql-shell         Prompt for an interactive SQL shell
    --sql-file=SQLFILE  Execute SQL statements from given file(s)

2. 各个参数的介绍

2.1 -a, --all

参数: -a, --all

作用:Retrieve everything。检索访问的所有内容。不推荐这样做,会产生大量的请求来检索无用的数据。

2.2 -b, --banner

参数: -b, --banner

作用:Retrieve DBMS banner。检索数据库管理系统的详细信息。

背景:大多数现代数据库管理系统都有一个函数或一个环境变量,它返回数据库管理系统版本,并最终返回其修补程序级别(即底层系统)的详细信息。通常该函数是version()和环境变量@@version,但是这取决于目标DBMS。

2.3 --current-user

参数:--current-user

作用:Retrieve DBMS current user。检索数据库管理系统的当前用户。

2.4 --current-db

参数:--current-db

作用:Retrieve DBMS current database。检索web应用程序链接到的数据库管理系统的数据库名称。

2.5 --hostname

参数:--hostname

作用:Retrieve DBMS server hostname。检索数据库管理系统的主机名。

2.6 --is-dba

参数:--is-dba

作用:Detect if the DBMS current user is DBA。可以检测当前数据库管理系统会话用户是否是数据库管理员(也称为DBA)。如果是,sqlmap则返回True ,反之亦然False。

2.7 --users

参数:--users

作用:Enumerate DBMS users。枚举用户列表,如果当前用户有读取包含有关DBMS用户信息的系统表的权限。

2.8 --passwords

参数:--passwords

作用:Enumerate DBMS users password hashes。枚举每个用户的密码哈希值,如果当前用户有读取包含有关DBMS用户信息的系统表的权限。

使用:sqlmap将首先枚举用户,然后针对每个用户使用不同的密码哈希。还可以使用开关-U来指定要破解哪个用户的密码hash,如果值为CU,则会自动破解当前用户的密码。

例如:
python sqlmap.py -u "http://192.168.136.131/sqlmap/pgsql/get_int.php?id=1" --passwords -U CU

2.9 --privileges

参数: --privileges

作用:Enumerate DBMS users privileges。枚举每个用户的权限,如果当前用户有读取包含有关DBMS用户信息的系统表的权限。

使用:通过权限,sqlmap还会显示哪些是数据库管理员。

还可以使用-U指定用户,如果值为CU,则默认为当前用户。

2.10 --roles

参数:--roles

作用:Enumerate DBMS users roles。枚举每个用户的角色,如果当前用户有读取包含有关DBMS用户信息的系统表的权限。此功能仅在DBMS为Oracle时可用。

使用:还可以使用-U指定用户。如果值为CU,则默认为当前用户。

2.11 --dbs

参数: --dbs

作用:Enumerate DBMS databases。枚举出所有的数据库,如果当前用户有读取包含有关DBMS用户信息的系统表的权限。

2.12 --tables

参数:--tables

作用:Enumerate DBMS database tables。枚举数据库的所有表,如果当前用户有读取包含有关DBMS用户信息的系统表的权限。

使用:

  1. 只使用--tables开关来列举数据库表,sqlmap将列出所有数据库的表。
  2. -D DBname:DBMS database to enumerate,指定数据库,将列出指定数据库的所有表。
  3. --exclude-sysdbs:Exclude DBMS system databases when enumerating tables,来排除系统数据库。

2.13 --columns

参数:--columns

作用:Enumerate DBMS database table columns。枚举数据库的表的字段名字,如果当前用户有读取包含有关DBMS用户信息的系统表的权限。

使用:

  1. -T指定表,-D指定数据库,-C指定列。
  2. 若只指定了数据表而没有指定数据库则默认使用当前数据库。
  3. 若没有指定列则列举表中全部列。

2.14 --schema

参数:--schema

作用:Enumerate DBMS schema。用户可以使用此开关获取数据库的架构,包含数据库、表和字段,以及各自的类型。

使用:使用--exclude-sysdbs,将不会获取数据库自带的系统库内容。

2.15 --count

参数: --count

作用:Retrieve number of entries for table(s)。如果用户想要知道表中的数据个数,而不是数据内容,可以使用这个开关。

2.16 --dump

参数: --dump

作用:Dump DBMS database table entries。如果当前管理员有权限读取数据库的其中一个表的话,那么就能获取整个表的所有内容。

使用:

  1. 使用-T-D参数指定数据库和数据库表,如果不指定数据库的话,则默认使用当前数据库。
  2. 使用--dump-D可以获取数据库所有表的内容(不使用-C-T)。

背景:

Sqlmap会自动将参数--dump列举的数据保存到CSV格式文件中,文件具体路径会在Sqlmap的输出中给出。

若只想列举部分数据可以使用参数--start--stop分别从某个条目开始输出存储,并在某个条目处停止。如只想列举第一条数据可以添加--stop 1

只想列举第二和第三条数据可以添加--start 1 --stop 3

你还可以使用--first--last限制输出的字符范围,例如如果你只想输出第三列到第五列的条目,那么你可以使用--first 3 --last 5。此功能只适用于盲注,因为对于报错注入和联合注入,列数量需要完全相同。

有时候(例如,对于Microsoft SQL Server,Sybase和SAP MaxDB),因为列数据类型不同,sqlmap不能直接利用OFFSET m,n对列进行输出。在这种情况下,sqlmap会输出最适合的pivot列,然后利用此列来检索其他的列,有时候当sqlmap选择的privot列不正确时,我们可以使用参数--pivot-column(例如--pivot-column=id)来指定pivot列。

除了使用上述参数来限制输出的列数(或者条目),还可以使用--where参数,后面接的合理语句将会被自动转换为where语句,例如--where id>3则 只会列举id>3的条目。

像你目前为止所了解到的那样,sqlmap非常的灵活。你可以自动输出全部的数据,也可以自定义需要输出的列数和条目。

2.17 --dump-all

参数:--dump-all

作用:Dump all DBMS databases tables entries。列举所有数据库所有表中所有数据

使用:可同时加上参数--exclude-sysdbs排除系统数据库。

参数:--search

作用:Search column(s), table(s) and/or database name(s)。用来搜索特定的数据库名称,在所有数据库中搜索特定表,在数据表中搜索特定的列。

使用:

需要和下面三个选项一起使用:

参数 作用
-C COL DBMS database table column(s) to enumerate。 后面跟着用逗号分割的列名,将会在所有数据库表中搜索指定的列名
-T TBL DBMS database table(s) to enumerate。 后面跟着用逗号分割的表名,将会在所有数据库中搜索指定的表名
-D DB DBMS database to enumerate。 后面跟着用逗号分割的数据库名,将会在所有数据库中搜索指定的库名
相关推荐
go_to_hacker5 分钟前
网络安全中GET和POST区别在哪?
安全·web安全
小狮子安度因24 分钟前
边缘智能-大模型架构初探
linux·网络
晨春计27 分钟前
【git】
android·linux·git
Flying_Fish_roe40 分钟前
linux-软件包管理-包管理工具(RedHat/CentOS 系)
linux·运维·centos
Splashtop高性能远程控制软件42 分钟前
centos远程桌面连接windows
linux·windows·centos·远程控制·远程桌面
tang&1 小时前
【Linux】进程概念
linux
苏少朋1 小时前
Docker安装 ▎Docker详细讲解 ▎数据卷挂载 ▎Nginx安装理解
linux·nginx·docker·容器
Jerry 二河小鱼1 小时前
在Linux中安装FFmpeg
linux·运维·服务器·ffmpeg
Roc-xb2 小时前
如何在 CentOS 上安装和使用 Neofetch(图文教程)
linux·运维·centos
程序员大阳2 小时前
Linux(6)--CentOS目录
linux·centos·目录