Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 3172 → Rev 3173

/web/acc/admin/bl_categories_help.php
142,7 → 142,7
if(isset($categorie))
{
$fin1 = 0; $fin2 = 0;
foreach($global_usage as $line)
foreach ($global_usage as $line)
{
if(preg_match("#^NAME:.$categorie$#", $line) == 1)
{
/web/acc/admin/bl_filter.php
23,7 → 23,7
//# reconstruction des ip
$list = explode("\n", form_filter($form_content));
$new_list = "";
foreach($list as &$value)
foreach ($list as &$value)
{
if(preg_match('/([0-9]{1,3}.){3}[0-9]{1,3}/', $value))
{
330,7 → 330,7
exec ("sudo /usr/local/bin/alcasar-url_filter_bl.sh -safesearch_$bl_safesearch -pureip_$bl_pureip");
break;
case 'MAJ_ossi_file' :
foreach($_POST as $fichier => $value)
foreach ($_POST as $fichier => $value)
{
if($fichier != "choix" && $fichier != "update_cat")
{
365,7 → 365,7
else
{
echo "<p>".$l_update_failed.":</p>";
foreach($out as $line)
foreach ($out as $line)
{
echo "<p>".$line."</p>";
}
382,7 → 382,7
$f = fopen($update_file_ossi_cat, 'w');
fclose($f);
foreach($_POST as $fichier => $value)
foreach ($_POST as $fichier => $value)
{
// General BL
if ($fichier == 'update_cat' && $value == 1)
474,7 → 474,7
{
$bl_files = file($bl_categories);
$bl_files = preg_grep("/ossi-/", $bl_files, 1); // don't display ossi custom categories
foreach($bl_files as $fichier => $value)
foreach ($bl_files as $fichier => $value)
{
if ($cols == 1) { echo "<tr>";}
$categorie=trim(basename($value));
538,7 → 538,7
//list OSSI custom categories
$fichiersbl = array_diff(scandir($dir_blacklist), array('..','.','ossi-bl','ossi-wl'));
$fichiersbl = preg_grep("/^ossi-bl-/",$fichiersbl);
foreach($fichiersbl as $fichier => $value)
foreach ($fichiersbl as $fichier => $value)
{
echo "<tr><td><center><a href='bl_categories_help.php?liste=bl&cat=$value&filtre=domain' target='cat_help' onclick=\"window.open('bl_categories_help','cat_help','width=600,height=450,toolbar=no,scrollbars=yes,resizable=yes')\" title='categories help page'>".substr($value,8)."</a></center></td><td><center>".exec("wc -l $dir_bl_ip$value | cut -d\" \" -f1")."</center></td><td><center>".exec("wc -l $dir_bl_domain_names$value.conf | cut -d\" \" -f1")."</center></td><td><center><input type='submit' name='$value'";
if (file_exists ($dir_bl_domain_names_enabled.$value)) echo " value='$l_disable'>"; else echo " value='$l_enable'>";
584,7 → 584,7
echo "<input type='radio' name='update_cat' value=1 ".$update_select[1]." >".$l_enable;
echo "</td>";
// Display update checkbox for each updateable ossi-bl
foreach($updateable_ossi_bls as $value)
foreach ($updateable_ossi_bls as $value)
{
//check if autoupdate is enabled
$update_ossi_select = ["", ""];
/web/acc/admin/services.php
158,7 → 158,7
function checkServiceStatus($service){
$response = false;
exec("sudo /usr/bin/systemctl is-active ".escapeshellarg("$service.service"), $retval);
foreach( $retval as $val ) {
foreach ( $retval as $val ) {
if ($val == "active"){
$response = true;
break;
262,7 → 262,7
<div class="panel-row">
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"><?php echo $l_service_title;?></td><td colspan="3"><?php echo $l_service_action;?></td></tr>
<?php foreach( $MainServiceStatus as $serviceName => $statusOK ) { ?>
<?php foreach ( $MainServiceStatus as $serviceName => $statusOK ) { ?>
<tr>
<?php if ($statusOK) { ?>
<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
288,7 → 288,7
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"><?php echo $l_service_title;?></td><td colspan="3"><?php echo $l_service_action;?></td></tr>
<!-- <TR align="center"> -->
<?php foreach( $FilterServiceStatus as $serviceName => $statusOK ) { ?>
<?php foreach ( $FilterServiceStatus as $serviceName => $statusOK ) { ?>
<tr>
<?php if ($statusOK) { ?>
<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
/web/acc/admin/wl_filter.php
23,7 → 23,7
//# reconstruction des ip
$list = explode("\n", form_filter($form_content));
$new_list = "";
foreach($list as &$value)
foreach ($list as &$value)
{
if(preg_match('/([0-9]{1,3}.){3}[0-9]{1,3}/', $value))
{
249,7 → 249,7
exec ("sudo /usr/local/bin/alcasar-url_filter_wl.sh -safesearch_$wl_safesearch");
break;
case 'MAJ_ossi_file' :
foreach($_POST as $fichier => $value)
foreach ($_POST as $fichier => $value)
{
if($fichier != "choix")
{
320,7 → 320,7
{
$wl_files = file($wl_categories);
$wl_files = preg_grep("/ossi-/", $wl_files, 1); // don't display ossi custom categories
foreach($wl_files as $fichier => $value)
foreach ($wl_files as $fichier => $value)
{
if ($cols == 1) { echo "<tr>";}
$categorie=trim(basename($value));
367,7 → 367,7
//list OSSI custom categories
$fichierswl = array_diff(scandir($dir_blacklist), array('..','.','ossi-bl','ossi-wl'));
$fichierswl = preg_grep("/^ossi-wl-/",$fichierswl);
foreach($fichierswl as $fichier => $value)
foreach ($fichierswl as $fichier => $value)
{
echo "<tr><td><center><a href='bl_categories_help.php?liste=wl&cat=$value&filtre=domain' target='cat_help' onclick=window.open('bl_categories_help','cat_help','width=600,height=450,toolbar=no,scrollbars=yes,resizable=yes') title='categories help page'>".substr($value,8)."</a></center></td><td><center>".exec("wc -l $dir_wl_ip$value | cut -d\" \" -f1")."</center></td><td><center>".exec("wc -l $dir_wl_domain_names$value.conf | cut -d\" \" -f1")."</center></td><td><center><input type='submit' name='$value'";
if (file_exists ($dir_wl_domain_names_enabled.$value)) echo " value='$l_disable'>"; else echo " value='$l_enable'>";
/web/acc/backup/log_generation.php
176,7 → 176,7
$fichier = fopen($filename, "r");
$content = file($filename);
$content = array_reverse($content);
foreach($content as $line){
foreach ($content as $line){
$infos=explode("|||", $line);
echo "<tr>";
echo "<td>$infos[0]</td>";
/web/acc/manager/htdocs/accounting.php
104,7 → 104,7
</td><td align=left>
<select name=operator_of_$this->name>
EOM;
foreach($operators as $operator){
foreach ($operators as $operator){
if($this->operator == $operator)
$selected=" selected ";
else
160,7 → 160,7
<b>$l_attributes</b><br>
<select name="accounting_show_attrs[]" size=5 multiple>
EOM;
foreach($items as $key => $val)
foreach ($items as $key => $val)
echo <<<EOM
<option $selected[$key] value="$key">$val</option>
EOM;
172,7 → 172,7
<select name="order_by">
EOM;
 
foreach($items as $key => $val)
foreach ($items as $key => $val)
if ($val == 'username')
echo <<<EOM
<option selected value="$key">$val</option>
199,7 → 199,7
<option>--Attribute--</option>
EOM;
 
foreach($items as $key => $val)
foreach ($items as $key => $val)
print("<option value=\"$key\">$val</option>");
 
echo <<<EOM
296,7 → 296,7
<tr bgcolor="#d0ddb0">
EOM;
 
foreach($accounting_show_attrs as $val){
foreach ($accounting_show_attrs as $val){
$desc = $sql_attrs[$val]['desc'];
if($val == 'acctoutputoctets')
$desc = "Upload";
311,7 → 311,7
while( $row = da_sql_fetch_array($search,$config) ){
//$num++;
echo "<tr align=center>\n";
foreach($accounting_show_attrs as $val){
foreach ($accounting_show_attrs as $val){
$info = $row[$val];
if($val == "acctoutputoctets" || $val == "acctinputoctets")
$info = bytes2str($info);
/web/acc/manager/htdocs/activity.php
183,7 → 183,7
$intif_mac_addr=strtoupper(str_replace(":","-",$detail[5]));
unset ($output);unset ($detail);
exec ('sudo /usr/sbin/chilli_query list|sort -k5 -r', $output);
foreach($output as $ligne){
foreach ($output as $ligne){
$detail = explode (" ", $ligne);
$nb_ligne ++;
echo "<tr valign=\"middle\">";
/web/acc/manager/htdocs/find.php
144,7 → 144,7
<td>
<select name="radius_attr" editable>
EOM;
foreach($show_attrs as $key => $desc)
foreach ($show_attrs as $key => $desc)
switch ($key)
{
case 'Simultaneous-Use' :
/web/acc/manager/htdocs/group_new.php
189,7 → 189,7
</tr>
 
EOM;
foreach($show_attrs as $key => $desc){
foreach ($show_attrs as $key => $desc){
if ($key === 'Idle-Timeout') continue;
$name = $attrmap["$key"];
if ($name == 'none')
/web/acc/manager/htdocs/security.php
9,7 → 9,6
if ($language === 'fr') {
$l_title = 'Sécurité';
$l_spoofing = "Adresse(s) MAC usurpée(s) (Watchdog)";
$l_virus = "Virus bloqué(s) (CLAMAV)";
$l_fail2ban = "Adresse(s) IP bloquée(s) (Fail2Ban)";
$l_ban_date = "Date de bloquage";
$l_unban_date = "Date de débloquage";
20,7 → 19,6
} else if ($language === 'es') {
$l_title = 'Seguridad';
$l_spoofing = "Direcciones MAC usurpadas (Watchdog)";
$l_virus = "Virus bloqueado (CLAMAV)";
$l_fail2ban = "Dirección(es) IP bloqueada(s) (Fail2Ban)";
$l_ban_date = "Fecha de bloqueo";
$l_unban_date = "Fecha de desembolso";
31,7 → 29,6
} else {
$l_title = 'Security';
$l_spoofing = "MAC address spoofed (Watchdog)";
$l_virus = "Virus blocked (CLAMAV)";
$l_fail2ban = "IP address blocked (Fail2Ban)";
$l_ban_date = "Lock date";
$l_unban_date = "Unlock date";
58,8 → 55,7
<div class="panel-row">
<div class="btn-group btn-group-justified" role="group" aria-label="Justified button group">
<a href="security.php?tab=1" class="btn btn-default<?= (($tab === 1) ? ' active' : '') ?>" role="button"><?= $l_spoofing ?></a>
<a href="security.php?tab=2" class="btn btn-default<?= (($tab === 2) ? ' active' : '') ?>" role="button"><?= $l_virus ?></a>
<a href="security.php?tab=3" class="btn btn-default<?= (($tab === 3) ? ' active' : '') ?>" role="button"><?= $l_fail2ban ?></a>
<a href="security.php?tab=2" class="btn btn-default<?= (($tab === 3) ? ' active' : '') ?>" role="button"><?= $l_fail2ban ?></a>
</div>
<?php
if ($tab === 1) {
116,30 → 112,6
</div>
<?php
} else if ($tab === 2) {
$filePath = '/var/log/clamav/clamd.log';
$pattern = "/\bfound\b/i";
$lines = preg_grep ($pattern, file($filePath));
if ($lines === false) {
exit("Cannot open '$filePath'.");
}
$lines = array_reverse($lines);
?>
<h3><?= $l_virus ?></h3>
<div class="container">
<table class="table table-striped table-hover">
<tbody>
<?php if (!empty($lines)): ?>
<?php foreach ($lines as $line): ?>
<tr><td><?= $line ?></td></tr>
<?php endforeach; ?>
<?php else: ?>
<tr><td style="text-align: center;"><?= $l_empty ?></td></tr>
<?php endif; ?>
</tbody>
</table>
</div>
<?php
} else if ($tab === 3) {
$bans = [];
$regex = '/^(?P<date>[0-9]{4}-[0-9]{2}-[0-9]{2}[ \t]+[0-9]{2}:[0-9]{2}:[0-9]{2}),[0-9]{3}[ \t]+fail2ban\.actions[ \t]+\[[0-9]+\]:[ \t]+NOTICE[ \t]+\[(?P<rule>[a-zA-Z0-9_-]+)\][ \t]+(?P<type>Ban|Unban)[ \t]+(?P<ip>[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/';
$file = fopen('/var/log/fail2ban.log', 'r');
/web/acc/manager/htdocs/user_by_sms.php
26,7 → 26,7
$vendor=exec("udevadm info -n $openned_ports[0] | grep 'MODEL=' | cut -d'=' -f2");
$model=exec("udevadm info -n $openned_ports[0] | grep 'MODEL_FROM_DATABASE=' | cut -d'=' -f2");
$gammu_smsd_port=exec("cat /etc/gammu_smsd_conf| grep '^port\s\?=' | cut -d ' ' -f3"); // Gammu_smsd listen port
foreach($openned_ports as $row) {
foreach ($openned_ports as $row) {
if ( "$row" == "$gammu_smsd_port" ) { // is gammu listen on an openned port ?
$listen_on_right_port="true";
}
/web/acc/manager/htdocs/user_edit.php
412,7 → 412,7
EOM;
}
 
foreach($show_attrs as $key => $desc){
foreach ($show_attrs as $key => $desc){
if ($key === 'Idle-Timeout') continue;
$name = $attrmap["$key"];
$generic = (isset($attrmap['generic']["$key"])) ? $attrmap['generic']["$key"] : '';
452,7 → 452,7
}
 
$i = 0;
foreach($vals as $val) {
foreach ($vals as $val) {
$name1 = $name . $i;
$val = preg_replace('/\"/','&quot;',$val);
$oper_name = $name1 . '_op';
/web/acc/manager/htdocs/user_finger.php
45,7 → 45,7
$servers_num = 0;
if ($config[general_ld_library_path] != '')
putenv("LD_LIBRARY_PATH=$config[general_ld_library_path]");
foreach($nas_list as $nas){
foreach ($nas_list as $nas){
$j = 0;
$num = 0;
 
/web/acc/manager/html/stats.html.php
20,7 → 20,7
<td valign=middle><input type="text" name="login" size="12" value="<?=$login?>" ></td>
<td valign=middle>
<select name="server" size=1>
<?php foreach($servers as $key => $val): ?>
<?php foreach ($servers as $key => $val): ?>
<option value="<?=$val?>"><?=$key?>
<?php endforeach; ?>
</select>
/web/email_registration_back.php
156,7 → 156,7
}
 
if(isset($_POST['Fmail'])){
extract($_POST);
$Fmail = $_POST[‘Fmail’];
$Fmail = htmlentities(strtolower(trim($Fmail)));
if(!filter_var($Fmail, FILTER_VALIDATE_EMAIL)){
echo "<b>$l_invalid_Email</b><br />\n";
/web/still_connected.php
3,6 → 3,10
// store user @IP who can join this page (still have their status.php tab open) in a file.
$filename = '/tmp/current_users.txt';
$user_ip = $_SERVER['REMOTE_ADDR'];
if (!filter_var($user_ip, FILTER_VALIDATE_IP)){
echo "<b>invalide @IP</b><br />\n";
exit();
}
 
$isConnected = exec('sudo /usr/sbin/chilli_query list | awk '.escapeshellarg('($2 == "'.$user_ip.'") {print $5}'));
if ($isConnected === '0') {