mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Merge pull request #918 from glaszig/unicode-ssid
interpret hex sequences in ssid station names
This commit is contained in:
commit
2233636681
@ -641,3 +641,10 @@ function validate_host($host) {
|
|||||||
return preg_match('/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i', $host);
|
return preg_match('/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i', $host);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function evalHexSequence($string) {
|
||||||
|
$evaluator = function ($input) {
|
||||||
|
return hex2bin($input[1]);
|
||||||
|
};
|
||||||
|
return preg_replace_callback('/\\\x(..)/', $evaluator, $string);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -69,12 +69,15 @@ function nearbyWifiStations(&$networks, $cached = true)
|
|||||||
|
|
||||||
foreach (explode("\n", $scan_results) as $network) {
|
foreach (explode("\n", $scan_results) as $network) {
|
||||||
$arrNetwork = preg_split("/[\t]+/", $network); // split result into array
|
$arrNetwork = preg_split("/[\t]+/", $network); // split result into array
|
||||||
if (!array_key_exists(4, $arrNetwork) ||
|
|
||||||
trim($arrNetwork[4]) == $ap_ssid) {
|
$ssid = trim($arrNetwork[4]);
|
||||||
|
$ssid = evalHexSequence($ssid);
|
||||||
|
|
||||||
|
// exclude raspap ssid
|
||||||
|
if (empty($ssid) || $ssid == $ap_ssid) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ssid = trim($arrNetwork[4]);
|
|
||||||
// filter SSID string: anything invisible in 7bit ASCII or quotes -> ignore network
|
// filter SSID string: anything invisible in 7bit ASCII or quotes -> ignore network
|
||||||
if (preg_match('[\x00-\x1f\x7f-\xff\'\`\´\"]', $ssid)) {
|
if (preg_match('[\x00-\x1f\x7f-\xff\'\`\´\"]', $ssid)) {
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user