Subversion Repositories ALCASAR

Rev

Rev 1339 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
318 richard 1
<?php
2
function echo_file ($filename)
3
	{
4
	if (file_exists($filename))
5
		{
6
		if (filesize($filename) != 0)
7
			{
8
			$pointeur=fopen($filename,"r");
9
			$tampon = fread($pointeur, filesize($filename));
10
			fclose($pointeur);
11
			echo $tampon;
12
			}
13
		}
14
	else
15
		{
1041 richard 16
		echo "$filename doesn't exist";
318 richard 17
		}
18
	}
1339 richard 19
function echo_ip_file ($filename)
20
{
21
	exec("cat $filename | cut -d ' ' -f3", $resultat);
22
	for($i=0; $i<exec("wc -l $filename"); $i++)
23
	{
24
		echo $resultat[$i]."\n";
25
	}
26
}
318 richard 27
?>
28
<table width="100%" border="0" cellspacing="0" cellpadding="0">
1041 richard 29
	<tr><th>
30
	<?php echo $l_list_version; echo date ("F d Y", filemtime ('/etc/dansguardian/lists/blacklists/README'));?>
31
	</th></tr>
318 richard 32
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
33
</table>
34
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
35
<tr><td valign="middle" align="left" colspan=10>
1015 richard 36
<FORM action='bl_filter.php' method=POST>
318 richard 37
<?php
882 richard 38
if ((file_exists("$dir_tmp/blacklists.tar.gz")) && (file_exists("$dir_tmp/md5sum")))
878 richard 39
	{
40
	echo "$l_fingerprint"; echo_file ("$dir_tmp/md5sum");
41
	echo "<br>$l_fingerprint2<a href='http://dsi.ut-capitole.fr/blacklists/download/MD5SUM.LST' target='cat_help' onclick=window.open('http://dsi.ut-capitole.fr/blacklists/download/MD5SUM.LST','cat_help','width=600,height=150,toolbar=no,scrollbars=yes,resizable=yes') title='verify fingerprint'>dsi.ut-capitole.fr/blacklists/download/MD5SUM.LST</a><br>";
1041 richard 42
	echo "<input type='hidden' name='choix' value='Active_list'>";
885 richard 43
	echo "<input type='submit' value='$l_activate_bl'> ($l_warning)</FORM>";
1015 richard 44
	echo "<FORM action='bl_filter.php' method=POST>";
1041 richard 45
	echo "<input type='hidden' name='choix' value='Reject_list'>";
885 richard 46
	echo "<input type='submit' value='$l_reject_bl'></form>";
878 richard 47
	}
48
else
49
	{
1041 richard 50
	echo "<input type='hidden' name='choix' value='Download_list'>";
878 richard 51
	echo "<input type='submit' value='$l_download_bl'>";
52
	echo " ($l_warning)";
53
	}
318 richard 54
?>
55
</FORM>
56
</td></tr>
1339 richard 57
</table><br/>
1041 richard 58
<table width="100%" border="0" cellspacing="0" cellpadding="0">
59
	<tr><th><?php echo $l_bl; ?></th></tr>
60
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
61
</table>
62
<table width="100%" border=1 cellspacing=0 cellpadding=1>
318 richard 63
<tr><td valign="middle" align="left" colspan=10>
1015 richard 64
<FORM action='bl_filter.php' method=POST>
1041 richard 65
<input type='hidden' name='choix' value='MAJ_cat_bl'>
318 richard 66
<?php
1377 richard 67
echo "<center>";
68
$nbDomainNames = exec ("wc -l /usr/local/share/dnsmasq-bl/* | tail -n 1 | awk '{print $1}'");
69
$nbUrl = exec ("for file in `find /etc/dansguardian/lists/blacklists/ -name 'urls'`; do nb=$((nb+$(wc -l \$file | awk '{print $1}'))); done; echo \$nb");
70
$nbIp = exec ("wc -l /usr/local/share/iptables-bl/* | tail -n 1 | awk '{print $1}'");
71
echo "<b>$l_nbDomainNames</b> $nbDomainNames, <b>$l_nbUrl</b> $nbUrl, <b>$l_nbIp</b> $nbIp<br/>";
72
echo "$l_bl_categories</center></td></tr>";	
318 richard 73
//on lit et on interprete le fichier de catégories
74
$cols=1; 
75
if (file_exists($bl_categories))
76
	{
77
	$pointeur=fopen($bl_categories,"r");
78
	while (!feof ($pointeur))
79
		{
80
		$ligne=fgets($pointeur, 4096);
81
		if ($ligne)
82
			{
83
			if ($cols == 1) { echo "<tr>";}
1339 richard 84
				$categorie=trim(basename($ligne));
85
			if($categorie != "ossi")
86
			{
87
				echo "<td><a href='bl_categories_help.php?liste=bl&cat=$categorie' target='cat_help' onclick=window.open('bl_categories_help.php','cat_help','width=600,height=450,toolbar=no,scrollbars=yes,resizable=yes') title='categories help page'>$categorie</a><br>";
88
				echo "<input type='checkbox' name='chk-$categorie'";
89
				// si la ligne est commentée -> categorie non selectionnée
90
				if (preg_match('/^#/',$ligne, $r)) { echo ">";}
91
				else { echo "checked>"; }
92
				echo "</td>";
93
				$cols++;
94
			}
318 richard 95
			if ($cols > 10) {
96
				echo "</tr>";
97
				$cols=1; }
98
			}
99
		}
100
	fclose($pointeur);
101
	}
102
else	{
103
	echo "$l_error_open_file $bl_categories";
104
	}
878 richard 105
echo "</td></tr>";
106
echo "<tr><td valign='middle' align='left' colspan=10>";
876 richard 107
echo "<center><b>$l_maj_rehabilitated</b></center></td></tr>";
1339 richard 108
echo "<tr><td width=50% colspan=5 align=center>";
876 richard 109
echo "<H3>$l_rehabilitated_dns</H3>$l_rehabilitated_dns_explain<BR>$l_one_dns<BR>";
1041 richard 110
echo "<textarea name='BL_rehabilited_domains' rows=3 cols=40>";
111
echo_file ($dir_dg."exceptionsitelist");
876 richard 112
echo "</textarea></td>";
1339 richard 113
echo "<td width=50% colspan=5 align=center>";
114
echo "<H3>$l_rehabilitated_ip</H3>$l_rehabilitated_ip_explain<BR>$l_one_ip<BR>";
115
echo "<textarea name='BL_rehabilited_ip' rows=3 cols=40>";
116
echo_file ($dir_dg."exceptioniplist");
117
echo "</textarea></td></tr><tr><td width=50% colspan=10>";
878 richard 118
echo "<tr><td valign='middle' align='left' colspan=10>";
119
echo "<center><b>$l_add_to_bl</b></center></td></tr>";
1339 richard 120
echo "<tr><td width=50% colspan=5 align=center>";
878 richard 121
echo "<H3>$l_forbidden_dns</H3>$l_forbidden_dns_explain<BR>";
1041 richard 122
echo "<textarea name='OSSI_bl_domains' rows=3 cols=40>";
123
echo_file ($dir_dg."blacklists/ossi/domains");
878 richard 124
echo "</textarea></td>";
1339 richard 125
echo "<td width=50% colspan=5 align=center>";
126
echo "<H3>$l_forbidden_ip</H3>$l_forbidden_ip_explain<BR>";
127
echo "<textarea name='OSSI_bl_ip' rows=3 cols=40>";
128
echo_ip_file ($dir_bl_ip."ossi");
878 richard 129
echo "</textarea></td></tr><tr><td colspan=10>";
876 richard 130
echo "<input type='submit' value='$l_record'>";
131
echo "</form> ($l_wait)";
1339 richard 132
echo "</table></td><br/>";
876 richard 133
?>
318 richard 134
<table width="100%" border="0" cellspacing="0" cellpadding="0">
1339 richard 135
	<tr><th><?php echo $l_ip_file_title; ?></th></tr>
136
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
137
</table>
138
<table width="100%" border=1 cellspacing=0 cellpadding=1>
139
<form action='bl_filter.php' method='POST'>
140
<input type='hidden' name='choix' value='MAJ_ip_file_delete'>
141
<?php
142
echo "<tr><td width=50% colspan=5 align=center>";
143
echo "<H3>$l_file_list</H3>";
144
echo "<table cellspacing=2 cellpadding=3 border=1><tr><th>$l_file_name<th>$l_nb_ip<th>$l_file_remove</tr>";
145
exec("cd $upload_dir && ls ossi-*", $fichiersIp);
146
foreach($fichiersIp as $fichier => $value)
147
{
148
	echo "<tr><td><center>".exec("sed 's/^.....//g' <<< $value")."</center></td><td><center>".exec("wc -l $upload_dir$value | awk '{print $1}'")."</center></td><td><center><input type='submit' name='$value' value='$l_remove'></center></td></tr>";
149
}
150
echo "</table><br/></td></form><form action='bl_filter.php' method='POST' enctype='multipart/form-data'>";
151
echo "<input type='hidden' name='choix' value='MAJ_ip_file_upload'><td width=50% colspan=5 align=center>";
152
echo "<H3>$l_add_ip_file</H3>";
153
echo "<input type='file' name='fichier_ip'>";
154
echo "<input type='submit' value='$l_submit'>";
155
echo "</td></tr>";
156
echo "</form>";
157
echo "</table><br/>";
158
?>
159
<table width="100%" border="0" cellspacing="0" cellpadding="0">
1041 richard 160
	<tr><th><?php echo $l_wl; ?></th></tr>
161
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
162
</table>
163
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
164
<tr><td valign="middle" align="left" colspan=10>
165
<FORM action='bl_filter.php' method=POST>
166
<input type='hidden' name='choix' value='MAJ_cat_wl'>
167
<?php
1377 richard 168
echo "<center>";
169
$nbDomainNames = exec ("wc -l /usr/local/share/dnsmasq-wl/* | tail -n 1 | awk '{print $1}'");
170
$nbUrl = 0;
171
$nbIp = exec ("wc -l /usr/local/share/iptables-wl/* | tail -n 1 | awk '{print $1}'");
172
echo "<b>$l_nbDomainNames</b> $nbDomainNames, <b>$l_nbUrl</b> $nbUrl, <b>$l_nbIp</b> $nbIp<br/>";
173
echo "$l_wl_categories</center></td></tr>";
1041 richard 174
//on lit et on interprete le fichier de catégories
175
$cols=1; 
176
if (file_exists($wl_categories))
177
	{
178
	$pointeur=fopen($wl_categories,"r");
179
	while (!feof ($pointeur))
180
		{
181
		$ligne=fgets($pointeur, 4096);
182
		if ($ligne)
183
			{
184
			if ($cols == 1) { echo "<tr>";}
185
			$categorie=trim(basename($ligne));
1332 richard 186
			echo "<td><a href='bl_categories_help.php?liste=wl&cat=$categorie' target='cat_help' onclick=window.open('bl_categories_help.php','cat_help','width=600,height=450,toolbar=no,scrollbars=yes,resizable=yes') title='categories help page'>$categorie</a><br>";
1041 richard 187
			echo "<input type='checkbox' name='chk-$categorie'";
188
			// si la ligne est commentée -> categorie non selectionnée
189
			if (preg_match('/^#/',$ligne, $r)) { echo ">";}
190
			else { echo "checked>"; }
191
			echo "</td>";
192
			$cols++;
193
			if ($cols > 10) {
194
				echo "</tr>";
195
				$cols=1; }
196
			}
197
		}
198
	fclose($pointeur);
199
	}
200
else	{
201
	echo "$l_error_open_file $wl_categories";
202
	}
203
echo "<tr><td valign='middle' align='left' colspan=10>";
204
echo "<center><b>$l_add_to_wl</b></center></td></tr>";
1339 richard 205
echo "<tr><td width=50% colspan=5 align=center>";
1041 richard 206
echo "<H3>$l_allowed_dns</H3>$l_forbidden_dns_explain<BR>";
207
echo "<textarea name='OSSI_wl_domains' rows=3 cols=40>";
208
echo_file ($dir_dg."blacklists/ossi/domains_wl");
209
echo "</textarea></td>";
1339 richard 210
echo "<td width=50% colspan=5 align=center>";
211
echo "<H3>$l_allowed_ip</H3>$l_forbidden_ip_explain<BR>";
212
echo "<textarea name='OSSI_wl_ip' rows=3 cols=40>";
1377 richard 213
echo_ip_file ($file_wl_ip);
214
echo "</textarea></td></tr><tr><td colspan=5>";
215
echo "<input type='submit' value='$l_record'></form></td><form action='bl_filter.php' method='POST'><td valign='middle' align='left' colspan=5><input type='hidden' name='choix' value='Update_IP_WL'><input type='submit' value='$l_update_ip'> $l_update_ip_info</form></td></tr>";
1041 richard 216
?>
1339 richard 217
</TABLE><br/>
1041 richard 218
<table width="100%" border="0" cellspacing="0" cellpadding="0">
878 richard 219
	<tr><th><?php echo $l_specific_filtering; ?></th></tr>
318 richard 220
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
221
</table>
222
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
1015 richard 223
<FORM action='bl_filter.php' method='POST'>
878 richard 224
<input type='hidden' name='choix' value='Specific_filtering'>
879 richard 225
<tr><td>
226
<input type='checkbox' name='chk-ip'
876 richard 227
<?php
882 richard 228
// verify "pureip" filtering state
879 richard 229
if (file_exists($bannedsite_file))
230
	{
231
	$pointeur=fopen($bannedsite_file,"r");
232
	while (!feof ($pointeur))
233
		{
234
		$ligne=fgets($pointeur, 4096);
235
		if ($ligne)
236
			{
237
			if (preg_match('/^\*ip$/',$ligne, $r)) 
238
				{
239
				echo " checked";
240
				break;
241
				}
242
			}
243
		}
244
	fclose($pointeur);
245
	}
246
else	{
247
	echo "$l_error_open_file $bannedsite_file";
248
	}
249
echo "> $l_ip_filtering";
318 richard 250
?>
882 richard 251
</td></tr>
878 richard 252
<tr><td>
882 richard 253
<input type='checkbox' name='chk-safesearch'
254
<?php
255
// verify "safesearch" filtering state
256
if (file_exists($urlregex_file))
257
	{
258
	$pointeur=fopen($urlregex_file,"r");
259
	while (!feof ($pointeur))
260
		{
261
		$ligne=fgets($pointeur, 4096);
262
		if ($ligne)
263
			{
264
			if (preg_match('/^\"\(\^http\:\/\/\[0\-9a\-z\]\+\\\.google/',$ligne, $r))
265
				{
266
				echo " checked";
267
				break;
268
				}
269
			}
270
		}
271
	fclose($pointeur);
272
	}
273
else	{
274
	echo "$l_error_open_file $urlregex_file";
275
	}
276
echo "> $l_safe_searching";
277
echo "<br>$l_safe_youtube";
885 richard 278
echo "<input type='text' name='Youtube_ID' size='30' value='";
279
if ($YOUTUBE_ID == "ABCD1234567890abcdef") // generic ID (do nothing)
280
	{
281
	echo "'>";
282
	}
283
else {
284
	echo "$YOUTUBE_ID'>";
285
	} 
286
echo " $l_youtube_id<tr><td>";
1339 richard 287
echo "<input type='submit' value='$l_record'></td></tr>";
882 richard 288
?>
1339 richard 289
</FORM> 
318 richard 290
</TABLE>