Skip to content

Commit 761e735

Browse files
Store wc.db file in loot. Add BASE_PATH option.
1 parent 8a149b3 commit 761e735

File tree

1 file changed

+34
-29
lines changed

1 file changed

+34
-29
lines changed

modules/auxiliary/scanner/http/svn_wcdb_scanner.rb

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,49 +32,54 @@ def initialize
3232
],
3333
'License' => MSF_LICENSE
3434
)
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)
4440
end
4541

4642
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)
6145
end
6246

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}")
6650
begin
6751
res = send_request_cgi(
6852
{
6953
'method' => 'GET',
7054
'uri' => path,
7155
'ctype' => 'text/plain'
72-
})
56+
}
57+
)
7358

7459
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+
)
7681
else
77-
return false
82+
vprint_error("SVN wc.db database not found on #{vhost}:#{rport}")
7883
end
7984
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
8085
rescue ::Timeout::Error, ::Errno::EPIPE

0 commit comments

Comments
 (0)