@@ -42,22 +42,21 @@ def run_host(ip)
42
42
send_packet = tns_packet ( "(CONNECT_DATA=(COMMAND=service_register_NSGR))" )
43
43
sock . put ( send_packet )
44
44
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
60
54
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" )
61
60
end
62
61
# TODO: Module should report_vuln if this finding is solid.
63
62
rescue ::Rex ::ConnectionError , ::Errno ::EPIPE
0 commit comments