Subversion Repositories ALCASAR

Rev

Rev 859 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 859 Rev 860
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<HTML><!-- written by Rexy -->
2
<HTML><!-- written by Rexy -->
3
<HEAD>
3
<HEAD>
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
<TITLE>Network Filter</TITLE>
5
<TITLE>Network Filter</TITLE>
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
7
</HEAD>
7
</HEAD>
8
<body>
8
<body>
9
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
9
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
10
<?
10
<?
11
# Choice of language
11
# Choice of language
12
$Language = 'en';
12
$Language = 'en';
13
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
13
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
14
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
14
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
15
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
15
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
16
if($Language == 'fr'){
16
if($Language == 'fr'){
17
  $l_title_antivir = "Antivirus de flux WEB";
17
  $l_title_antivir = "Antivirus de flux WEB";
18
  $l_antivir_on="L'antivirus de flux WEB est actuellement activ&eacute;";
18
  $l_antivir_on="L'antivirus de flux WEB est actuellement activ&eacute;";
19
  $l_antivir_off="L'antivirus de flux WEB est actuellement désactiv&eacute;";
19
  $l_antivir_off="L'antivirus de flux WEB est actuellement désactiv&eacute;";
20
  $l_switch_antivir_on="Activer l'antivirus";
20
  $l_switch_antivir_on="Activer l'antivirus";
21
  $l_switch_antivir_off="D&eacute;sactiver l'antivirus";
21
  $l_switch_antivir_off="D&eacute;sactiver l'antivirus";
22
  $l_title_ip_block="Filtrage d'adresses IP";
22
  $l_title_ip_block="Filtrage d'adresses IP";
23
  $l_ip_address="Adresses IP (ou addresse de réseau) bloquées";
23
  $l_ip_address="Adresses IP (ou addresse de réseau) bloquées";
24
  $l_blocked_ip_address="Adresses IP";
24
  $l_blocked_ip_address="Adresses IP";
25
  $l_blocked_ip_address_comment="Commentaires";
25
  $l_blocked_ip_address_comment="Commentaires";
26
  $l_blocked="Bloquée";
26
  $l_blocked="Bloquée";
27
  $l_ip_block_explain="Liste des adresses IP (ou adresses IP de réseaux) bloquées";
27
  $l_ip_block_explain="Liste des adresses IP (ou adresses IP de réseaux) bloquées";
28
  $l_remove="Retirer de la liste";
28
  $l_remove="Retirer de la liste";
29
  $l_title_proto = "Filtrage de protocoles r&eacute;seau";
29
  $l_title_proto = "Filtrage de protocoles r&eacute;seau";
30
  $l_netfilter_on="Le filtrage de protocoles r&eacute;seau est actuellement activ&eacute;";
30
  $l_netfilter_on="Le filtrage de protocoles r&eacute;seau est actuellement activ&eacute;";
31
  $l_netfilter_off="Le filtrage de protocoles réseau est actuellement désactiv&eacute";
31
  $l_netfilter_off="Le filtrage de protocoles réseau est actuellement désactiv&eacute";
32
  $l_switch_on="Activer le filtrage";
32
  $l_switch_on="Activer le filtrage";
33
  $l_switch_off="D&eacute;sactiver le filtrage";
33
  $l_switch_off="D&eacute;sactiver le filtrage";
34
  $l_comment_on="&Agrave; l'exclusion du WEB (port 80), les protocoles r&eacute;seau sont interdits.<BR>Choisissez ci-dessous les protocoles que vous autorisez";
34
  $l_comment_on="&Agrave; l'exclusion du WEB (port 80), les protocoles r&eacute;seau sont interdits.<BR>Choisissez ci-dessous les protocoles que vous autorisez";
35
  $l_comment_off="(tous les protocoles réseau sont autoris&eacute;s)";
35
  $l_comment_off="(tous les protocoles réseau sont autoris&eacute;s)";
36
  $l_protocols="Protocoles autoris&eacute;s";
36
  $l_protocols="Protocoles autoris&eacute;s";
37
  $l_error_open_file="Erreur d'ouverture du fichier";
37
  $l_error_open_file="Erreur d'ouverture du fichier";
38
  $l_port="Numéro de port";
38
  $l_port="Numéro de port";
39
  $l_proto="Nom du protocole";
39
  $l_proto="Nom du protocole";
40
  $l_enabled="Autoris&eacute;";
40
  $l_enabled="Autoris&eacute;";
41
  $l_add_to_list="Ajouter &agrave; la liste";
41
  $l_add_to_list="Ajouter &agrave; la liste";
42
  $l_save_modif="Enregistrer les modifications";
42
  $l_save_modif="Enregistrer les modifications";
43
}
43
}
44
else {
44
else {
45
  $l_title_antivir = "WEB antivirus";
45
  $l_title_antivir = "WEB antivirus";
46
  $l_antivir_on="Actually, the WEB antivirus is on";
46
  $l_antivir_on="Actually, the WEB antivirus is on";
47
  $l_antivir_off="Actually, the WEB antivirus is off";
47
  $l_antivir_off="Actually, the WEB antivirus is off";
48
  $l_switch_antivir_on="Switch the antivirus on";
48
  $l_switch_antivir_on="Switch the antivirus on";
49
  $l_switch_antivir_off="Switch the antivirus off";
49
  $l_switch_antivir_off="Switch the antivirus off";
50
  $l_title_ip_block="IP address filter";
50
  $l_title_ip_block="IP address filter";
51
  $l_ip_address="IP address (or network IP address)";
51
  $l_ip_address="IP address (or network IP address)";
52
  $l_blocked_ip_address="IP addresses";
52
  $l_blocked_ip_address="IP addresses";
53
  $l_blocked_ip_address_comment="Comments";
53
  $l_blocked_ip_address_comment="Comments";
54
  $l_blocked="Blocked";
54
  $l_blocked="Blocked";
55
  $l_ip_block_explain="List of blocked IP addresses (or network IP adresses)";
55
  $l_ip_block_explain="List of blocked IP addresses (or network IP adresses)";
56
  $l_remove="Remove from list";
56
  $l_remove="Remove from list";
57
  $l_title_proto = "Network protocols filter";
57
  $l_title_proto = "Network protocols filter";
58
  $l_netfilter_on="Actually, the network protocols filter is enable";
58
  $l_netfilter_on="Actually, the network protocols filter is enable";
59
  $l_netfilter_off="Actually, the network protocols filter is disable";
59
  $l_netfilter_off="Actually, the network protocols filter is disable";
60
  $l_switch_on="Switch the Filter on";
60
  $l_switch_on="Switch the Filter on";
61
  $l_switch_off="Switch the Filter off";
61
  $l_switch_off="Switch the Filter off";
62
  $l_comment_on="(choose the authorized network protocols)";
62
  $l_comment_on="(choose the authorized network protocols)";
63
  $l_comment_on="Except for the WEB (port 80), all protocols are blocked.<BR>Choose in the list below, the protocols you want authorize";
63
  $l_comment_on="Except for the WEB (port 80), all protocols are blocked.<BR>Choose in the list below, the protocols you want authorize";
64
  $l_comment_off="(all the network protocols are allowed for authenticated users)";
64
  $l_comment_off="(all the network protocols are allowed for authenticated users)";
65
  $l_protocols="Authorize protocols";
65
  $l_protocols="Authorize protocols";
66
  $l_error_open_file="Error opening the file";
66
  $l_error_open_file="Error opening the file";
67
  $l_port="Port number";
67
  $l_port="Port number";
68
  $l_proto="protocol name";
68
  $l_proto="protocol name";
69
  $l_enabled="Authorized";
69
  $l_enabled="Authorized";
70
  $l_add_to_list="Add to the list";
70
  $l_add_to_list="Add to the list";
71
  $l_save_modif="Save modifications";
71
  $l_save_modif="Save modifications";
72
}
72
}
73
/********************
73
/********************
74
*  TEST CONF FILES  *
74
*  TEST CONF FILES  *
75
*********************/
75
*********************/
76
define ("SERVICES_LIST", "/usr/local/etc/alcasar-services");
76
define ("SERVICES_LIST", "/usr/local/etc/alcasar-services");
77
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
77
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
78
define ("IP_BLOCKED", "/usr/local/etc/alcasar-ip-blocked");
78
define ("IP_BLOCKED", "/usr/local/etc/alcasar-ip-blocked");
79
$conf_files=array(SERVICES_LIST,CONF_FILE,IP_BLOCKED);
79
$conf_files=array(SERVICES_LIST,CONF_FILE,IP_BLOCKED);
80
foreach ($conf_files as $file){
80
foreach ($conf_files as $file){
81
if (!file_exists($file)){
81
if (!file_exists($file)){
82
	exit("Requested file ".$file." isn't present");}
82
	exit("Requested file ".$file." isn't present");}
83
if (!is_readable($file)){
83
if (!is_readable($file)){
84
	exit("Can't read the file ".$file);}
84
	exit("Can't read the file ".$file);}
85
}
85
}
86
 
86
 
87
if (isset($_POST['choix'])){$choix=$_POST['choix'];} else {$choix="";}
87
if (isset($_POST['choix'])){$choix=$_POST['choix'];} else {$choix="";}
88
switch ($choix)
88
switch ($choix)
89
{
89
{
90
case 'AV_On' :
90
case 'AV_On' :
91
	exec ("sudo /usr/local/sbin/alcasar-havp.sh -on");
91
	exec ("sudo /usr/local/sbin/alcasar-havp.sh -on");
92
	break;
92
	break;
93
case 'AV_Off' :
93
case 'AV_Off' :
94
	exec ("sudo /usr/local/sbin/alcasar-havp.sh -off");
94
	exec ("sudo /usr/local/sbin/alcasar-havp.sh -off");
95
	break;
95
	break;
96
case 'NF_On' :
96
case 'NF_On' :
97
	exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
97
	exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
98
	break;
98
	break;
99
case 'NF_Off' :
99
case 'NF_Off' :
100
	exec ("sudo /usr/local/sbin/alcasar-nf.sh -off");
100
	exec ("sudo /usr/local/sbin/alcasar-nf.sh -off");
101
	break;
101
	break;
102
case 'new_port' :
102
case 'new_port' :
103
	$_POST['add_proto'] = str_replace (CHR(32),"-",$_POST['add_proto']);
-
 
104
	if ((trim($_POST['add_port']) != "80") and ($_POST['add_port'] != "") and ($_POST['add_proto'] != "") and (is_numeric($_POST['add_port'])))
103
	if ((trim($_POST['add_port']) != "80") and ($_POST['add_port'] != "") and ($_POST['add_proto'] != "") and (is_numeric($_POST['add_port'])))
105
		{
104
		{
-
 
105
		$_POST['add_proto'] = str_replace (CHR(32),"-",$_POST['add_proto']);
106
		$tab=file(SERVICES_LIST);
106
		$tab=file(SERVICES_LIST);
107
		if ($tab)
107
		$insert = true;
-
 
108
		if ($tab) // file isn't empty
108
			{
109
			{
109
			$pointeur=fopen(SERVICES_LIST,"r");
-
 
110
			// test if port doesn't already exist
110
			foreach ($tab as $line)  //test if port doesn't already exist
111
			$insert = true;
-
 
112
			foreach ($tab as $line)
-
 
113
				{
111
				{
114
				$proto_f=explode(" ", $line);
112
				$proto_f=explode(" ", $line);
115
				if (trim($_POST['add_port']) == trim($proto_f[1])) {$insert = false;}
113
				if (trim($_POST['add_port']) == trim($proto_f[1])) {$insert = false;}
116
				}
114
				}
117
			fclose($pointeur);
115
			}
118
			if ($insert == true) 
116
		if ($insert == true) 
119
				{
117
			{
120
				$line = "\n" . "#" . trim($_POST['add_proto']) . " " . trim($_POST['add_port']);
118
			$line = "\n" . "#" . trim($_POST['add_proto']) . " " . trim($_POST['add_port']);
121
				$pointeur=fopen(SERVICES_LIST,"a");
119
			$pointeur=fopen(SERVICES_LIST,"a");
122
				fwrite ($pointeur, $line);
120
			fwrite ($pointeur, $line);
123
				fclose ($pointeur);
121
			fclose ($pointeur);
124
				exec ("sudo /usr/local/bin/alcasar-file-clean.sh");
122
			exec ("sudo /usr/local/bin/alcasar-file-clean.sh");
125
				}
-
 
126
			}
123
			}
127
		}
124
		}
128
	break;
125
	break;
129
case 'new_ip' :
126
case 'new_ip' :
130
	if (trim($_POST['add_ip']) != "") 
127
	if (trim($_POST['add_ip']) != "") 
131
		{
128
		{
-
 
129
		$_POST['add_comment'] = str_replace (CHR(32),"-",$_POST['add_comment']);
132
		$tab=file(IP_BLOCKED);
130
		$tab=file(IP_BLOCKED);
133
		if ($tab)
131
		$insert = true;
-
 
132
		if ($tab) // file isn't empty
134
			{
133
			{
135
			$pointeur=fopen(IP_BLOCKED,"r");
-
 
136
			// test if IP doesn't already exist
134
			foreach ($tab as $line) // test if IP address doesn't already exist
137
			$insert = true;
-
 
138
			foreach ($tab as $line)
-
 
139
				{
135
				{
140
				$IP_f=explode("#", $line);
136
				$IP_f=explode(" ", $line);
141
				if (trim($_POST['add_ip']) == trim($IP_f[0])) {$insert = false;}
137
				if (trim($_POST['add_ip']) == trim(trim($IP_f[0],"#"))) {$insert = false;}
142
				}
-
 
143
			fclose($pointeur);
-
 
144
			if ($insert == true) 
-
 
145
				{
-
 
146
				$line ="\n" . trim($_POST['add_ip']) . " # " . trim($_POST['add_comment']);
-
 
147
				$pointeur=fopen(IP_BLOCKED,"a");
-
 
148
				fwrite ($pointeur, $line);
-
 
149
				fclose ($pointeur);
-
 
150
				exec ("sudo /usr/local/bin/alcasar-file-clean.sh");
-
 
151
				}
138
				}
152
			}
139
			}
-
 
140
		if ($insert == true) 
-
 
141
			{
-
 
142
			$line ="\n" . "#".trim($_POST['add_ip']) . " " . trim($_POST['add_comment']);
-
 
143
			$pointeur=fopen(IP_BLOCKED,"a");
-
 
144
			fwrite ($pointeur, $line);
-
 
145
			fclose ($pointeur);
-
 
146
			exec ("sudo /usr/local/bin/alcasar-file-clean.sh");
-
 
147
			}
153
		}
148
		}
154
	break;
149
	break;
155
case 'change_port' :
150
case 'change_port' :
156
	$tab=file(SERVICES_LIST);
151
	$tab=file(SERVICES_LIST);
157
	if ($tab)
152
	if ($tab)
158
		{
153
		{
159
// authorize/block protocols
154
// authorize/block protocols
160
		$pointeur=fopen(SERVICES_LIST,"w+");
155
		$pointeur=fopen(SERVICES_LIST,"w+");
161
		foreach ($tab as $ligne)
156
		foreach ($tab as $ligne)
162
			{
157
			{
163
			$proto_f=explode(" ", $ligne);
158
			$proto_f=explode(" ", $ligne);
164
			$name_svc1=trim($proto_f[0],"#");
159
			$name_svc1=trim($proto_f[0],"#");
165
			$actif = False; $remove_line = false;
160
			$actif = False; $remove_line = false;
166
			foreach ($_POST as $key => $value)
161
			foreach ($_POST as $key => $value)
167
				{
162
				{
168
				if (strstr($key,'del-'))
163
				if (strstr($key,'del-'))
169
					{
164
					{
170
					$name_svc2 = str_replace('del-','',$key);
165
					$name_svc2 = str_replace('del-','',$key);
171
					if ($name_svc1 == $name_svc2)
166
					if ($name_svc1 == $name_svc2)
172
				       		{
167
				       		{
173
						$remove_line = True;
168
						$remove_line = True;
174
						break;
-
 
175
						}
169
						}
176
					}
170
					}
177
				if (strstr($key,'chk-'))
171
				if (strstr($key,'chk-'))
178
					{
172
					{
179
					$name_svc2 = str_replace('chk-','',$key);
173
					$name_svc2 = str_replace('chk-','',$key);
180
					if ($name_svc1 == $name_svc2)
174
					if ($name_svc1 == $name_svc2)
181
				       		{
175
				       		{
182
						$actif = True;
176
						$actif = True;
183
						break;
177
						break;
184
						}
178
						}
185
					}
179
					}
186
				}
180
				}
187
			if (! $remove_line)
181
			if (! $remove_line)
188
				{
182
				{
189
				if (! $actif) {	$line="#$name_svc1 $proto_f[1]";}
183
				if (! $actif) {	$line="#$name_svc1 $proto_f[1]";}
190
				else { $line="$name_svc1 $proto_f[1]";}
184
				else { $line="$name_svc1 $proto_f[1]";}
191
				fwrite($pointeur,$line);
185
				fwrite($pointeur,$line);
192
				}
186
				}
193
			}
187
			}
194
		fclose($pointeur);
188
		fclose($pointeur);
195
		}
189
		}
196
	exec ("sudo /usr/local/sbin/alcasar-nf.sh -on");
190
	exec ("sudo /usr/local/bin/alcasar-iptables.sh -on");
197
	break;
191
	break;
198
case 'change_ip' :
192
case 'change_ip' :
199
	$tab=file(IP_BLOCKED);
193
	$tab=file(IP_BLOCKED);
200
	if ($tab)
194
	if ($tab)
201
		{
195
		{
202
// authorize/block IPs 
196
// authorize/block IPs 
203
		$pointeur=fopen(IP_BLOCKED,"w+");
197
		$pointeur=fopen(IP_BLOCKED,"w+");
204
		foreach ($tab as $ligne)
198
		foreach ($tab as $ligne)
205
			{
199
			{
206
			$ip_f=explode(" ", $ligne);
200
			$ip_f=explode(" ", $ligne);
207
			$ip_blocked1=trim($ip_f[0],"#");
201
			$ip_blocked1=trim($ip_f[0],"#");
208
			$actif = False; $remove_line = false;
202
			$actif = False; $remove_line = false;
209
			foreach ($_POST as $key => $value)
203
			foreach ($_POST as $key => $value)
210
				{
204
				{
-
 
205
				$key = str_replace ("_",".",$key); // dot are replace by '_' in post request
211
				if (strstr($key,'del-'))
206
				if (strstr($key,'del-'))
212
					{
207
					{
213
					$ip_blocked2 = str_replace('del-','',$key);
208
					$ip_blocked2 = str_replace('del-','',$key);
214
					if ($ip_blocked1 == $ip_blocked2)
209
					if ($ip_blocked1 == $ip_blocked2)
215
				       		{
210
				       		{
216
						$remove_line = True;
211
						$remove_line = True;
217
						break;
212
						break;
218
						}
213
						}
219
					}
214
					}
220
				if (strstr($key,'chk-'))
215
				if (strstr($key,'chk-'))
221
					{
216
					{
222
					$ip_blocked2 = str_replace('chk-','',$key);
217
					$ip_blocked2 = str_replace('chk-','',$key);
223
					if ($ip_blocked1 == $ip_blocked2)
218
					if ($ip_blocked1 == $ip_blocked2)
224
				       		{
219
				       		{
225
						$actif = True;
220
						$actif = True;
226
						break;
221
						break;
227
						}
222
						}
228
					}
223
					}
229
				}
224
				}
230
			if (! $remove_line)
225
			if (! $remove_line)
231
				{
226
				{
232
				if (! $actif) {	$line="#$ip_blocked1 $ip_f[1]";}
227
				if (! $actif) {	$line="#$ip_blocked1 $ip_f[1]";}
233
				else { $line="$ip_blocked1 $ip_f[1]";}
228
				else { $line="$ip_blocked1 $ip_f[1]";}
234
				fwrite($pointeur,$line);
229
				fwrite($pointeur,$line);
235
				}
230
				}
236
			}
231
			}
237
		fclose($pointeur);
232
		fclose($pointeur);
238
		}
233
		}
239
	#exec ("sudo /usr/local/bin/alcasar-iptables.sh");
234
	exec ("sudo /usr/local/bin/alcasar-iptables.sh");
240
	break;
235
	break;
241
	}
236
	}
242
# default values
237
# default values
243
if (is_file (CONF_FILE))
238
if (is_file (CONF_FILE))
244
	{
239
	{
245
	$tab=file(CONF_FILE);
240
	$tab=file(CONF_FILE);
246
	if ($tab)
241
	if ($tab)
247
		{
242
		{
248
		foreach ($tab as $line)
243
		foreach ($tab as $line)
249
			{
244
			{
250
			$field=explode("=", $line);
245
			$field=explode("=", $line);
251
			if ($field[0] == "PROTOCOLS_FILTERING")	{$PROTOCOLS_FILTERING=trim($field[1]);}
246
			if ($field[0] == "PROTOCOLS_FILTERING")	{$PROTOCOLS_FILTERING=trim($field[1]);}
252
			if ($field[0] == "WEB_ANTIVIRUS")	{$WEB_ANTIVIRUS=trim($field[1]);}
247
			if ($field[0] == "WEB_ANTIVIRUS")	{$WEB_ANTIVIRUS=trim($field[1]);}
253
			}
248
			}
254
		}
249
		}
255
	}
250
	}
256
echo "<tr><th>$l_title_antivir</th></tr>";
251
echo "<tr><th>$l_title_antivir</th></tr>";
257
?>
252
?>
258
<tr bgcolor=#FFCC66><td><img src=/images/pix.gif width=1 height=2></td></tr>
253
<tr bgcolor=#FFCC66><td><img src=/images/pix.gif width=1 height=2></td></tr>
259
</TABLE>
254
</TABLE>
260
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
255
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
261
	<tr><td valign="middle" align="left">
256
	<tr><td valign="middle" align="left">
262
<?php
257
<?php
263
if ($WEB_ANTIVIRUS == "on")
258
if ($WEB_ANTIVIRUS == "on")
264
	{
259
	{
265
	echo "<CENTER><H3>$l_antivir_on</H3></CENTER>";
260
	echo "<CENTER><H3>$l_antivir_on</H3></CENTER>";
266
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
261
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
267
	echo "<input type=hidden name='choix' value=\"AV_Off\">";
262
	echo "<input type=hidden name='choix' value=\"AV_Off\">";
268
	echo "<input type=submit value=\"$l_switch_antivir_off\">";
263
	echo "<input type=submit value=\"$l_switch_antivir_off\">";
269
}
264
}
270
else
265
else
271
	{
266
	{
272
	echo "<CENTER><H3>$l_antivir_off</H3></CENTER>";
267
	echo "<CENTER><H3>$l_antivir_off</H3></CENTER>";
273
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
268
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
274
	echo "<input type=hidden name='choix' value=\"AV_On\">";
269
	echo "<input type=hidden name='choix' value=\"AV_On\">";
275
	echo "<input type=submit value=\"$l_switch_antivir_on\">";
270
	echo "<input type=submit value=\"$l_switch_antivir_on\">";
276
	}
271
	}
277
?>
272
?>
278
</FORM>
273
</FORM>
279
</td></tr>
274
</td></tr>
280
</table>
275
</table>
281
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
276
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
282
<tr><th><?echo "$l_title_ip_block";?></th></tr>
277
<tr><th><?echo "$l_title_ip_block";?></th></tr>
283
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
278
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
284
</table>
279
</table>
285
<table width="100%" border=1 cellspacing=0 cellpadding=1>
280
<table width="100%" border=1 cellspacing=0 cellpadding=1>
286
<tr><td colspan=2 align="center">
281
<tr><td colspan=2 align="center">
287
<?
282
<?
288
echo "$l_ip_block_explain</td></tr>";
283
echo "$l_ip_block_explain</td></tr>";
289
echo "<tr><td align='center' valign='middle'>";
284
echo "<tr><td align='center' valign='middle'>";
290
echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";
285
echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";
291
echo "<input type=hidden name='choix' value=\"IP_block_filter\">";
286
echo "<input type=hidden name='choix' value=\"IP_block_filter\">";
292
echo "<table cellspacing=2 cellpadding=2 border=1>";
287
echo "<table cellspacing=2 cellpadding=2 border=1>";
293
echo "<tr><th>$l_blocked_ip_address<th>$l_blocked_ip_address_comment<th>$l_blocked<th>$l_remove</tr>";
288
echo "<tr><th>$l_blocked_ip_address<th>$l_blocked_ip_address_comment<th>$l_blocked<th>$l_remove</tr>";
294
// Read the "IP_block" file
289
// Read the "IP_block" file
295
$tab=file(IP_BLOCKED);
290
$tab=file(IP_BLOCKED);
296
if ($tab)  # the file isn't empty
291
if ($tab)  # the file isn't empty
297
	{
292
	{
298
	foreach ($tab as $line)
293
	foreach ($tab as $line)
299
		{
294
		{
300
		if (trim($line) != '') # the line isn't empty
295
		if (trim($line) != '') # the line isn't empty
301
			{
296
			{
302
			$blocked_ip=explode(" ", $line);
297
			$blocked_ip=explode(" ", $line);
303
			$ip_addr=trim($blocked_ip[0],"#");
298
			$ip_addr=trim($blocked_ip[0],"#");
-
 
299
			$comment=trim($blocked_ip[1]);
-
 
300
			if ($comment ==''){$comment="&nbsp;";}
304
			echo "<tr><td>$ip_addr<td>$blocked_ip[1]";
301
			echo "<tr><td>$ip_addr<td>$comment";
305
			echo "<td><input type='checkbox' name='chk-$ip_addr'";
302
			echo "<td><input type='checkbox' name='chk-$ip_addr'";
306
			// if the line is commented -> IP adress is not blocked
-
 
307
			if (preg_match('/^#/',$line, $r)) {
303
			if (preg_match('/^#/',$line, $r)) {
308
				echo ">";}
304
				echo ">";}
309
			else {
305
			else {
310
				echo "checked>";}
306
				echo "checked>";}
311
			echo "<td><input type='checkbox' name='del-$ip_addr'>";
307
			echo "<td><input type='checkbox' name='del-$ip_addr'>";
312
			echo "</tr>";
308
			echo "</tr>";
313
			}
309
			}
314
		}
310
		}
315
	}
311
	}
316
?>
312
?>
317
</table>
313
</table>
318
<input type='hidden' name='choix' value='change_ip'>
314
<input type='hidden' name='choix' value='change_ip'>
319
<input type='submit' value='<?echo"$l_save_modif";?>'>
315
<input type='submit' value='<?echo"$l_save_modif";?>'>
320
</form></td><td valign='middle' align='center'>
316
</form></td><td valign='middle' align='center'>
321
<form action='<?echo"$_SERVER[PHP_SELF]"?>' method='POST'>
317
<form action='<?echo"$_SERVER[PHP_SELF]"?>' method='POST'>
322
<table cellspacing=2 cellpadding=3 border=1>
318
<table cellspacing=2 cellpadding=3 border=1>
323
<tr><th><?echo"$l_ip_address<th>$l_blocked_ip_address_comment";?>
319
<tr><th><?echo"$l_ip_address<th>$l_blocked_ip_address_comment";?>
324
<td></td></tr>
320
<td></td></tr>
325
<tr><td>exemple1 : 15.25.26.27 <br>exemple2 : 18.20.20.0/24</td><td>exemple1 : CERT alert<br>exemple2 : LAN of zombies</td><td></td></tr>
321
<tr><td>exemple1 : 15.25.26.27 <br>exemple2 : 18.20.20.0/24</td><td>exemple1 : CERT alert<br>exemple2 : LAN of zombies</td><td></td></tr>
326
<tr><td><input type='text' name='add_ip' size='17'></td>
322
<tr><td><input type='text' name='add_ip' size='17'></td>
327
<td><input type='text' name='add_comment' size='10'></td>
323
<td><input type='text' name='add_comment' size='10'></td>
328
<input type='hidden' name='choix' value='new_ip'>
324
<input type='hidden' name='choix' value='new_ip'>
329
<td><input type='submit' value='<?echo"$l_add_to_list";?>'></td>
325
<td><input type='submit' value='<?echo"$l_add_to_list";?>'></td>
330
</tr></table>
326
</tr></table>
331
</form>
327
</form>
332
</td></tr>
328
</td></tr>
333
</table>
329
</table>
334
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
330
<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
335
<tr><th><?echo "$l_title_proto";?></th></tr>
331
<tr><th><?echo "$l_title_proto";?></th></tr>
336
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
332
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
337
</table>
333
</table>
338
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
334
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
339
<tr>
335
<tr>
340
<?
336
<?
341
if ($PROTOCOLS_FILTERING == "on")
337
if ($PROTOCOLS_FILTERING == "on")
342
	{
338
	{
343
	echo "<td colspan=\"2\" valign=\"middle\" align=\"left\">";
339
	echo "<td colspan=\"2\" valign=\"middle\" align=\"left\">";
344
	echo "<CENTER><H3>$l_netfilter_on</H3>$l_comment_on</CENTER>";
340
	echo "<CENTER><H3>$l_netfilter_on</H3>$l_comment_on</CENTER>";
345
	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
341
	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
346
	echo "<input type=hidden name='choix' value=\"NF_Off\">";
342
	echo "<input type=hidden name='choix' value=\"NF_Off\">";
347
	echo "<input type=submit value=\"$l_switch_off\">";
343
	echo "<input type=submit value=\"$l_switch_off\">";
348
	echo "</FORM></td></tr>";
344
	echo "</FORM></td></tr>";
349
	require ('net_filter2.php');
345
	require ('net_filter2.php');
350
	}
346
	}
351
else
347
else
352
	{
348
	{
353
	echo "<td valign=\"middle\" align=\"left\">";
349
	echo "<td valign=\"middle\" align=\"left\">";
354
	echo "<CENTER><H3>$l_netfilter_off</H3>$l_comment_off</CENTER>";
350
	echo "<CENTER><H3>$l_netfilter_off</H3>$l_comment_off</CENTER>";
355
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
351
 	echo "<FORM action='$_SERVER[PHP_SELF]' method=POST>";
356
	echo "<input type=hidden name='choix' value=\"NF_On\">";
352
	echo "<input type=hidden name='choix' value=\"NF_On\">";
357
	echo "<input type=submit value=\"$l_switch_on\">";
353
	echo "<input type=submit value=\"$l_switch_on\">";
358
	echo "</FORM></td></tr>";
354
	echo "</FORM></td></tr>";
359
	echo "</table></body></html>";
355
	echo "</table></body></html>";
360
	}
356
	}
361
?>
357
?>
362
 
358