Skip to content

Commit 266d29c

Browse files
author
Brent Cook
committed
handle garbage better during probe
1 parent a6020ca commit 266d29c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

modules/auxiliary/admin/scada/phoenix_command.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,20 @@ def send_recv_once(data)
7171

7272
def get_info(rhost, rport)
7373
connect(true, 'RHOST' => rhost, 'RPORT' => rport)
74-
code = send_recv_once("\x01\x01\x00\x1a\x00^\x00\x00\x00\x00\x00\x03\x00\x0cIBETH01N0_M\x00")[34..35]
74+
data = send_recv_once("\x01\x01\x00\x1a\x00^\x00\x00\x00\x00\x00\x03\x00\x0cIBETH01N0_M\x00")
75+
if data.nil? || data.length < 36
76+
print_error("Could not obtain information on this device")
77+
disconnect
78+
return "UNKNOWN"
79+
end
80+
code = data[34..35]
7581
send_recv_once("\x01\x05\x00\x16\x00\x5f\x00\x00\x08\xef\x00" + hex_to_bin(code) + "\x00\x00\x00\x22\x00\x04\x02\x95\x00\x00")
7682
data = send_recv_once("\x01\x06\x00\x0e\x00\x61\x00\x00\x88\x11\x00" + hex_to_bin(code) + "\x04\x00")
7783
disconnect
84+
if data.nil? || data.length < 200
85+
print_error("Could not obtain information on this device")
86+
return "UNKNOWN"
87+
end
7888
plctype = hex_to_bin(data[60..99])
7989
print_status("PLC Type = " + plctype)
8090
print_status("Firmware = " + hex_to_bin(data[132..139]))

0 commit comments

Comments
 (0)