Skip to content

Commit fe61b27

Browse files
committed
Rewrite get_router_ssid
1 parent abe9c85 commit fe61b27

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

modules/auxiliary/admin/huawei/huawei_wifi_info.rb

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -207,27 +207,18 @@ def get_router_ssid
207207
})
208208

209209
#check whether we got any response from server and proceed.
210-
unless res
211-
print_error('Failed to get any response from server!!!')
212-
return
213-
end
214-
215-
#Is it a HTTP OK
216-
unless res.code == 200
217-
print_error('Did not get HTTP 200, URL was not found. Exiting!')
218-
return
210+
unless is_target?(res)
211+
return nil
219212
end
220213

221-
#Check to verify server reported is a Huawei router
222-
unless res.headers['Server'].match(/IPWEBS\/1.4.0/i)
223-
print_error('Target doesn\'t seem to be a Huawei router. Exiting!')
224-
return
225-
end
214+
resp_body = res.body.to_s
226215

227216
# Grabbing the Wifi SSID
228-
if res.body.match(/<WifiSsid>(.*)<\/WifiSsid>/i)
217+
if resp_body.match(/<WifiSsid>(.*)<\/WifiSsid>/i)
229218
return $1
230219
end
220+
221+
nil
231222
end
232223

233224
def get_router_mac_filter_info

0 commit comments

Comments
 (0)