324 |
richard |
1 |
<?php
|
|
|
2 |
require('/etc/freeradius-web/config.php');
|
|
|
3 |
require('../lib/attrshow.php');
|
|
|
4 |
require('../lib/sql/nas_list.php');
|
|
|
5 |
require_once('../lib/xlat.php');
|
|
|
6 |
?>
|
|
|
7 |
<html>
|
|
|
8 |
<?php
|
|
|
9 |
|
|
|
10 |
if (is_file("../lib/sql/drivers/$config[sql_type]/functions.php"))
|
|
|
11 |
include_once("../lib/sql/drivers/$config[sql_type]/functions.php");
|
|
|
12 |
else{
|
|
|
13 |
echo <<<EOM
|
|
|
14 |
<title>Failed logins</title>
|
|
|
15 |
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
|
|
|
16 |
<link rel="stylesheet" href="style.css">
|
|
|
17 |
</head>
|
|
|
18 |
<body>
|
|
|
19 |
<center>
|
|
|
20 |
<b>Could not include SQL library functions. Aborting</b>
|
|
|
21 |
</body>
|
|
|
22 |
</html>
|
|
|
23 |
EOM;
|
|
|
24 |
exit();
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
$now = time();
|
|
|
28 |
if (!isset($last))
|
|
|
29 |
$last = ($config[general_most_recent_fl]) ? $config[general_most_recent_fl] : 5;
|
|
|
30 |
if (!is_numeric($last))
|
|
|
31 |
$last = 5;
|
|
|
32 |
$start = $now - ($last*60);
|
|
|
33 |
$now_str = date($config[sql_full_date_format],$now);
|
|
|
34 |
$prev_str = date($config[sql_full_date_format],$start);
|
|
|
35 |
|
|
|
36 |
$now_str = da_sql_escape_string($now_str);
|
|
|
37 |
$prev_str = da_sql_escape_string($prev_str);
|
|
|
38 |
|
|
|
39 |
$pagesize = ($pagesize) ? $pagesize : 10;
|
|
|
40 |
if (!is_numeric($pagesize) && $pagesize != 'all')
|
|
|
41 |
$pagesize = 10;
|
|
|
42 |
$limit = ($pagesize == 'all') ? '' : "$pagesize";
|
|
|
43 |
$selected[$pagesize] = 'selected';
|
|
|
44 |
$order = ($order != '') ? $order : $config[general_accounting_info_order];
|
|
|
45 |
if ($order != 'desc' && $order != 'asc')
|
|
|
46 |
$order = 'desc';
|
|
|
47 |
$selected[$order] = 'selected';
|
|
|
48 |
if ($callerid != ''){
|
|
|
49 |
$callerid = da_sql_escape_string($callerid);
|
|
|
50 |
$callerid_str = "AND callingstationid = '$callerid'";
|
|
|
51 |
}
|
|
|
52 |
if ($server != '' && $server != 'all'){
|
|
|
53 |
$server = da_sql_escape_string($server);
|
|
|
54 |
$server_str = "AND nasipaddress = '$server'";
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
unset($da_name_cache);
|
|
|
58 |
if (isset($_SESSION['da_name_cache']))
|
|
|
59 |
$da_name_cache = $_SESSION['da_name_cache'];
|
|
|
60 |
|
|
|
61 |
?>
|
|
|
62 |
|
|
|
63 |
<head>
|
|
|
64 |
<title>Authentifications manquées</title>
|
|
|
65 |
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>">
|
|
|
66 |
<link rel="stylesheet" href="style.css">
|
|
|
67 |
</head>
|
|
|
68 |
<body>
|
|
|
69 |
<center>
|
|
|
70 |
<table border=0 width=550 cellpadding=0 cellspacing=0>
|
|
|
71 |
<tr valign=top>
|
|
|
72 |
<!--<td align=center><img src="images/title2.gif"></td>-->
|
|
|
73 |
</tr>
|
|
|
74 |
</table>
|
|
|
75 |
<table border=0 width=400 cellpadding=0 cellspacing=2>
|
|
|
76 |
</table>
|
|
|
77 |
<br>
|
|
|
78 |
<table border=0 width=840 cellpadding=1 cellspacing=1>
|
|
|
79 |
<tr valign=top>
|
|
|
80 |
<td width=65%></td>
|
|
|
81 |
<td bgcolor="black" width=35%>
|
|
|
82 |
<table border=0 width=100% cellpadding=2 cellspacing=0>
|
|
|
83 |
<tr bgcolor="#907030" align=right valign=top><th>
|
|
|
84 |
<font color="white">Authentificatins manquées</font>
|
|
|
85 |
</th></tr>
|
|
|
86 |
</table>
|
|
|
87 |
</td></tr>
|
|
|
88 |
<tr bgcolor="black" valign=top><td colspan=2>
|
|
|
89 |
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
|
|
|
90 |
<tr><td>
|
|
|
91 |
<?php
|
|
|
92 |
echo <<<EOM
|
|
|
93 |
<b>$prev_str</b> up to <b>$now_str</b>
|
|
|
94 |
EOM;
|
|
|
95 |
?>
|
|
|
96 |
|
|
|
97 |
<p>
|
|
|
98 |
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
|
|
|
99 |
<tr bgcolor="#d0ddb0">
|
|
|
100 |
<th>#</th><th>login</th>
|
|
|
101 |
<?php
|
|
|
102 |
if ($acct_attrs['fl'][2] != '') echo "<th>" . $acct_attrs['fl'][2] . "</th>\n";
|
|
|
103 |
if ($acct_attrs['fl'][7] != '') echo "<th>" . $acct_attrs['fl'][7] . "</th>\n";
|
|
|
104 |
if ($acct_attrs['fl'][8] != '') echo "<th>" . $acct_attrs['fl'][8] . "</th>\n";
|
|
|
105 |
if ($acct_attrs['fl'][9] != '') echo "<th>" . $acct_attrs['fl'][9] . "</th>\n";
|
|
|
106 |
unset($sql_extra_query);
|
|
|
107 |
if ($config[sql_accounting_extra_query] != ''){
|
|
|
108 |
$sql_extra_query = xlat($config[sql_accounting_extra_query],$login,$config);
|
|
|
109 |
$sql_extra_query = da_sql_escape_string($sql_extra_query);
|
|
|
110 |
}
|
|
|
111 |
?>
|
|
|
112 |
</tr>
|
|
|
113 |
|
|
|
114 |
<?php
|
|
|
115 |
$link = @da_sql_pconnect($config);
|
|
|
116 |
if ($link){
|
|
|
117 |
$search = @da_sql_query($link,$config,
|
|
|
118 |
"SELECT " . da_sql_limit($limit,0,$config) . " acctstoptime,username,nasipaddress,nasportid,acctterminatecause,callingstationid
|
|
|
119 |
FROM $config[sql_accounting_table]
|
|
|
120 |
WHERE acctstoptime <= '$now_str' AND acctstoptime >= '$prev_str'
|
|
|
121 |
AND (acctterminatecause LIKE 'Login-Incorrect%' OR
|
|
|
122 |
acctterminatecause LIKE 'Invalid-User%' OR
|
|
|
123 |
acctterminatecause LIKE 'Multiple-Logins%') $callerid_str $server_str $sql_extra_query " . da_sql_limit($limit,1,$config) .
|
|
|
124 |
" ORDER BY acctstoptime $order " . da_sql_limit($limit,2,$config) . " ;");
|
|
|
125 |
if ($search){
|
|
|
126 |
while( $row = @da_sql_fetch_array($search,$config) ){
|
|
|
127 |
$num++;
|
|
|
128 |
$acct_login = $row[username];
|
|
|
129 |
if ($acct_login == '')
|
|
|
130 |
$acct_login = '-';
|
|
|
131 |
else
|
|
|
132 |
$acct_login = "<a href=\"user_admin.php?login=$acct_login\" title=\"Editer l'utilisateur $acct_login\">$acct_login</a>";
|
|
|
133 |
$acct_time = $row[acctstoptime];
|
|
|
134 |
$acct_server = $row[nasipaddress];
|
|
|
135 |
if ($acct_server != ''){
|
|
|
136 |
$acct_server = $da_name_cache[$acct_server];
|
|
|
137 |
if (!isset($acct_server)){
|
|
|
138 |
$acct_server = $row[nasipaddress];
|
|
|
139 |
$acct_server = @gethostbyaddr($acct_server);
|
|
|
140 |
if (!isset($da_name_cache) && $config[general_use_session] == 'yes'){
|
|
|
141 |
$da_name_cache[$row[nasipaddress]] = $acct_server;
|
|
|
142 |
session_register('da_name_cache');
|
|
|
143 |
}
|
|
|
144 |
else
|
|
|
145 |
$da_name_cache[$row[nasipaddress]] = $acct_server;
|
|
|
146 |
}
|
|
|
147 |
}
|
|
|
148 |
else
|
|
|
149 |
$acct_server = '-';
|
|
|
150 |
$acct_server = "$acct_server:$row[nasportid]";
|
|
|
151 |
$acct_terminate_cause = "$row[acctterminatecause]";
|
|
|
152 |
if ($acct_terminate_cause == '')
|
|
|
153 |
$acct_terminate_cause = '-';
|
|
|
154 |
$acct_callerid = "$row[callingstationid]";
|
|
|
155 |
if ($acct_callerid == '')
|
|
|
156 |
$acct_callerid = '-';
|
|
|
157 |
echo <<<EOM
|
|
|
158 |
<tr align=center bgcolor="white">
|
|
|
159 |
<td>$num</td>
|
|
|
160 |
<td>$acct_login</td>
|
|
|
161 |
EOM;
|
|
|
162 |
if ($acct_attrs['fl'][2] != '') echo "<td>$acct_time</td>\n";
|
|
|
163 |
if ($acct_attrs['fl'][2] != '') echo "<td>$acct_server</td>\n";
|
|
|
164 |
if ($acct_attrs['fl'][2] != '') echo "<td>$acct_terminate_cause</td>\n";
|
|
|
165 |
if ($acct_attrs['fl'][2] != '') echo "<td>$acct_callerid</td>\n";
|
|
|
166 |
echo "</tr>\n";
|
|
|
167 |
}
|
|
|
168 |
}
|
|
|
169 |
else
|
|
|
170 |
echo "<b>Database query failed: " . da_sql_error($link,$config) . "</b><br>\n";
|
|
|
171 |
}
|
|
|
172 |
else
|
|
|
173 |
echo "<b>Could not connect to SQL database</b><br>\n";
|
|
|
174 |
echo <<<EOM
|
|
|
175 |
</table>
|
|
|
176 |
<tr><td>
|
|
|
177 |
<hr>
|
|
|
178 |
<tr><td align="left">
|
|
|
179 |
<form action="failed_logins.php" method="get" name="master">
|
|
|
180 |
<table border=0>
|
|
|
181 |
<tr valign="bottom">
|
|
|
182 |
<td><small><b>time back (mins)</td><td><small><b>pagesize</td><td><small><b>caller id</td><td><b>order</td>
|
|
|
183 |
<tr valign="middle"><td>
|
|
|
184 |
<input type="text" name="last" size="11" value="$last"></td>
|
|
|
185 |
<td><select name="pagesize">
|
|
|
186 |
<option $selected[5] value="5" >05
|
|
|
187 |
<option $selected[10] value="10">10
|
|
|
188 |
<option $selected[15] value="15">15
|
|
|
189 |
<option $selected[20] value="20">20
|
|
|
190 |
<option $selected[40] value="40">40
|
|
|
191 |
<option $selected[80] value="80">80
|
|
|
192 |
<option $selected[all] value="all">all
|
|
|
193 |
</select>
|
|
|
194 |
</td>
|
|
|
195 |
<td>
|
|
|
196 |
<input type="text" name="callerid" size="11" value="$callerid"></td>
|
|
|
197 |
<td><select name="order">
|
|
|
198 |
<option $selected[asc] value="asc">older first
|
|
|
199 |
<option $selected[desc] value="desc">recent first
|
|
|
200 |
</select>
|
|
|
201 |
</td>
|
|
|
202 |
EOM;
|
|
|
203 |
?>
|
|
|
204 |
|
|
|
205 |
<td><input type="submit" class=button value="show"></td></tr>
|
|
|
206 |
<tr><td>
|
|
|
207 |
<b>Sur le serveur d'acc&eagrave; :</b>
|
|
|
208 |
</td></tr><tr><td>
|
|
|
209 |
<select name="server">
|
|
|
210 |
<?php
|
|
|
211 |
foreach ($nas_list as $nas){
|
|
|
212 |
$name = $nas[name];
|
|
|
213 |
if ($nas[ip] == '')
|
|
|
214 |
continue;
|
|
|
215 |
$servers[$name] = $nas[ip];
|
|
|
216 |
}
|
|
|
217 |
ksort($servers);
|
|
|
218 |
foreach ($servers as $name => $ip){
|
|
|
219 |
if ($server == $ip)
|
|
|
220 |
echo "<option selected value=\"$ip\">$name\n";
|
|
|
221 |
else
|
|
|
222 |
echo "<option value=\"$ip\">$name\n";
|
|
|
223 |
}
|
|
|
224 |
if ($server == '' || $server == 'all')
|
|
|
225 |
echo "<option selected value=\"all\">all\n";
|
|
|
226 |
else
|
|
|
227 |
echo "<option value=\"all\">all\n";
|
|
|
228 |
?>
|
|
|
229 |
</select>
|
|
|
230 |
</td></tr>
|
|
|
231 |
</table></td></tr></form>
|
|
|
232 |
</table>
|
|
|
233 |
</tr>
|
|
|
234 |
</table>
|
|
|
235 |
</body>
|
|
|
236 |
</html>
|