Skip to content

Commit 70b6f94

Browse files
committed
Rewrite get_router_wan_info
1 parent aeed72f commit 70b6f94

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

modules/auxiliary/admin/huawei/huawei_wifi_info.rb

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ class Metasploit3 < Msf::Auxiliary
2626
'Classification' => /<Classify>(.*)<\/Classify>/i
2727
}
2828

29+
WAN_INFO = {
30+
'Wan IP Address' => /<WanIPAddress>(.*)<\/WanIPAddress>/i,
31+
'Primary Dns' => /<PrimaryDns>(.*)<\/PrimaryDns>/i,
32+
'Secondary Dns' => /<SecondaryDns>(.*)<\/SecondaryDns>/i
33+
}
34+
2935
def initialize(info={})
3036
super(update_info(info,
3137
'Name' => "Huawei Datacard Information Disclosure Vulnerability",
@@ -248,7 +254,6 @@ def get_router_mac_filter_info
248254
end
249255

250256
def get_router_wan_info
251-
252257
res = send_request_raw(
253258
{
254259
'method' => 'GET',
@@ -259,26 +264,16 @@ def get_router_wan_info
259264
return
260265
end
261266

262-
print_status('WAN Details')
263-
264-
# Grabbing the WanIPAddress
265-
if res.body.match(/<WanIPAddress>(.*)<\/WanIPAddress>/i)
266-
wanipaddress = $1
267-
print_status("Wan IP Address: #{wanipaddress}")
268-
end
267+
resp_body = res.body.to_s
269268

270-
# Grabbing the PrimaryDns
271-
if res.body.match(/<PrimaryDns>(.*)<\/PrimaryDns>/i)
272-
primarydns = $1
273-
print_status("Primary Dns: #{primarydns}")
274-
end
269+
print_status('WAN Details')
275270

276-
# Grabbing the SecondaryDns
277-
if res.body.match(/<SecondaryDns>(.*)<\/SecondaryDns>/i)
278-
secondarydns = $1
279-
print_status("Secondary Dns: #{secondarydns}")
271+
WAN_INFO.each do |k,v|
272+
if resp_body.match(v)
273+
info = $1
274+
print_status("#{k}: #{v}")
275+
end
280276
end
281-
282277
end
283278

284279
def get_router_dhcp_info

0 commit comments

Comments
 (0)