Subversion Repositories ALCASAR

Rev

Rev 2267 | Rev 2315 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2267 Rev 2269
1
<?php
1
<?php
2
# $Id $
2
# $Id $
3
 
3
 
4
/********************
4
/********************
5
* READ CONF FILES   *
5
* READ CONF FILES   *
6
*********************/
6
*********************/
7
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
7
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
8
define ("ACC_ACCESS_LOG", "/var/Save/security/acc_access.log");
8
define ("ACC_ACCESS_LOG", "/var/Save/security/acc_access.log");
9
$conf_files=array(CONF_FILE,ACC_ACCESS_LOG);
9
$conf_files=array(CONF_FILE,ACC_ACCESS_LOG);
10
foreach ($conf_files as $file){
10
foreach ($conf_files as $file){
11
if (!file_exists($file)){
11
if (!file_exists($file)){
12
	exit("Requested file ".$file." isn't present");}
12
	exit("Requested file ".$file." isn't present");}
13
if (!is_readable($file)){
13
if (!is_readable($file)){
14
	exit("Can't read the file ".$file);}
14
	exit("Can't read the file ".$file);}
15
}
15
}
16
// Read CONF_FILE
16
// Read CONF_FILE
17
$file_conf = fopen(CONF_FILE, 'r'); # retrieve the version number
17
$file_conf = fopen(CONF_FILE, 'r'); # retrieve the version number
18
while (!feof($file_conf)) {
18
while (!feof($file_conf)) {
19
	$tampon = fgets($file_conf, 4096);
19
	$tampon = fgets($file_conf, 4096);
20
	if ((strpos($tampon, '=') !== false) && (substr($tampon, 0, 1) !== '#')) {
20
	if ((strpos($tampon, '=') !== false) && (substr($tampon, 0, 1) !== '#')) {
21
		$tmp = explode('=', $tampon);
21
		$tmp = explode('=', $tampon);
22
		$conf[$tmp[0]] = trim($tmp[1]);
22
		$conf[$tmp[0]] = trim($tmp[1]);
23
	}
23
	}
24
}
24
}
25
fclose($file_conf);
25
fclose($file_conf);
26
?>
26
?>
27
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN//2.0">
27
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN//2.0">
28
<HTML>
28
<HTML>
29
<!-- written by Rexy ! -->
29
<!-- written by Rexy ! -->
30
<HEAD>
30
<HEAD>
31
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
31
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
32
<TITLE>menu</TITLE>
32
<TITLE>menu</TITLE>
33
<link rel="stylesheet" href="/css/style.css" type="text/css">
33
<link rel="stylesheet" href="/css/style.css" type="text/css">
34
</HEAD>
34
</HEAD>
35
<?
35
<?
36
// retrieve the user's profil
36
// retrieve the user's profil
37
exec('sudo alcasar-profil.sh -l | cut -d":" -f2 2>&1', $output);
37
exec('sudo alcasar-profil.sh -l | cut -d":" -f2 2>&1', $output);
38
$user_htdigest=$_SERVER['PHP_AUTH_USER'];
38
$user_htdigest=$_SERVER['PHP_AUTH_USER'];
39
 
39
 
40
if(strpos($output[0], $user_htdigest))
40
if(strpos($output[0], $user_htdigest))
41
{
41
{
42
	$right=1;
42
	$right=1;
43
}
43
}
44
elseif(strpos($output[1], $user_htdigest))
44
elseif(strpos($output[1], $user_htdigest))
45
{
45
{
46
	$right=2;
46
	$right=2;
47
}
47
}
48
elseif(strpos($output[2], $user_htdigest))
48
elseif(strpos($output[2], $user_htdigest))
49
{
49
{
50
	$right=3;
50
	$right=3;
51
}
51
}
52
else
52
else
53
{
53
{
54
	exit();
54
	exit();
55
}
55
}
56
 
56
 
57
$installed_version = $conf['VERSION'];
57
$installed_version = $conf['VERSION'];
58
 
58
 
59
# Choice of language
59
# Choice of language
60
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
60
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
61
{
61
{
62
	$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
62
	$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
63
	$Language = strtolower(substr(chop($Langue[0]),0,2));
63
	$Language = strtolower(substr(chop($Langue[0]),0,2));
64
}
64
}
65
if($Language == 'fr')
65
if($Language == 'fr')
66
{
66
{
67
	$l_home = "ACCUEIL";
67
	$l_home = "ACCUEIL";
68
	$l_system = "SYSTÈME";
68
	$l_system = "SYSTÈME";
69
	$l_auth = "AUTHENTIFICATION";
69
	$l_auth = "AUTHENTIFICATION";
70
	$l_filter = "FILTRAGE";
70
	$l_filter = "FILTRAGE";
71
	$l_statistics = "STATISTIQUES";
71
	$l_statistics = "STATISTIQUES";
72
	$l_backup = "SAUVEGARDES";
72
	$l_backup = "SAUVEGARDES";
73
	$l_activity = "Activité";
73
	$l_activity = "Activité";
74
	$l_blacklist = "Liste noire";
74
	$l_blacklist = "Liste noire";
75
	$l_whitelist = "Liste blanche";
75
	$l_whitelist = "Liste blanche";
76
	$l_network = "Réseau";
76
	$l_network = "Réseau";
77
	$l_ldap = "Ldap/A.D.";
77
	$l_ldap = "Ldap/A.D.";
78
	$l_access_nb = "Nb d'accès à l'ACC";
78
	$l_access_nb = "Nb d'accès à l'ACC";
79
	$l_create_user = "Créer des utilisateurs";
79
	$l_create_user = "Créer des utilisateurs";
80
	$l_edit_user = "Gérer les utilisateurs";
80
	$l_edit_user = "Gérer les utilisateurs";
81
	$l_create_group = "Créer un groupe";
81
	$l_create_group = "Créer un groupe";
82
	$l_edit_group = "Gérer les groupe";
82
	$l_edit_group = "Gérer les groupe";
83
	$l_import_empty = "Importer / Vider";
83
	$l_import_empty = "Importer / Vider";
84
	$l_protocols = "Protocoles";
84
	$l_protocols = "Protocoles";
85
	$l_stat_user_day = "Par connexion";
85
	$l_stat_user_day = "Par connexion";
86
	$l_stat_con = "Journal global";
86
	$l_stat_con = "Journal global";
87
	$l_stat_daily ="Usage journalier";
87
	$l_stat_daily ="Usage journalier";
88
	$l_stat_global_network="Trafic global";
88
	$l_stat_global_network="Trafic global";
89
	$l_stat_detail_network="Trafic détaillé";
89
	$l_stat_detail_network="Trafic détaillé";
90
	$l_security="Sécurité";
90
	$l_security="Sécurité";
91
	$l_menu="Menu";
91
	$l_menu="Menu";
92
	$l_gammu="Auto enregistrement (SMS)";
92
	$l_gammu="Auto enregistrement (SMS)";
93
	$l_archive="Archivage";
93
	$l_archive="Archivage";
94
	$l_log="Générer les journaux";
94
	$l_log="Générer les journaux";
95
	$l_backup_archive="Archives";
95
	$l_backup_archive="Archives";
96
	$l_activity_report="Rapport d'activité";
96
	$l_activity_report="Rapport d'activité";
97
	$l_backup_log="Journaux d'imputabilité";
97
	$l_backup_log="Journaux d'imputabilité";
98
	$l_since="depuis le :";
98
	$l_since="depuis le :";
99
}
99
}
100
else
100
else
101
{
101
{
102
	$Language = 'en';
102
	$Language = 'en';
103
	$l_home = "HOME";
103
	$l_home = "HOME";
104
	$l_system = "SYSTEM";
104
	$l_system = "SYSTEM";
105
	$l_auth = "AUTHENTICATION";
105
	$l_auth = "AUTHENTICATION";
106
	$l_filter = "FILTERING";
106
	$l_filter = "FILTERING";
107
	$l_statistics = "STATISTICS";
107
	$l_statistics = "STATISTICS";
108
	$l_backup = "BACKUPS";
108
	$l_backup = "BACKUPS";
109
	$l_activity = "Activity";
109
	$l_activity = "Activity";
110
	$l_blacklist = "Blacklist";
110
	$l_blacklist = "Blacklist";
111
	$l_whitelist = "Whitelist";
111
	$l_whitelist = "Whitelist";
112
	$l_network = "Network";
112
	$l_network = "Network";
113
	$l_ldap = "Ldap/A.D.";
113
	$l_ldap = "Ldap/A.D.";
114
	$l_access_nb = "ACC access Nbr";
114
	$l_access_nb = "ACC access Nbr";
115
	$l_create_user = "Create users";
115
	$l_create_user = "Create users";
116
	$l_edit_user = "Manage users";
116
	$l_edit_user = "Manage users";
117
	$l_create_group = "Create a group";
117
	$l_create_group = "Create a group";
118
	$l_edit_group = "Manage groups";
118
	$l_edit_group = "Manage groups";
119
	$l_import_empty = "Import / Empty";
119
	$l_import_empty = "Import / Empty";
120
	$l_protocols= "Protocols";
120
	$l_protocols= "Protocols";
121
	$l_stat_user_day = "By connexion";
121
	$l_stat_user_day = "By connexion";
122
	$l_stat_con = "Global accounting";
122
	$l_stat_con = "Global accounting";
123
	$l_stat_daily ="daily use";
123
	$l_stat_daily ="daily use";
124
	$l_stat_global_network="global trafic";
124
	$l_stat_global_network="global trafic";
125
	$l_stat_detail_network="detailed trafic";
125
	$l_stat_detail_network="detailed trafic";
126
	$l_security="security";
126
	$l_security="security";
127
	$l_menu="Main";
127
	$l_menu="Main";
128
	$l_gammu="Auto registration (SMS)";
128
	$l_gammu="Auto registration (SMS)";
129
	$l_backup_archive="Archives";
129
	$l_backup_archive="Archives";
130
	$l_backup_log="Log generation";
130
	$l_backup_log="Log generation";
131
	$l_activity_report="Activity report";
131
	$l_activity_report="Activity report";
132
	$l_since="since";
132
	$l_since="since";
133
}
133
}
134
echo "
134
echo "
135
	<TABLE width=\"100%\" border=0 cellspacing=0 cellpadding=0>
135
	<TABLE width=\"100%\" border=0 cellspacing=0 cellpadding=0>
136
	<tr><th>$l_menu</th></tr>
136
	<tr><th>$l_menu</th></tr>
137
	<tr><td bgcolor=\"#FFCC66\"><img src=\"/images/pix.gif\" width=1 height=2></td></tr>
137
	<tr><td bgcolor=\"#FFCC66\"><img src=\"/images/pix.gif\" width=1 height=2></td></tr>
138
</TABLE>
138
</TABLE>
139
<TABLE width=\"100%\" border=1 cellspacing=0 cellpadding=0>
139
<TABLE width=\"100%\" border=1 cellspacing=0 cellpadding=0>
140
	<tr bgcolor=\"#666666\"><td>
140
	<tr bgcolor=\"#666666\"><td>
141
		<TABLE width=\"100%\" border=0 cellspacing=0 cellpadding=2>
141
		<TABLE width=\"100%\" border=0 cellspacing=0 cellpadding=2>
142
			<tr><td valign=\"middle\" align=\"left\">
142
			<tr><td valign=\"middle\" align=\"left\">
143
				<img src=\"/images/right.gif\" height=10 width=10 border=no nosave><A HREF=\"phpsysinfo/\" TARGET=\"REXY2\">$l_home</A></td></tr>";
143
				<img src=\"/images/right.gif\" height=10 width=10 border=no nosave><A HREF=\"phpsysinfo/\" TARGET=\"REXY2\">$l_home</A></td></tr>";
144
if (isset($_GET['a'])) { $a=$_GET['a']; }
144
if (isset($_GET['a'])) { $a=$_GET['a']; }
145
	else $a=0;
145
	else $a=0;
146
if (isset($_GET['b'])) { $b=$_GET['b']; }
146
if (isset($_GET['b'])) { $b=$_GET['b']; }
147
	else $b=0;
147
	else $b=0;
148
	
148
	
149
switch($right){
149
switch($right){
150
	case 1: #admin
150
	case 1: #admin
151
		$selection[0]=$l_system;
151
		$selection[0]=$l_system;
152
		$selection[1]=$l_auth;
152
		$selection[1]=$l_auth;
153
		$selection[2]=$l_filter;
153
		$selection[2]=$l_filter;
154
		$selection[3]=$l_statistics;
154
		$selection[3]=$l_statistics;
155
		$selection[4]=$l_backup;
155
		$selection[4]=$l_backup;
156
		$fichier[0]="system.php";
156
		$fichier[0]="system.php";
157
		$fichier[1]="auth.php";
157
		$fichier[1]="auth.php";
158
		$fichier[2]="filtering.php";
158
		$fichier[2]="filtering.php";
159
		$fichier[3]="stat.php";
159
		$fichier[3]="stat.php";
160
		$fichier[4]="backup.php";
160
		$fichier[4]="backup.php";
161
		break;
161
		break;
162
	case 2: #backup
162
	case 2: #backup
163
		$selection[0]=$l_backup;
163
		$selection[0]=$l_backup;
164
		$fichier[0]="backup.php";
164
		$fichier[0]="backup.php";
165
		break;
165
		break;
166
	case 3: #manager
166
	case 3: #manager
167
		$selection[0]=$l_auth;
167
		$selection[0]=$l_auth;
168
		$fichier[0]="auth.php";
168
		$fichier[0]="auth.php";
169
		break;
169
		break;
170
	default:
170
	default:
171
		exit();
171
		exit();
172
		break;
172
		break;
173
 
173
 
174
}
174
}
175
 
175
 
176
$i=0;
176
$i=0;
177
$nb1=count($selection);
177
$nb1=count($selection);
178
while ($i != $nb1)
178
while ($i != $nb1)
179
  {
179
  {
180
	if ($a==1 AND $i==$b)
180
	if ($a==1 AND $i==$b)
181
		{
181
		{
182
		echo "<tr><td valign=\"middle\" align=\"left\"><img src=\"/images/down2.gif\" height=10 width=10 border=no nosave><a href=\"menu.php?a=0&b=0\"><font color=\"black\"><b>$selection[$i]</b></font></a></td></tr>";
182
		echo "<tr><td valign=\"middle\" align=\"left\"><img src=\"/images/down2.gif\" height=10 width=10 border=no nosave><a href=\"menu.php?a=0&b=0\"><font color=\"black\"><b>$selection[$i]</b></font></a></td></tr>";
183
		include($fichier[$i]);
183
		include($fichier[$i]);
184
		}
184
		}
185
	else
185
	else
186
		{
186
		{
187
		echo "<tr><td valign=\"middle\" align=\"left\"><img src=\"/images/right.gif\" height=10 width=10 border=no nosave><a href=\"menu.php?a=1&b=$i\">$selection[$i]</a></td></tr>";
187
		echo "<tr><td valign=\"middle\" align=\"left\"><img src=\"/images/right.gif\" height=10 width=10 border=no nosave><a href=\"menu.php?a=1&b=$i\">$selection[$i]</a></td></tr>";
188
		}
188
		}
189
	$i++;
189
	$i++;
190
  }
190
  }
191
		
191
		
192
?>
192
?>
193
		</TABLE>
193
		</TABLE>
194
	</td></tr>
194
	</td></tr>
195
</TABLE>
195
</TABLE>
196
<br>
196
<br>
197
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
197
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
198
	<tr><th>Doc</th></tr>
198
	<tr><th>Doc</th></tr>
199
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1"
199
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1"
200
height="2"></td></tr>
200
height="2"></td></tr>
201
</TABLE>
201
</TABLE>
202
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
202
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
203
	<tr bgcolor="#666666"><td>
203
	<tr bgcolor="#666666"><td>
204
		<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
204
		<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
205
			<tr><td valign="middle" align="left"><img src="/images/right.gif" height=10
205
			<tr><td valign="middle" align="left"><img src="/images/right.gif" height=10
206
width=10 border=no nosave><a href="<? echo "alcasar-$installed_version-presentation-$Language.pdf"; ?>" target="_blank">Presentation</a></td></tr>
206
width=10 border=no nosave><a href="<? echo "alcasar-$installed_version-presentation-$Language.pdf"; ?>" target="_blank">Presentation</a></td></tr>
207
			<tr><td valign="middle" align="left"><img src="/images/right.gif" height=10
207
			<tr><td valign="middle" align="left"><img src="/images/right.gif" height=10
208
width=10 border=no nosave><a href="<? echo "alcasar-$installed_version-installation-$Language.pdf"; ?>" target="_blank">Installation</a></td></tr>
208
width=10 border=no nosave><a href="<? echo "alcasar-$installed_version-installation-$Language.pdf"; ?>" target="_blank">Installation</a></td></tr>
209
			<tr><td valign="middle" align="left"><img src="/images/right.gif" height=10
209
			<tr><td valign="middle" align="left"><img src="/images/right.gif" height=10
210
width=10 border=no nosave><a href="<? echo "alcasar-$installed_version-exploitation-$Language.pdf"; ?>" target="_blank">Exploitation</a></td></tr>
210
width=10 border=no nosave><a href="<? echo "alcasar-$installed_version-exploitation-$Language.pdf"; ?>" target="_blank">Exploitation</a></td></tr>
211
			<tr><td valign="middle" align="left"><img src="/images/right.gif" height=10
211
			<tr><td valign="middle" align="left"><img src="/images/right.gif" height=10
212
width=10 border=no nosave><a href="<? echo "alcasar-$installed_version-technique.pdf"; ?>" target="_blank">Technique</a></td></tr>
212
width=10 border=no nosave><a href="<? echo "alcasar-$installed_version-technique.pdf"; ?>" target="_blank">Technique</a></td></tr>
213
		</TABLE>
213
		</TABLE>
214
	</td></tr>
214
	</td></tr>
215
</TABLE>
215
</TABLE>
216
<BR>
216
<BR>
217
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
217
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
218
	<tr><th><? echo "$l_access_nb"; ?></th></tr>
218
	<tr><th><? echo "$l_access_nb"; ?></th></tr>
219
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
219
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
220
</TABLE>
220
</TABLE>
221
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
221
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0>
222
	<tr bgcolor="#666666"><td>
222
	<tr bgcolor="#666666"><td>
223
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
223
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=0>
224
		<tr><td valign="middle" align="center">
224
		<tr><td valign="middle" align="center">
225
		<a href="admin_log.php" target="REXY2">
225
		<a href="admin_log.php" target="REXY2">
226
		<?
226
		<?
227
			$tab=file(ACC_ACCESS_LOG);
227
			$tab=file(ACC_ACCESS_LOG);
228
			$counter=count ($tab);
228
			$counter=count ($tab);
229
			$field=explode("|", $tab[1]);
229
			$field=explode("|", $tab[0]);
230
			$first_date_time=$field[0];
230
			$first_date_time=$field[0];
231
			$first_date=explode(" ", $first_date_time);
231
			$first_date=explode(" ", $first_date_time);
232
			echo "$counter</a><br>";
232
			echo "$counter</a><br>";
233
			echo "$l_since $first_date[0]";
233
			echo "$l_since $first_date[0]";
234
		?>
234
		?>
235
	</TABLE>
235
	</TABLE>
236
	</td></tr>
236
	</td></tr>
237
</TABLE>
237
</TABLE>
238
</BODY>
238
</BODY>
239
</HTML>
239
</HTML>
240
 
240
 
241
 
241
 
242
 
242