Subversion Repositories ALCASAR

Rev

Rev 2811 | Rev 2841 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2811 Rev 2818
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: security.php 2811 2020-04-15 22:07:11Z rexy $
2
# $Id: security.php 2818 2020-05-10 21:53:28Z rexy $
3
 
3
 
4
$language = 'en';
4
$language = 'en';
5
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
5
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
6
    $langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
6
    $langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
7
    $language = strtolower(substr(chop($langue[0]), 0, 2));
7
    $language = strtolower(substr(chop($langue[0]), 0, 2));
Line 25... Line 25...
25
    $l_empty="Empty";
25
    $l_empty="Empty";
26
    $l_rule="Rule";
26
    $l_rule="Rule";
27
}
27
}
28
$tab = (isset($_GET['tab'])) ? intval($_GET['tab']) : 1;
28
$tab = (isset($_GET['tab'])) ? intval($_GET['tab']) : 1;
29
?>
29
?>
30
<!DOCTYPE HTML PUBLIC>
30
<!DOCTYPE HTML>
31
<html>
31
<html>
32
<head>
32
	<head>
33
	<meta charset="UTF-8">
33
		<meta charset="UTF-8">
34
	<title><?= $l_title ?></title>
34
		<title><?= $l_title ?></title>
35
	<link rel="stylesheet" href="/css/bootstrap.min.css">
35
		<link rel="stylesheet" href="/css/bootstrap.min.css">
36
	<script src="/js/jquery.min.js"></script>
36
		<script src="/js/jquery.min.js"></script>
37
	<script src="/js/bootstrap.min.js"></script>
37
		<script src="/js/bootstrap.min.js"></script>
38
	<link rel="stylesheet" href="style.css">
38
		<link rel="stylesheet" href="/css/acc.css">
39
</head>
39
	</head>
40
<body>
40
	<body>
41
<table  class="tableTop" border=0 cellspacing=0 cellpadding=0 >
-
 
42
	<tbody >	
-
 
43
		<tr>
-
 
44
			<th class="thBasicACC">
-
 
45
				<?echo "$l_title";?>
-
 
46
			</th>
-
 
47
		</tr>
-
 
48
		<tr bgcolor="#FFCC66" class="trSizeACC">
-
 
49
			<td class="tdSizeACC">
41
		<div class="panel">
50
				<img src="/images/pix.gif" width=1 height=2>
42
			<div class="panel-header"><?= $l_title ?></div>
51
			</td>
-
 
52
		</tr>
-
 
53
	</tbody>
-
 
54
</table>
-
 
55
<div class="frameBorderACC">
43
			<div class="panel-row">
56
<div class="btn-group btn-group-justified" role="group" aria-label="Justified button group"> 
44
				<div class="btn-group btn-group-justified" role="group" aria-label="Justified button group"> 
57
	<a href="security.php?tab=1" class="btn btn-default<?= (($tab === 1) ? ' active' : '') ?>" role="button"><?= $l_spoofing ?></a>
45
					<a href="security.php?tab=1" class="btn btn-default<?= (($tab === 1) ? ' active' : '') ?>" role="button"><?= $l_spoofing ?></a>
58
	<a href="security.php?tab=2" class="btn btn-default<?= (($tab === 2) ? ' active' : '') ?>" role="button"><?= $l_virus ?></a>
46
					<a href="security.php?tab=2" class="btn btn-default<?= (($tab === 2) ? ' active' : '') ?>" role="button"><?= $l_virus ?></a>
59
	<a href="security.php?tab=3" class="btn btn-default<?= (($tab === 3) ? ' active' : '') ?>" role="button"><?= $l_fail2ban ?></a>
47
					<a href="security.php?tab=3" class="btn btn-default<?= (($tab === 3) ? ' active' : '') ?>" role="button"><?= $l_fail2ban ?></a>
60
</div>
48
				</div>
61
<br>
-
 
62
<?php
49
<?php
63
if ($tab === 1) {
50
if ($tab === 1) {
64
	$spoofs = [];
51
	$spoofs = [];
65
	$regex = '/^\[(?P<date>[0-9\/\-: ]+)\] : alcasar-watchdog : (?P<ip>(?:(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])) is usurped \((?P<mac>(?:[0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2})\)\. Alcasar disconnect the user \((?P<user>.+)\)\.$/';
52
	$regex = '/^\[(?P<date>[0-9\/\-: ]+)\] : alcasar-watchdog : (?P<ip>(?:(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])) is usurped \((?P<mac>(?:[0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2})\)\. Alcasar disconnect the user \((?P<user>.+)\)\.$/';
66
	$file = fopen('/var/Save/security/watchdog.log', 'r');
53
	$file = fopen('/var/Save/security/watchdog.log', 'r');
Line 82... Line 69...
82
		}
69
		}
83
		fclose($file);
70
		fclose($file);
84
	}
71
	}
85
	$spoofs = array_reverse($spoofs);
72
	$spoofs = array_reverse($spoofs);
86
?>
73
?>
87
<h3 style="text-align: center;"><?= $l_spoofing ?></h3>
74
			<h3><?= $l_spoofing ?></h3>
88
	<div class="container">
75
			<div class="container">
89
		<table style='font-family: "DejaVu Sans";font-size: small;color: #666650;' class="table table-striped  tableBis table-hover" border="1">		
76
				<table class="table table-striped table-hover" border="1">
90
				<tr>
77
				<tr>
91
					<th class="thSecurityBis" >
78
					<th>
92
						Date
79
						Date
93
					</th>
80
					</th>
94
					<th class="thSecurityBis">
81
					<th>
95
						<?= $l_ipAddress ?>	
82
						<?= $l_ipAddress ?>	
96
					</th>
83
					</th>
97
					<th class="thSecurityBis">
84
					<th>
98
						MAC
85
						MAC
99
					</th>
86
					</th>
100
					<th class="thSecurityBis">
87
					<th>
101
						<?= $l_user ?>
88
						<?= $l_user ?>
102
					</th>
89
					</th>
103
				</tr>
90
				</tr>
104
			<tbody>
91
				<tbody>
105
				<?php if (!empty($spoofs)): ?>
92
					<?php if (!empty($spoofs)): ?>
106
					<?php foreach ($spoofs as $spoof): ?>
93
					<?php foreach ($spoofs as $spoof): ?>
107
						<tr><td><?= $spoof->date ?></td><td><?= $spoof->ip ?></td><td><?= $spoof->mac ?></td><td><?= $spoof->user ?></td></tr>
94
					<tr><td><?= $spoof->date ?></td><td><?= $spoof->ip ?></td><td><?= $spoof->mac ?></td><td><?= $spoof->user ?></td></tr>
108
					<?php endforeach; ?>
95
					<?php endforeach; ?>
109
				<?php else: ?>
96
					<?php else: ?>
110
					<tr><td colspan="4" style="text-align: center;"><?= $l_empty ?></td></tr>
97
					<tr><td colspan="4" style="text-align: center;"><?= $l_empty ?></td></tr>
111
				<?php endif; ?>
98
					<?php endif; ?>
112
			</tbody>
99
				</tbody>
113
		</table>
100
				</table>
114
	</div>
101
			</div>
115
<?php
102
<?php
116
} else if ($tab === 2) {
103
} else if ($tab === 2) {
117
	$filePath = '/var/log/havp/access.log';
104
	$filePath = '/var/log/havp/access.log';
118
	$lines = file($filePath);
105
	$lines = file($filePath);
119
	if ($lines === false) {
106
	if ($lines === false) {
120
		exit("Cannot open '$filePath'.");
107
		exit("Cannot open '$filePath'.");
121
	}
108
	}
122
 
-
 
123
	$lines = array_reverse($lines);
109
	$lines = array_reverse($lines);
124
?>
110
?>
125
	<h3 style="text-align: center;"><?= $l_virus ?></h3>
111
	<h3><?= $l_virus ?></h3>
126
	<div class="container">
112
	<div class="container">
127
 
-
 
128
		<table class="table table-striped table-hover">
113
		<table class="table table-striped table-hover">
129
			<tbody>
114
			<tbody>
130
				<?php if (!empty($lines)): ?>
115
				<?php if (!empty($lines)): ?>
131
					<?php foreach ($lines as $line): ?>
116
					<?php foreach ($lines as $line): ?>
132
						<tr><td><?= $line ?></td></tr>
117
						<tr><td><?= $line ?></td></tr>
Line 166... Line 151...
166
		}
151
		}
167
		fclose($file);
152
		fclose($file);
168
	}
153
	}
169
	$bans = array_reverse($bans);
154
	$bans = array_reverse($bans);
170
?>
155
?>
171
	<h3 style="text-align: center;"><?= $l_fail2ban ?></h3>
156
	<h3><?= $l_fail2ban ?></h3>
172
	<div class="container" border="1">
157
	<div class="container" border="1">
173
		<table  class="table tableBis table-striped table-hover" border="1">
158
		<table  class="table table-striped table-hover" border="1">
174
				<tr >
159
				<tr >
175
					<th class="thSecurityBis" >
160
					<th>
176
						Date
161
						Date
177
					</th>
162
					</th>
178
					<th class="thSecurityBis" >
163
					<th>
179
						Date Unban
164
						Date Unban
180
					</th>
165
					</th>
181
					<th class="thSecurityBis" >
166
					<th>
182
						<?= $l_rule ?>
167
						<?= $l_rule ?>
183
					</th>
168
					</th>
184
					<th class="thSecurityBis" >
169
					<th>
185
						<?= $l_ipAddress ?>
170
						<?= $l_ipAddress ?>
186
					</th>
171
					</th>
187
				</tr>
172
				</tr>
188
				<?php if (!empty($bans)): ?>
173
				<?php if (!empty($bans)): ?>
189
					<?php foreach ($bans as $ban): ?>
174
					<?php foreach ($bans as $ban): ?>
Line 210... Line 195...
210
<?php
195
<?php
211
} else {
196
} else {
212
	echo 'Unknown tab';
197
	echo 'Unknown tab';
213
}
198
}
214
?>
199
?>
-
 
200
	</div>
215
</div>
201
</div>
216
</body>
202
</body>
217
</html>
203
</html>