Skip to content

Commit 2bc8767

Browse files
committed
Updated rescue to catch other errors from the socket API
1 parent 604cad9 commit 2bc8767

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/auxiliary/gather/xerox_pwd_extract.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def write
111111
begin
112112
connect(true, 'RPORT' => datastore['JPORT'].to_i)
113113
sock.put(create_print_job)
114-
rescue ::Timeout::Error
114+
rescue ::Timeout::Error, Rex::ConnectionError, Rex::ConnectionRefused, HostUnreachable, Rex::ConnectionTimeout, Rex::AddressInUse
115115
print_error("Error connecting to #{rhost}")
116116
return
117117
ensure
@@ -129,7 +129,7 @@ def retrieve
129129
res = sock.get_once
130130
passwd = res.match(/\r\n\s(.+?)\n/)
131131
return passwd ? passwd[1] : ''
132-
rescue
132+
rescue ::Timeout::Error, Rex::ConnectionError, Rex::ConnectionRefused, HostUnreachable, Rex::ConnectionTimeout, Rex::AddressInUse
133133
print_error("Error getting password from #{rhost}")
134134
return
135135
ensure

0 commit comments

Comments
 (0)