@@ -32,6 +32,13 @@ class Metasploit3 < Msf::Auxiliary
32
32
'Secondary Dns' => /<SecondaryDns>(.*)<\/ SecondaryDns>/i
33
33
}
34
34
35
+ DHCP_INFO = {
36
+ 'LAN IP Address' => /<DhcpIPAddress>(.*)<\/ DhcpIPAddress>/i ,
37
+ 'DHCP StartIPAddress' => /<DhcpStartIPAddress>(.*)<\/ DhcpStartIPAddress>/i ,
38
+ 'DHCP EndIPAddress' => /<DhcpEndIPAddress>(.*)<\/ DhcpEndIPAddress>/i ,
39
+ 'DHCP Lease Time' => /<DhcpLeaseTime>(.*)<\/ DhcpLeaseTime>/i
40
+ }
41
+
35
42
def initialize ( info = { } )
36
43
super ( update_info ( info ,
37
44
'Name' => "Huawei Datacard Information Disclosure Vulnerability" ,
@@ -185,7 +192,7 @@ def get_router_info
185
192
print_status ( "Basic Information" )
186
193
187
194
BASIC_INFO . each do |k , v |
188
- if res . body . match ( v )
195
+ if resp_body . match ( v )
189
196
info = $1
190
197
print_status ( "#{ k } : #{ info } " )
191
198
end
@@ -271,7 +278,7 @@ def get_router_wan_info
271
278
WAN_INFO . each do |k , v |
272
279
if resp_body . match ( v )
273
280
info = $1
274
- print_status ( "#{ k } : #{ v } " )
281
+ print_status ( "#{ k } : #{ info } " )
275
282
end
276
283
end
277
284
end
@@ -288,40 +295,25 @@ def get_router_dhcp_info
288
295
return
289
296
end
290
297
291
- print_status ( '---===[ DHCP Details ]===---' )
298
+ resp_body = res . body . to_s
292
299
293
- # Grabbing the DhcpIPAddress
294
- if res . body . match ( /<DhcpIPAddress>(.*)<\/ DhcpIPAddress>/i )
295
- dhcpipaddress = $1
296
- print_status ( "LAN IP Address: #{ dhcpipaddress } " )
297
- end
300
+ print_status ( 'DHCP Details' )
298
301
299
302
# Grabbing the DhcpStatus
300
- if res . body . match ( /<DhcpStatus>(.*)<\/ DhcpStatus>/i )
301
- dhcpstatus = $1
302
- print_status ( "DHCP: #{ ( dhcpstatus == "1" ) ? 'ENABLED' : 'DISABLED' } " )
303
+ if resp_body . match ( /<DhcpStatus>(.*)<\/ DhcpStatus>/i )
304
+ dhcp_status = $1
305
+ print_status ( "DHCP: #{ ( dhcp_status == '1' ) ? 'ENABLED' : 'DISABLED' } " )
303
306
end
304
307
305
- unless dhcpstatus == '1'
308
+ unless dhcp_status && dhcp_status == '1'
306
309
return
307
310
end
308
311
309
- # Grabbing the DhcpStartIPAddress
310
- if res . body . match ( /<DhcpStartIPAddress>(.*)<\/ DhcpStartIPAddress>/i )
311
- dhcpstartipaddress = $1
312
- print_status ( "DHCP StartIPAddress: #{ dhcpstartipaddress } " )
313
- end
314
-
315
- # Grabbing the DhcpEndIPAddress
316
- if res . body . match ( /<DhcpEndIPAddress>(.*)<\/ DhcpEndIPAddress>/i )
317
- dhcpendipaddress = $1
318
- print_status ( "DHCP EndIPAddress: #{ dhcpendipaddress } " )
319
- end
320
-
321
- # Grabbing the DhcpLeaseTime
322
- if res . body . match ( /<DhcpLeaseTime>(.*)<\/ DhcpLeaseTime>/i )
323
- dhcpleasetime = $1
324
- print_status ( "DHCP Lease Time: #{ dhcpleasetime } " )
312
+ DHCP_INFO . each do |k , v |
313
+ if resp_body . match ( v )
314
+ info = $1
315
+ print_status ( "#{ k } : #{ info } " )
316
+ end
325
317
end
326
318
end
327
319
0 commit comments