Skip to content

Commit aeed72f

Browse files
committed
Rewrite get_router_info
1 parent 26b17d5 commit aeed72f

File tree

1 file changed

+28
-76
lines changed

1 file changed

+28
-76
lines changed

modules/auxiliary/admin/huawei/huawei_wifi_info.rb

Lines changed: 28 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,21 @@ class Metasploit3 < Msf::Auxiliary
1111
include Msf::Exploit::Remote::HttpClient
1212
include Msf::Auxiliary::Report
1313

14+
BASIC_INFO = {
15+
'Device Name' => /<DeviceName>(.*)<\/DeviceName>/i,
16+
'Serial Number' => /<SerialNumber>(.*)<\/SerialNumber>/i,
17+
'IMEI' => /<Imei>(.*)<\/Imei>/i,
18+
'IMSI' => /<Imsi>(.*)<\/Imsi>/i,
19+
'ICCID' => /<Iccid>(.*)<\/Iccid>/i,
20+
'Hardware Version' => /<HardwareVersion>(.*)<\/HardwareVersion>/i,
21+
'Software Version' => /<SoftwareVersion>(.*)<\/SoftwareVersion>/i,
22+
'WebUI Version' => /<WebUIVersion>(.*)<\/WebUIVersion>/i,
23+
'Mac Address1' => /<MacAddress1>(.*)<\/MacAddress1>/i,
24+
'Mac Address2' => /<MacAddress2>(.*)<\/MacAddress2>/i,
25+
'Product Family' => /<ProductFamily>(.*)<\/ProductFamily>/i,
26+
'Classification' => /<Classify>(.*)<\/Classify>/i
27+
}
28+
1429
def initialize(info={})
1530
super(update_info(info,
1631
'Name' => "Huawei Datacard Information Disclosure Vulnerability",
@@ -45,15 +60,15 @@ def initialize(info={})
4560
#Gather basic router information
4661
def run
4762
get_router_info
48-
print_status('')
63+
print_line('')
4964
get_router_mac_filter_info
50-
print_status('')
65+
print_line('')
5166
get_router_wan_info
52-
print_status('')
67+
print_line('')
5368
get_router_dhcp_info
54-
print_status('')
69+
print_line('')
5570
get_wifi_info
56-
print_status('')
71+
print_line('')
5772
end
5873

5974
def get_wifi_info
@@ -159,78 +174,15 @@ def get_router_info
159174
return
160175
end
161176

162-
print_status("---===[ Basic Information ]===---")
163-
164-
# Grabbing the DeviceName
165-
if res.body.match(/<DeviceName>(.*)<\/DeviceName>/i)
166-
deviceName = $1
167-
print_status("Device Name: #{deviceName}")
168-
end
169-
170-
# Grabbing the SerialNumber
171-
if res.body.match(/<SerialNumber>(.*)<\/SerialNumber>/i)
172-
serialnumber = $1
173-
print_status("Serial Number: #{serialnumber}")
174-
end
175-
176-
# Grabbing the IMEI
177-
if res.body.match(/<Imei>(.*)<\/Imei>/i)
178-
imei = $1
179-
print_status("IMEI: #{imei}")
180-
end
181-
182-
# Grabbing the IMSI
183-
if res.body.match(/<Imsi>(.*)<\/Imsi>/i)
184-
imsi = $1
185-
print_status("IMSI: #{imsi}")
186-
end
187-
188-
# Grabbing the ICCID
189-
if res.body.match(/<Iccid>(.*)<\/Iccid>/i)
190-
iccid = $1
191-
print_status("ICCID: #{imsi}")
192-
end
193-
194-
# Grabbing the HardwareVersion
195-
if res.body.match(/<HardwareVersion>(.*)<\/HardwareVersion>/i)
196-
hardwareversion = $1
197-
print_status("Hardware Version: #{hardwareversion}")
198-
end
199-
200-
# Grabbing the SoftwareVersion
201-
if res.body.match(/<SoftwareVersion>(.*)<\/SoftwareVersion>/i)
202-
softwareversion = $1
203-
print_status("Software Version: #{softwareversion}")
204-
end
205-
206-
# Grabbing the WebUIVersion
207-
if res.body.match(/<WebUIVersion>(.*)<\/WebUIVersion>/i)
208-
webuiversion = $1
209-
print_status("WebUI Version: #{webuiversion}")
210-
end
211-
212-
# Grabbing the MacAddress1
213-
if res.body.match(/<MacAddress1>(.*)<\/MacAddress1>/i)
214-
macaddress1 = $1
215-
print_status("Mac Address1: #{macaddress1}")
216-
end
217-
218-
# Grabbing the MacAddress2
219-
if res.body.match(/<MacAddress2>(.*)<\/MacAddress2>/i)
220-
macaddress2 = $1
221-
print_status("Mac Address2: #{macaddress2}")
222-
end
177+
resp_body = res.body.to_s
223178

224-
# Grabbing the ProductFamily
225-
if res.body.match(/<ProductFamily>(.*)<\/ProductFamily>/i)
226-
productfamily = $1
227-
print_status("Product Family: #{productfamily}")
228-
end
179+
print_status("Basic Information")
229180

230-
# Grabbing the Classification
231-
if res.body.match(/<Classify>(.*)<\/Classify>/i)
232-
classification = $1
233-
print_status("Classification: #{classification}")
181+
BASIC_INFO.each do |k,v|
182+
if res.body.match(v)
183+
info = $1
184+
print_status("#{k}: #{info}")
185+
end
234186
end
235187
end
236188

@@ -307,7 +259,7 @@ def get_router_wan_info
307259
return
308260
end
309261

310-
print_status('---===[ WAN Details ]===---')
262+
print_status('WAN Details')
311263

312264
# Grabbing the WanIPAddress
313265
if res.body.match(/<WanIPAddress>(.*)<\/WanIPAddress>/i)

0 commit comments

Comments
 (0)