Code corrections

This commit is contained in:
bergware
2025-02-01 01:19:08 +01:00
parent 964598ad72
commit 169c03aedf
7 changed files with 10 additions and 8 deletions

View File

@@ -1178,6 +1178,8 @@ $('body').on('click','a,.ca_href', function(e) {
}
if (href) {
href = href.trim();
// Sanitize href to prevent XSS
href = href.replace(/[<>"]/g, '');
if (href.match('https?://[^\.]*.(my)?unraid.net/') || href.indexOf('https://unraid.net/') == 0 || href == 'https://unraid.net' || href.indexOf('http://lime-technology.com') == 0) {
if (ca_href) window.open(href,target);
return;

View File

@@ -1,4 +1,4 @@
<?PHP
// start/stop service
exec("/etc/rc.d/rc.ptpd {$_POST['cmd']}");
exec("/etc/rc.d/rc.ptpd ".escapeshellarg($_POST['cmd']));
?>

View File

@@ -35,7 +35,7 @@ require_once "$docroot/webGui/include/Helpers.php";
function scanWifi($port) {
$wlan = [];
exec("iw $port scan | grep -P '^BSS|signal:|SSID:|Authentication'",$scan);
exec("iw ".escapeshellarg($port)." scan | grep -P '^BSS|signal:|SSID:|Authentication'",$scan);
$n = -1;
for ($i=0; $i<count($scan); $i++) {
if (substr($scan[$i],0,3)=='BSS') {
@@ -81,7 +81,7 @@ case 'list':
$index = 0;
if (count(array_column($wlan,'ssid'))) {
$up = file_get_contents("/sys/class/net/$port/carrier") == 1;
$alive = $up ? exec("iw $port link | grep -Pom1 'SSID: \K.+'") : '';
$alive = $up ? exec("iw ".escapeshellarg($port)." link | grep -Pom1 'SSID: \K.+'") : '';
$state = $up ? _('Connected') : _('Disconnected');
$color = $up ? 'blue' : 'red';

View File

@@ -18,7 +18,7 @@ require_once "$docroot/plugins/dynamix/include/Wrappers.php";
$arg = $argv[1] ?? '';
$ini = '/var/local/emhttp/wireless.ini';
$cfg = '/boot/config/wireless.cfg';
$wifi = (array)@parse_ini_file($cfg,true);
$wifi = is_file($cfg) ? (array)parse_ini_file($cfg,true) : [];
$port = array_key_first($wifi);
$text = ["PORT=\"$port\""];
$renew = false;

View File

@@ -60,7 +60,7 @@ div.title span.right{font-size:1.4rem;padding-top:2px;padding-right:10px;float:r
div.title span img{padding-right:4px}
div.title.shift{margin-top:-30px}
#menu{position:absolute;top:90px;left:0;right:0;display:grid;grid-template-columns:auto max-content;z-index:101}
.nav-tile{height:4rem;line-height:4rem;padding:0;margin:0;font-size:1.2rem;letter-spacing:1.8px;background-color:#f2f2f2;white-space:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-height:4px}
.nav-tile{height:4rem;line-height:4rem;padding:0;margin:0;font-size:1.2rem;letter-spacing:1.8px;background-color:#f2f2f2;white-space:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:4px}
.nav-tile::-webkit-scrollbar{height:4px}
.nav-tile.right{text-align:right}
.nav-item,.nav-user{position:relative;display:inline-block;text-align:center;margin:0}

View File

@@ -60,7 +60,7 @@ div.title span.right{font-size:1.4rem;padding-top:2px;padding-right:10px;float:r
div.title span img{padding-right:4px}
div.title.shift{margin-top:-30px}
#menu{position:absolute;top:90px;left:0;right:0;display:grid;grid-template-columns:auto max-content;z-index:101}
.nav-tile{height:4rem;line-height:4rem;padding:0;margin:0;font-size:1.2rem;letter-spacing:1.8px;background-color:#1c1b1b;white-space:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-height:4px}
.nav-tile{height:4rem;line-height:4rem;padding:0;margin:0;font-size:1.2rem;letter-spacing:1.8px;background-color:#1c1b1b;white-space:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:4px}
.nav-tile::-webkit-scrollbar{height:4px}
.nav-tile.right{text-align:right}
.nav-item,.nav-user{position:relative;display:inline-block;text-align:center;margin:0}