Skip to content

Commit 2668a4a

Browse files
committed
Fix rapid7#6993, tnspoison_checker cleanup
1 parent 43fd0a8 commit 2668a4a

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

modules/auxiliary/scanner/oracle/tnspoison_checker.rb

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,21 @@ def run_host(ip)
4242
send_packet = tns_packet("(CONNECT_DATA=(COMMAND=service_register_NSGR))")
4343
sock.put(send_packet)
4444
packet = sock.read(100)
45-
if packet != nil
46-
hex_packet = Rex::Text.to_hex(packet, prefix = ':')
47-
split_hex = hex_packet.split(":")
48-
find_packet = /\(ERROR_STACK=\(ERROR=/ === packet
49-
#find_packet == true ? print_error("#{ip}:#{rport} is not vulnerable ") : print_good("#{ip}:#{rport} is vulnerable")
50-
if find_packet == true #TNS Packet returned ERROR
51-
print_error("#{ip}:#{rport} is not vulnerable")
52-
elsif split_hex[5] == "02" #TNS Packet Type: ACCEPT
53-
print_good("#{ip}:#{rport} is vulnerable")
54-
elsif split_hex[5] == "04" #TNS Packet Type: REFUSE
55-
print_error("#{ip}:#{rport} is not vulnerable")
56-
else #All other TNS packet types or non-TNS packet type response cannot guarantee vulnerability
57-
print_error("#{ip}:#{rport} might not be vulnerable")
58-
end
59-
else
45+
if packet
46+
hex_packet = Rex::Text.to_hex(packet, ':')
47+
split_hex = hex_packet.split(':')
48+
find_packet = /\(ERROR_STACK=\(ERROR=/ === packet
49+
if find_packet == true #TNS Packet returned ERROR
50+
print_error("#{ip}:#{rport} is not vulnerable")
51+
elsif split_hex[5] == '02' #TNS Packet Type: ACCEPT
52+
print_good("#{ip}:#{rport} is vulnerable")
53+
elsif split_hex[5] == '04' #TNS Packet Type: REFUSE
6054
print_error("#{ip}:#{rport} is not vulnerable")
55+
else #All other TNS packet types or non-TNS packet type response cannot guarantee vulnerability
56+
print_error("#{ip}:#{rport} might not be vulnerable")
57+
end
58+
else
59+
print_error("#{ip}:#{rport} is not vulnerable")
6160
end
6261
# TODO: Module should report_vuln if this finding is solid.
6362
rescue ::Rex::ConnectionError, ::Errno::EPIPE

0 commit comments

Comments
 (0)