@@ -32,49 +32,54 @@ def initialize
32
32
] ,
33
33
'License' => MSF_LICENSE
34
34
)
35
-
36
- end
37
-
38
- def target_url ( path )
39
- if ssl
40
- return "https://#{ vhost } :#{ rport } #{ path } "
41
- else
42
- return "http://#{ vhost } :#{ rport } #{ path } "
43
- end
35
+
36
+ register_advanced_options (
37
+ [
38
+ OptString . new ( 'BASE_PATH' , [ false , 'Path to the directory with the .svn folder.' , nil ] )
39
+ ] , self . class )
44
40
end
45
41
46
42
def run_host ( ip )
47
- path = '/.svn/wc.db'
48
- if wcdb_exists ( target_url , path )
49
- print_good ( "SVN database found on #{ target_url } " )
50
- report_note (
51
- :host => rhost ,
52
- :port => rport ,
53
- :proto => 'tcp' ,
54
- :sname => ( ssl ? 'https' : 'http' ) ,
55
- :type => 'users' ,
56
- :data => 'SVN wc.db database is available'
57
- )
58
- else
59
- vprint_error ( "SVN database not found" )
60
- end
43
+ path = datastore [ 'BASE_PATH' ] + '/.svn/wc.db'
44
+ get_wcdb ( path )
61
45
end
62
46
63
- def wcdb_exists ( url , path )
64
-
65
- vprint_status ( "Trying #{ url } #{ path } " )
47
+ def get_wcdb ( path )
48
+ proto = ( ssl ? 'https://' : 'http://' )
49
+ vprint_status ( "Trying #{ proto } #{ vhost } : #{ rport } #{ path } " )
66
50
begin
67
51
res = send_request_cgi (
68
52
{
69
53
'method' => 'GET' ,
70
54
'uri' => path ,
71
55
'ctype' => 'text/plain'
72
- } )
56
+ }
57
+ )
73
58
74
59
if res and res . code == 200
75
- return true
60
+ print_good ( "SVN wc.db database found on #{ vhost } :#{ rport } " )
61
+
62
+ file = store_loot (
63
+ "svn.wcdb.database" ,
64
+ "application/octet-stream" ,
65
+ vhost ,
66
+ res . body ,
67
+ "wc.db" ,
68
+ "SVN wc.db database"
69
+ )
70
+
71
+ print_good ( "SVN wc.db database stored in #{ file } " )
72
+
73
+ report_note (
74
+ :host => rhost ,
75
+ :port => rport ,
76
+ :proto => 'tcp' ,
77
+ :sname => ( ssl ? 'https' : 'http' ) ,
78
+ :type => 'svn_wc_database' ,
79
+ :data => "SVN wc.db database is stored in #{ file } "
80
+ )
76
81
else
77
- return false
82
+ vprint_error ( "SVN wc.db database not found on #{ vhost } : #{ rport } " )
78
83
end
79
84
rescue ::Rex ::ConnectionRefused , ::Rex ::HostUnreachable , ::Rex ::ConnectionTimeout
80
85
rescue ::Timeout ::Error , ::Errno ::EPIPE
0 commit comments