Skip to content

Commit cb7ff31

Browse files
authored
Merge pull request rapid7#20173 from adfoster-r7/update-web-crawlers-to-support-http-logging
Update web crawlers to support HTTP logging
2 parents f181cbb + 0b0132c commit cb7ff31

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

lib/anemone/rex_http.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,9 @@ def connection(url)
191191
url.scheme == "https",
192192
@opts[:ssl_version],
193193
@opts[:proxies],
194-
@opts[:username],
195-
@opts[:password]
194+
@opts[:username],
195+
@opts[:password],
196+
subscriber: @opts[:http_subscriber]
196197
)
197198

198199
conn.set_config(

lib/msf/core/auxiliary/http_crawler.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ def crawler_options(t)
283283
opts[:module] = self
284284
opts[:timeout] = get_connection_timeout
285285
opts[:dirbust] = dirbust?
286+
opts[:http_subscriber] = Rex::Proto::Http::HttpLoggerSubscriber.new(logger: self)
286287

287288
if (t[:headers] and t[:headers].length > 0)
288289
opts[:inject_headers] = t[:headers]

lib/msf/core/auxiliary/web/http.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ def connect
113113
'Auto',
114114
nil,
115115
username,
116-
password
116+
password,
117+
subscriber: opts[:http_subscriber]
117118
)
118119

119120
c.set_config({

lib/rex/proto/http/client.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ class Client
1919

2020
#
2121
# Creates a new client instance
22-
# @param http_trace_proc_request [Proc] A proc object passed to log HTTP requests if HTTP-Trace is set
23-
# @param http_trace_proc_response [Proc] A proc object passed to log HTTP responses if HTTP-Trace is set
2422
#
23+
# @param [Rex::Proto::Http::HttpSubscriber] subscriber A subscriber to Http requests/responses
2524
def initialize(host, port = 80, context = {}, ssl = nil, ssl_version = nil, proxies = nil, username = '', password = '', kerberos_authenticator: nil, comm: nil, subscriber: nil, sslkeylogfile: nil)
2625
self.hostname = host
2726
self.port = port.to_i

modules/auxiliary/scanner/http/crawler.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ def initialize
1818

1919
register_advanced_options([
2020
OptString.new('ExcludePathPatterns', [false, 'Newline-separated list of path patterns to ignore (\'*\' is a wildcard)']),
21+
OptBool.new('HttpTrace', [false, 'Show the raw HTTP requests and responses', false]),
22+
OptBool.new('HttpTraceHeadersOnly', [false, 'Show HTTP headers only in HttpTrace', false]),
23+
OptString.new('HttpTraceColors', [false, 'HTTP request and response colors for HttpTrace (unset to disable)', 'red/blu']),
2124
])
2225
@for_each_page_blocks = []
2326
end

0 commit comments

Comments
 (0)