/web/acc/admin/bl_categories_help.php |
---|
178,16 → 178,16 |
{ |
$filtre = $liste == "bl" ? $bl_categorie_domain_file : $wl_categorie_domain_file; |
exec("head -n 15 $filtre | cut -d '/' -f2", $resultat); |
exec("head -n 15 ".escapeshellarg($filtre)." | cut -d '/' -f2", $resultat); |
} |
elseif($titre == "ip") |
{ |
$filtre = $liste == "bl" ? $bl_categorie_ip_file : $wl_categorie_ip_file; |
exec("head -n 15 $filtre | cut -d ' ' -f3", $resultat); |
exec("head -n 15 ".escapeshellarg($filtre)." | cut -d ' ' -f3", $resultat); |
} |
else |
{ |
exec("head -n 15 $filtre", $resultat); |
exec("head -n 15 ".escapeshellarg($filtre), $resultat); |
} |
for($i=0; $i<count($resultat); $i++) |
echo $resultat[$i]."<br/>"; |
/web/acc/admin/bl_filter.php |
---|
55,6 → 55,7 |
} |
function echo_ip_file ($filename) |
{ |
$filename = escapeshellarg($filename); |
exec("cat $filename | cut -d ' ' -f3", $resultat); |
for($i=0; $i<exec("wc -l $filename"); $i++) |
{ |
264,14 → 265,14 |
$action=$_POST[$fichier]; |
if($action == $l_remove) //delete |
{ |
exec("/bin/sed -i \"/^$fichier$/d\" $bl_categories_enabled"); |
exec("/bin/sed -i \"/$fichier$/d\" $bl_categories"); |
exec("rm -rf $dir_blacklist$fichier"); |
exec("/bin/sed -i ".escapeshellarg("/^$fichier$/d")." $bl_categories_enabled"); |
exec("/bin/sed -i ".escapeshellarg("/$fichier$/d")." $bl_categories"); |
exec("rm -rf $dir_blacklist".escapeshellarg($fichier)); |
exec ("sudo /usr/local/bin/alcasar-bl.sh --reload"); |
} |
if($action == $l_disable) //disable |
{ |
exec("/bin/sed -i \"/^$fichier$/d\" $bl_categories_enabled"); |
exec("/bin/sed -i ".escapeshellarg("/^$fichier$/d")." $bl_categories_enabled"); |
exec("sudo /usr/local/bin/alcasar-bl.sh --reload"); |
} |
if($action == $l_enable) //enable |
287,9 → 288,9 |
$dest_dir = $dir_blacklist."ossi-bl-".$file_name; # /etc/dansguardian/list/blacklist/ossi-bl-XXXXXXXX |
if((!empty($file_name)) && (!file_exists($dest_dir))) |
{ |
exec ("mkdir $dest_dir"); |
exec("mkdir ".escapeshellarg($dest_dir)); |
$file=$_FILES['fichier_ip']['tmp_name']; |
exec("/usr/bin/dos2unix $file $file"); |
exec("/usr/bin/dos2unix ".escapeshellarg($file)); |
if(move_uploaded_file($_FILES['fichier_ip']['tmp_name'], $dest_dir."/domains")) // copy in the file "domains" (containing @ip & domain names (like over Toulouse categories)) |
{ |
touch ($dest_dir."/urls"); // create the URL file even if it isn't used |
299,7 → 300,7 |
} |
else |
{ |
exec("rm -rf $dest_dir"); |
exec("rm -rf ".escapeshellarg($dest_dir)); |
echo $l_error_upload; |
} |
} |
/web/acc/admin/network.php |
---|
224,18 → 224,18 |
/******************************************* |
* Read ALCASAR_CONF_FILE Before * |
********************************************/ |
$ouvre=fopen(CONF_FILE,"r"); |
if ($ouvre){ |
while (!feof ($ouvre)) |
{ |
$tampon = fgets($ouvre, 4096); |
if (strpos($tampon,"=")!==false){ |
$tmp = explode("=",$tampon); |
$conf[$tmp[0]] = $tmp[1]; |
$file_conf = fopen(CONF_FILE, 'r'); |
if (!$file_conf) { |
exit('Error opening the file '.CONF_FILE); |
} |
while (!feof($file_conf)) { |
$buffer = fgets($file_conf, 4096); |
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) { |
$tmp = explode('=', $buffer); |
$conf[trim($tmp[0])] = trim($tmp[1]); |
} |
fclose($ouvre); |
} |
fclose($file_conf); |
if(isset($_POST['dns1']) && preg_match($reg_ip,$_POST['dns1'])) |
{ |
273,18 → 273,18 |
/******************************************* |
* Read ALCASAR_CONF_FILE Updated * |
********************************************/ |
$ouvre=fopen(CONF_FILE,"r"); |
if ($ouvre){ |
while (!feof ($ouvre)) |
{ |
$tampon = fgets($ouvre, 4096); |
if (strpos($tampon,"=")!==false){ |
$tmp = explode("=",$tampon); |
$conf[$tmp[0]] = $tmp[1]; |
$file_conf = fopen(CONF_FILE, 'r'); |
if (!$file_conf) { |
exit('Error opening the file '.CONF_FILE); |
} |
while (!feof($file_conf)) { |
$buffer = fgets($file_conf, 4096); |
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) { |
$tmp = explode('=', $buffer); |
$conf[trim($tmp[0])] = trim($tmp[1]); |
} |
fclose($ouvre); |
} |
fclose($file_conf); |
?> |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
<html><!-- written by steweb57 & rexy --> |
/web/acc/admin/network2.php |
---|
7,7 → 7,7 |
echo "<tr><th>$l_mac_address<th>$l_ip_address<th>Info<th>$l_del</tr>"; |
// Read the "ether" file |
$intif = $conf["INTIF"]; |
exec ("sudo /sbin/ip link show $intif", $output); |
exec("sudo /sbin/ip link show ".escapeshellarg($intif), $output); |
$detail = explode (" " , $output[1]); |
$intif_mac_addr=strtoupper(str_replace(":","-",$detail[5])); |
unset ($output);unset ($detail); |
/web/acc/admin/services.php |
---|
94,15 → 94,15 |
//fonction pour faire une action (start,stop,restart) sur un service |
function serviceExec($service, $action){ |
if (($action == "start")||($action == "stop")||($action == "restart")){ |
exec("sudo /usr/bin/systemctl $action $service",$retval, $retstatus); |
exec("sudo /usr/bin/systemctl $action ".escapeshellarg($service), $retval, $retstatus); |
if ($service == "sshd"){ |
if ($action == "start"){ |
exec("sudo /usr/bin/systemctl enable $service"); |
exec("sudo /usr/bin/systemctl enable ".escapeshellarg($service)); |
file_put_contents(CONF_FILE, str_replace('SSH=off', 'SSH=on', file_get_contents(CONF_FILE))); |
exec ("sudo /usr/local/bin/alcasar-iptables.sh"); |
} |
if ($action == "stop"){ |
exec("sudo /usr/bin/systemctl disable $service"); |
exec("sudo /usr/bin/systemctl disable ".escapeshellarg($service)); |
file_put_contents(CONF_FILE, str_replace('SSH=on', 'SSH=off', file_get_contents(CONF_FILE))); |
exec ("sudo /usr/local/bin/alcasar-iptables.sh"); |
} |
116,7 → 116,7 |
//(en fonction de la présence d'un mot clé dans la valeur de status) |
function checkServiceStatus($service){ |
$response = false; |
exec("sudo /usr/bin/systemctl is-active $service.service",$retval); |
exec("sudo /usr/bin/systemctl is-active ".escapeshellarg("$service.service"), $retval); |
foreach( $retval as $val ) { |
if ($val == "active"){ |
$response = true; |
/web/acc/admin/update_ldap.php |
---|
126,11 → 126,16 |
*********************************************************/ |
if ($auth_enable == "1"){ |
if (!preg_match('/^[A-Za-z0-9_\-\.]+$/', $ldap_server)) { |
exit('Invalid LDAP server.'); |
} |
file_put_contents(ALCASAR_CONF_FILE, str_replace('LDAP=off', 'LDAP=on', file_get_contents(ALCASAR_CONF_FILE))); |
exec("sudo sed -i \"s/^LDAP_IP=.*/LDAP_IP=$ldap_server/g\" ALCASAR_CONF_FILE");} |
exec("sed -i \"s/^LDAP_IP=.*/LDAP_IP=$ldap_server/g\" ALCASAR_CONF_FILE"); |
} |
else { |
file_put_contents(ALCASAR_CONF_FILE, str_replace('LDAP=on', 'LDAP=off', file_get_contents(ALCASAR_CONF_FILE))); |
exec("sudo sed -i \"s/^LDAP_IP=.*/LDAP_IP=0.0.0.0/g\" ALCASAR_CONF_FILE");} |
exec("sed -i \"s/^LDAP_IP=.*/LDAP_IP=0.0.0.0/g\" ALCASAR_CONF_FILE"); |
} |
exec ("sudo /usr/local/bin/alcasar-iptables.sh"); |
exec ("sudo /usr/bin/systemctl restart radiusd"); |
140,4 → 145,3 |
header('Location:ldap.php?update=ok'); |
exit(); |
?> |
/web/acc/admin/wl_filter.php |
---|
55,6 → 55,7 |
} |
function echo_ip_file ($filename) |
{ |
$filename = escapeshellarg($filename); |
exec("cat $filename | cut -d ' ' -f3", $resultat); |
for($i=0; $i<exec("wc -l $filename"); $i++) |
{ |
222,13 → 223,13 |
$action=$_POST[$fichier]; |
if($action == $l_remove) //delete |
{ |
exec("/bin/sed -i \"/^$fichier$/d\" $wl_categories_enabled"); |
exec("rm -rf $dir_blacklist$fichier"); |
exec("/bin/sed -i ".escapeshellarg("/^$fichier$/d")." $wl_categories_enabled"); |
exec("rm -rf .".escapeshellarg("$dir_blacklist$fichier")); |
exec ("sudo /usr/local/bin/alcasar-bl.sh --reload"); |
} |
if($action == $l_disable) //disable |
{ |
exec("/bin/sed -i \"/^$fichier$/d\" $wl_categories_enabled"); |
exec("/bin/sed -i ".escapeshellarg("/^$fichier$/d")." $wl_categories_enabled"); |
exec("sudo /usr/local/bin/alcasar-bl.sh --reload"); |
} |
if($action == $l_enable) //enable |
244,7 → 245,7 |
if(!empty($file_name)) |
{ |
$dest_dir = $dir_blacklist."ossi-wl-".$file_name; |
exec ("mkdir $dest_dir"); |
exec("mkdir ".escapeshellarg($dest_dir)); |
$file=$_FILES['fichier_ip']['tmp_name']; |
exec("/usr/bin/dos2unix $file $file"); |
if(move_uploaded_file($_FILES['fichier_ip']['tmp_name'], $dest_dir."/domains")) |
256,7 → 257,7 |
} |
else |
{ |
exec("rm -rf $dest_dir"); |
exec("rm -rf ".escapeshellarg($dest_dir)); |
echo $l_error_upload; |
} |
} |