Skip to content

Commit cf3df4b

Browse files
committed
Auxiliary::Web::HTTP: added error output
Instead of using elog when an HTTP request callback throws an exception, use the HTTP class' parent #print_error.
1 parent 1b8371e commit cf3df4b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def timed_out
6767
attr_reader :opts
6868
attr_reader :headers
6969
attr_reader :framework
70+
attr_reader :parent
7071

7172
attr_accessor :redirect_limit
7273
attr_accessor :username , :password
@@ -75,6 +76,7 @@ def initialize( opts = {} )
7576
@opts = opts.dup
7677

7778
@framework = opts[:framework]
79+
@parent = opts[:parent]
7880

7981
@headers = {
8082
'Accept' => '*/*',
@@ -130,8 +132,8 @@ def run
130132
begin
131133
request.handle_response request( request.url, request.opts )
132134
rescue => e
133-
elog e.to_s
134-
e.backtrace.each { |l| elog l }
135+
print_error e.to_s
136+
e.backtrace.each { |l| print_error l }
135137
end
136138
end
137139
end
@@ -250,6 +252,11 @@ def custom_404?( path, body, &callback )
250252

251253
private
252254

255+
def print_error( message )
256+
return if !@parent
257+
@parent.print_error message
258+
end
259+
253260
def call_after_run_blocks
254261
while block = @after_run_blocks.pop
255262
block.call

0 commit comments

Comments
 (0)