@@ -138,7 +138,6 @@ def get_state1(data)
138
138
end
139
139
state
140
140
end
141
-
142
141
def get_state2 ( data )
143
142
if data [ 16 ..17 ] == '04'
144
143
state = 'STOP'
@@ -150,7 +149,6 @@ def get_state2(data)
150
149
end
151
150
state
152
151
end
153
-
154
152
def get_cpu ( rhost , rport , devicetype )
155
153
connect ( true , 'RHOST' => rhost , 'RPORT' => rport )
156
154
state = 'unknown'
@@ -160,8 +158,7 @@ def get_cpu(rhost, rport, devicetype)
160
158
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 " )
161
159
## Query packet
162
160
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 " )
163
- state = get_state1 ( data )
164
- elsif devicetype == '39x'
161
+ state = get_state1 ( data ) elsif devicetype == '39x'
165
162
init_phase2
166
163
data = send_recv_once ( "\xcc \x01 \x00 \x0f @\x07 \x00 \x00 \xea \xfa " )
167
164
state = get_state2 ( data )
@@ -171,8 +168,7 @@ def get_cpu(rhost, rport, devicetype)
171
168
state
172
169
end
173
170
174
- def set_cpu ( rhost , rport , action , state , devicetype )
175
- connect ( true , 'RHOST' => rhost , 'RPORT' => rport )
171
+ def set_cpu ( rhost , rport , action , state , devicetype ) connect ( true , 'RHOST' => rhost , 'RPORT' => rport )
176
172
if devicetype == '15x'
177
173
init_phase1 ## Several packets (21)
178
174
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 @@ def set_cpu(rhost, rport, action, state, devicetype)
182
178
else
183
179
print_status ( '--> Sending STOP now' )
184
180
send_recv_once ( "\x01 \x00 \x02 \x00 \x00 \x00 \x00 \x00 \x01 \x00 \x07 \x00 \x00 \x00 \x00 \x00 " )
185
- end
186
- elsif devicetype == '39x'
181
+ end elsif devicetype == '39x'
187
182
init_phase2 ## Several packets (6)
188
183
if action == 'START' || ( action == 'REV' && state == 'STOP' )
189
184
print_status ( '--> Sending COLD start now' )
@@ -211,11 +206,11 @@ def run
211
206
if device . start_with? ( 'ILC 15' , 'ILC 17' )
212
207
devicetype = '15x'
213
208
print_status ( '--> Detected 15x/17x series, getting current CPU state:' )
214
- ractionport == nil ? ( rport = 41100 ) : ( rport = ractionport )
209
+ ractionport . nil? ( rport = 41100 ) : ( rport = ractionport )
215
210
elsif device . start_with? ( 'ILC 39' )
216
211
devicetype = '39x'
217
212
print_status ( '--> Detected 39x series, getting current CPU state:' )
218
- ractionport == nil ? ( rport = 20547 ) : ( rport = ractionport )
213
+ ractionport . nil? ( rport = 20547 ) : ( rport = ractionport )
219
214
else
220
215
print_error ( 'Only ILC and (some) RFC devices are supported.' )
221
216
return
0 commit comments