Browse Source

only lower case hex sequences in non-ASCII SSID

pull/1093/head
zbchristian 5 months ago
committed by billz
parent
commit
db9f76eb5c
  1. 27
      includes/functions.php
  2. 3
      includes/wifi_functions.php

27
includes/functions.php

@ -648,3 +648,30 @@ function evalHexSequence($string) {
return preg_replace_callback('/\\\x(..)/', $evaluator, $string);
}
function hexSequence2lower($string) {
return preg_replace_callback('/\\\\x([0-9A-F]{2})/', function($b){ return '\x'.strtolower($b[1]); }, $string);
}
/* File upload callback object
*
*/
class validation
{
public function check_name_length($object)
{
if (strlen($object->file['filename']) > 255) {
$object->set_error('File name is too long.');
}
}
}
/* Resolves public IP address
*
* @return string $public_ip
*/
function get_public_ip()
{
exec('wget https://ipinfo.io/ip -qO -', $public_ip);
return $public_ip[0];
}

3
includes/wifi_functions.php

@ -81,7 +81,6 @@ function nearbyWifiStations(&$networks, $cached = true)
$arrNetwork = preg_split("/[\t]+/", $network); // split result into array
$ssid = trim($arrNetwork[4]);
$ssid = evalHexSequence($ssid);
// exclude raspap ssid
if (empty($ssid) || $ssid == $ap_ssid) {
@ -126,7 +125,7 @@ function connectedWifiStations(&$networks)
exec('iwconfig ' .$_SESSION['wifi_client_interface'], $iwconfig_return);
foreach ($iwconfig_return as $line) {
if (preg_match('/ESSID:\"([^"]+)\"/i', $line, $iwconfig_ssid)) {
$networks[$iwconfig_ssid[1]]['connected'] = true;
$networks[hexSequence2lower($iwconfig_ssid[1])]['connected'] = true;
}
}
}

Loading…
Cancel
Save