Projet

Général

Profil

Télécharger (22,5 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / diag_logs_filter.php @ 481b97b0

1
<?php
2
/* $Id$ */
3
/*
4
	diag_logs_filter.php
5
	part of pfSense 
6
	Copyright (C) 2004-2009 Scott Ullrich
7
	originally based on m0n0wall (http://m0n0.ch/wall)
8

    
9
	Copyright (C) 2003-2009 Manuel Kasper <mk@neon1.net>,
10
	Jim Pingle jim@pingle.org
11
	All rights reserved.
12

    
13
	Redistribution and use in source and binary forms, with or without
14
	modification, are permitted provided that the following conditions are met:
15

    
16
	1. Redistributions of source code must retain the above copyright notice,
17
	   this list of conditions and the following disclaimer.
18

    
19
	2. Redistributions in binary form must reproduce the above copyright
20
	   notice, this list of conditions and the following disclaimer in the
21
	   documentation and/or other materials provided with the distribution.
22

    
23
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
27
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
	POSSIBILITY OF SUCH DAMAGE.
33
*/
34

    
35
/*		
36
	pfSense_MODULE:	filter
37
*/
38

    
39
##|+PRIV
40
##|*IDENT=page-diagnostics-logs-firewall
41
##|*NAME=Diagnostics: Logs: Firewall page
42
##|*DESCR=Allow access to the 'Diagnostics: Logs: Firewall' page.
43
##|*MATCH=diag_logs_filter.php*
44
##|-PRIV
45

    
46
require("guiconfig.inc");
47
require_once("filter_log.inc");
48

    
49
# --- AJAX RESOLVE ---
50
if (isset($_POST['resolve'])) {
51
	$ip = strtolower($_POST['resolve']);
52
	$res = (is_ipaddr($ip) ? gethostbyaddr($ip) : '');
53
	
54
	if ($res && $res != $ip)
55
		$response = array('resolve_ip' => $ip, 'resolve_text' => $res);
56
	else
57
		$response = array('resolve_ip' => $ip, 'resolve_text' => gettext("Cannot resolve"));
58
	
59
	echo json_encode(str_replace("\\","\\\\", $response)); // single escape chars can break JSON decode
60
	exit;
61
}
62

    
63
function getGETPOSTsettingvalue($settingname, $default)
64
{
65
	$settingvalue = $default;
66
	if($_GET[$settingname])
67
		$settingvalue = $_GET[$settingname];
68
	if($_POST[$settingname])
69
		$settingvalue = $_POST[$settingname];
70
	return $settingvalue;
71
}
72

    
73
$rulenum = getGETPOSTsettingvalue('getrulenum', null);
74
if($rulenum) {
75
	list($rulenum, $tracker, $type) = explode(',', $rulenum);
76
	$rule = find_rule_by_number($rulenum, $tracker, $type);
77
	echo gettext("The rule that triggered this action is") . ":\n\n{$rule}";
78
	exit;
79
}
80

    
81
$filtersubmit = getGETPOSTsettingvalue('filtersubmit', null);
82
if ($filtersubmit) {
83
	$interfacefilter = getGETPOSTsettingvalue('interface', null);
84
	$filtertext = getGETPOSTsettingvalue('filtertext', "");
85
	$filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
86
}
87

    
88
$filterlogentries_submit = getGETPOSTsettingvalue('filterlogentries_submit', null);
89
if ($filterlogentries_submit) {
90
	$filterfieldsarray = array("act", "time", "interface", "srcip", "srcport", "dstip", "dstport", "proto", "tcpflags");
91

    
92
	$actpass = getGETPOSTsettingvalue('actpass', null);
93
	$actblock = getGETPOSTsettingvalue('actblock', null);
94
	$actreject = getGETPOSTsettingvalue('actreject', null);
95

    
96
	$filterfieldsarray['act'] = trim($actpass . " " . $actblock . " " . $actreject);
97
	$filterfieldsarray['act'] = $filterfieldsarray['act'] ? $filterfieldsarray['act'] : 'All';
98
	$filterfieldsarray['time'] = getGETPOSTsettingvalue('filterlogentries_time', null);
99
	$filterfieldsarray['interface'] = getGETPOSTsettingvalue('filterlogentries_interfaces', null);
100
	$filterfieldsarray['srcip'] = getGETPOSTsettingvalue('filterlogentries_sourceipaddress', null);
101
	$filterfieldsarray['srcport'] = getGETPOSTsettingvalue('filterlogentries_sourceport', null);
102
	$filterfieldsarray['dstip'] = getGETPOSTsettingvalue('filterlogentries_destinationipaddress', null);
103
	$filterfieldsarray['dstport'] = getGETPOSTsettingvalue('filterlogentries_destinationport', null);
104
	$filterfieldsarray['proto'] = getGETPOSTsettingvalue('filterlogentries_protocol', null);
105
	$filterfieldsarray['tcpflags'] = getGETPOSTsettingvalue('filterlogentries_protocolflags', null);
106
	$filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
107
}
108

    
109
$filter_logfile = "{$g['varlog_path']}/filter.log";
110

    
111
$nentries = $config['syslog']['nentries'];
112

    
113
# Override Display Quantity
114
if ($filterlogentries_qty)
115
	$nentries = $filterlogentries_qty;
116

    
117
if (!$nentries)
118
	$nentries = 50;
119

    
120
if ($_POST['clear'])
121
	clear_log_file($filter_logfile);
122

    
123
$pgtitle = array(gettext("Status"),gettext("System logs"),gettext("Firewall"));
124
$shortcut_section = "firewall";
125
include("head.inc");
126

    
127
?>
128
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
129
<script src="/javascript/filter_log.js" type="text/javascript"></script>
130
<?php include("fbegin.inc"); ?>
131
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="logs filter">
132
  <tr><td>
133
<?php
134
	$tab_array = array();
135
	$tab_array[] = array(gettext("System"), false, "diag_logs.php");
136
	$tab_array[] = array(gettext("Firewall"), true, "diag_logs_filter.php");
137
	$tab_array[] = array(gettext("DHCP"), false, "diag_logs_dhcp.php");
138
	$tab_array[] = array(gettext("Portal Auth"), false, "diag_logs_auth.php");
139
	$tab_array[] = array(gettext("IPsec"), false, "diag_logs_ipsec.php");
140
	$tab_array[] = array(gettext("PPP"), false, "diag_logs_ppp.php");
141
	$tab_array[] = array(gettext("VPN"), false, "diag_logs_vpn.php");
142
	$tab_array[] = array(gettext("Load Balancer"), false, "diag_logs_relayd.php");
143
	$tab_array[] = array(gettext("OpenVPN"), false, "diag_logs_openvpn.php");
144
	$tab_array[] = array(gettext("NTP"), false, "diag_logs_ntpd.php");
145
	$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
146
	display_top_tabs($tab_array);
147
?>
148
 </td></tr>
149
  <tr><td class="tabnavtbl">
150
<?php
151
	$tab_array = array();
152
	$tab_array[] = array(gettext("Normal View"), true, "/diag_logs_filter.php");
153
	$tab_array[] = array(gettext("Dynamic View"), false, "/diag_logs_filter_dynamic.php");
154
	$tab_array[] = array(gettext("Summary View"), false, "/diag_logs_filter_summary.php");
155
	display_top_tabs($tab_array);
156
?>
157
		</td>
158
	</tr>
159
  <tr>
160
    <td>
161
	<div id="mainarea">
162
		<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" sortableMultirow="<?=$config['syslog']['filterdescriptions'] === "2"?2:1?>" summary="main area">
163
			<thead>
164
			<tr>
165
				<td colspan="<?=(!isset($config['syslog']['rawfilter']))?7:2?>" align="left" valign="middle">
166
				<div id="filterlogentries_show" class="widgetconfigdiv" style=<?=(!isset($config['syslog']['rawfilter']))?"":"display:none"?>>
167
					<form id="filterlogentries" name="filterlogentries" action="diag_logs_filter.php" method="post">
168
						<?php 
169
							$Include_Act = explode(",", str_replace(" ", ",", $filterfieldsarray['act']));
170
							if ($filterfieldsarray['interface'] == "All") $interface = "";
171
						?>
172
					<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="action">
173
					<tr>
174
						<td rowspan="2">
175
							<div align="center"><?=gettext("Action");?></div>
176
							<div align="left">
177
							<input id="actpass"   name="actpass"   type="checkbox" value="Pass"   <?php if (in_arrayi('Pass',   $Include_Act)) echo "checked=\"checked\""; ?> /> Pass<br />
178
							<input id="actblock"  name="actblock"  type="checkbox" value="Block"  <?php if (in_arrayi('Block',  $Include_Act)) echo "checked=\"checked\""; ?> /> Block<br />
179
							<input id="actreject" name="actreject" type="checkbox" value="Reject" <?php if (in_arrayi('Reject', $Include_Act)) echo "checked=\"checked\""; ?> /> Reject<br />
180
							</div>
181
						</td>
182
						<td>
183
							<div align="center"><?=gettext("Time");?></div>
184
							<div align="center"><input id="filterlogentries_time" name="filterlogentries_time" class="formfld search" type="text" size="12" value="<?= $filterfieldsarray['time'] ?>" /></div>
185
						</td>
186
						<td>
187
							<div align="center"><?=gettext("Source IP Address");?></div>
188
							<div align="center"><input id="filterlogentries_sourceipaddress" name="filterlogentries_sourceipaddress" class="formfld search" type="text" size="35" value="<?= $filterfieldsarray['srcip'] ?>" /></div>
189
						</td>
190
						<td>
191
							<div align="center"><?=gettext("Source Port");?></div>
192
							<div align="center"><input id="filterlogentries_sourceport" name="filterlogentries_sourceport" class="formfld search" type="text" size="10" value="<?= $filterfieldsarray['srcport'] ?>" /></div>
193
						</td>
194
						<td>
195
							<div align="center"><?=gettext("Protocol");?></div>
196
							<div align="center"><input id="filterlogentries_protocol" name="filterlogentries_protocol" class="formfld search" type="text" size="5" value="<?= $filterfieldsarray['proto'] ?>" /></div>
197
						</td>
198
						<td>
199
							<div align="center" style="vertical-align:top;"><?=gettext("Quantity");?></div>
200
							<div align="center" style="vertical-align:top;"><input id="filterlogentries_qty" name="filterlogentries_qty" class="" type="text" size="6" value="<?= $filterlogentries_qty ?>" /></div>
201
						</td>
202
					</tr>
203
					<tr>
204
						<td valign="top">
205
							<div align="center"><?=gettext("Interface");?></div>
206
							<div align="center"><input id="filterlogentries_interfaces" name="filterlogentries_interfaces" class="formfld search" type="text" size="12" value="<?= $filterfieldsarray['interface'] ?>" /></div>
207
						</td>
208
						<td valign="top">
209
							<div align="center"><?=gettext("Destination IP Address");?></div>
210
							<div align="center"><input id="filterlogentries_destinationipaddress" name="filterlogentries_destinationipaddress" class="formfld search" type="text" size="35" value="<?= $filterfieldsarray['dstip'] ?>" /></div>
211
						</td>
212
						<td valign="top">
213
							<div align="center"><?=gettext("Destination Port");?></div>
214
							<div align="center"><input id="filterlogentries_destinationport" name="filterlogentries_destinationport" class="formfld search" type="text" size="10" value="<?= $filterfieldsarray['dstport'] ?>" /></div>
215
						</td>
216
						<td valign="top">
217
							<div align="center"><?=gettext("Protocol Flags");?></div>
218
							<div align="center"><input id="filterlogentries_protocolflags" name="filterlogentries_protocolflags" class="formfld search" type="text" size="5" value="<?= $filterfieldsarray['tcpflags'] ?>" /></div>
219
						</td>
220
						<td valign="bottom">
221
							<div align="center"><input id="filterlogentries_submit" name="filterlogentries_submit" type="submit" class="formbtn" value="<?=gettext("Filter");?>" /></div>
222
						</td>
223
					</tr>
224
					<tr>
225
						<td></td>
226
						<td colspan="5">
227
							<?printf(gettext('Matches %1$s regular expression%2$s.'), '<a target="_blank" href="http://www.php.net/manual/en/book.pcre.php">', '</a>');?>&nbsp;&nbsp;
228
							<?=gettext("Precede with exclamation (!) as first character to exclude match.");?>&nbsp;&nbsp;
229
						</td>
230
					</tr>
231
					</table>
232
					</form>
233
				</div>
234
				<div id="filterform_show" class="widgetconfigdiv" style=<?=(!isset($config['syslog']['rawfilter']))?"display:none":""?>>
235
					<form id="filterform" name="filterform" action="diag_logs_filter.php" method="post">
236
					<table width="0%" border="0" cellpadding="0" cellspacing="0" summary="firewall log">
237
					<tr>
238
						<td>
239
							<div align="center" style="vertical-align:top;"><?=gettext("Interface");?></div>
240
							<div align="center" style="vertical-align:top;">
241
							<select name="interface" onChange="dst_change(this.value,iface_old,document.iform.dsttype.value);iface_old = document.iform.interface.value;typesel_change();">
242
							<option value="" <?=$interfacefilter?"":"selected=\"selected\""?>>*Any interface</option>
243
							<?php						
244
							$iflist = get_configured_interface_with_descr(false, true);
245
							//$iflist = get_interface_list();
246
							// Allow extending of the firewall edit interfaces 
247
							pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/pre_interfaces_edit");
248
							foreach ($iflist as $if => $ifdesc)
249
								$interfaces[$if] = $ifdesc;
250

    
251
							if ($config['l2tp']['mode'] == "server")
252
								$interfaces['l2tp'] = "L2TP VPN";
253

    
254
							if ($config['pptpd']['mode'] == "server")
255
								$interfaces['pptp'] = "PPTP VPN";
256

    
257
							if (is_pppoe_server_enabled() && have_ruleint_access("pppoe"))
258
								$interfaces['pppoe'] = "PPPoE VPN";
259

    
260
							/* add ipsec interfaces */
261
							if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable']))
262
								$interfaces["enc0"] = "IPsec";
263

    
264
							/* add openvpn/tun interfaces */
265
							if  ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
266
								$interfaces["openvpn"] = "OpenVPN";
267

    
268
							foreach ($interfaces as $iface => $ifacename): ?>
269
							<option value="<?=$iface;?>" <?=($iface==$interfacefilter)?"selected=\"selected\"":"";?>><?=htmlspecialchars($ifacename);?></option>
270
							<?php endforeach; ?>
271
							</select>
272
							</div>
273
						</td>
274
						<td>
275
							<div align="center" style="vertical-align:top;"><?=gettext("Filter expression");?></div>
276
							<div align="center" style="vertical-align:top;"><input id="filtertext" name="filtertext" class="formfld search" style="vertical-align:top;" type="text" size="35" value="<?=$filtertext?>" /></div>
277
						</td>
278
						<td>
279
							<div align="center" style="vertical-align:top;"><?=gettext("Quantity");?></div>
280
							<div align="center" style="vertical-align:top;"><input id="filterlogentries_qty" name="filterlogentries_qty" class="" style="vertical-align:top;" type="text" size="6" value="<?= $filterlogentries_qty ?>" /></div>
281
						</td>
282
						<td>
283
							<div align="center" style="vertical-align:top;">&nbsp;</div>
284
							<div align="center" style="vertical-align:top;"><input id="filtersubmit" name="filtersubmit" type="submit" class="formbtn" style="vertical-align:top;" value="<?=gettext("Filter");?>" /></div>
285
						</td>
286
					</tr>
287
					<tr>
288
						<td></td>
289
						<td colspan="2">
290
							<?printf(gettext('Matches %1$s regular expression%2$s.'), '<a target="_blank" href="http://www.php.net/manual/en/book.pcre.php">', '</a>');?>&nbsp;&nbsp;
291
						</td>
292
					</tr>
293
					</table>
294
					</form>
295
				</div>
296
				<div style="float: right; vertical-align:middle">
297
					<br />
298
					<?php if (!isset($config['syslog']['rawfilter']) && (isset($config['syslog']['filterdescriptions']) && $config['syslog']['filterdescriptions'] === "2")):?>
299
					<a href="#" onclick="toggleListDescriptions()">Show/hide rule descriptions</a>
300
					<?php endif;?>
301
				</div>
302
				</td>	
303
			</tr>
304
<?php if (!isset($config['syslog']['rawfilter'])):
305
	$iflist = get_configured_interface_with_descr(false, true);
306
	if ($iflist[$interfacefilter])
307
		$interfacefilter = $iflist[$interfacefilter];
308
	if ($filterlogentries_submit) 
309
		$filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100, $filterfieldsarray);
310
	else
311
		$filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100, $filtertext, $interfacefilter);
312
?>
313
			<tr>
314
			  <td colspan="<?=$config['syslog']['filterdescriptions']==="1"?7:6?>" class="listtopic">
315
				<?php if ( (!$filtertext) && (!$filterfieldsarray) )
316
					printf(gettext("Last %s firewall log entries."),count($filterlog));
317
				else
318
					echo count($filterlog). ' ' . gettext("matched log entries.");
319
			    printf(gettext("Max(%s)"),$nentries);?>
320
			  </td>
321
			</tr>
322
			<tr class="sortableHeaderRowIdentifier">
323
			  <td width="10%" class="listhdrr"><?=gettext("Act");?></ td>
324
			  <td width="10%" class="listhdrr"><?=gettext("Time");?></ td>
325
			  <td width="15%" class="listhdrr"><?=gettext("If");?></ td>
326
			  <?php if ($config['syslog']['filterdescriptions'] === "1"):?>
327
				<td width="10%" class="listhdrr"><?=gettext("Rule");?></ td>
328
			  <?php endif;?>
329
			  <td width="25%" class="listhdrr"><?=gettext("Source");?></ td>
330
			  <td width="25%" class="listhdrr"><?=gettext("Destination");?></ td>
331
			  <td width="15%" class="listhdrr"><?=gettext("Proto");?></ td>
332
			</tr>
333
			</thead>
334
			<?php
335
			if ($config['syslog']['filterdescriptions'])
336
				buffer_rules_load();
337
			$rowIndex = 0;
338
			foreach ($filterlog as $filterent): 
339
			$evenRowClass = $rowIndex % 2 ? " listMReven" : " listMRodd";
340
			$rowIndex++;?>
341
			<tr class="<?=$evenRowClass?>">
342
			  <td class="listMRlr nowrap" align="center" sorttable_customkey="<?=$filterent['act']?>">
343
			  <center>
344
			  <a onclick="javascript:getURL('diag_logs_filter.php?getrulenum=<?php echo "{$filterent['rulenum']},{$filterent['tracker']},{$filterent['act']}"; ?>', outputrule);">
345
			  <img border="0" src="<?php echo find_action_image($filterent['act']);?>" width="11" height="11" align="middle" alt="<?php echo $filterent['act'] .'/'. $filterent['tracker'];?>" title="<?php echo $filterent['act'] .'/'. $filterent['tracker'];?>" />
346
			  <?php if ($filterent['count']) echo $filterent['count'];?></a></center></td>
347
			  <td class="listMRr" nowrap="nowrap"><?php echo htmlspecialchars($filterent['time']);?></td>
348
			  <td class="listMRr" nowrap="nowrap">
349
				<?php if ($filterent['direction'] == "out"): ?>
350
				<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/out.gif" alt="Direction=OUT" title="Direction=OUT"/>
351
				<?php endif; ?>
352
				<?php echo htmlspecialchars($filterent['interface']);?></td>
353
			  <?php 
354
			  if ($config['syslog']['filterdescriptions'] === "1")
355
				echo("<td class=\"listMRr nowrap\">".find_rule_by_number_buffer($filterent['rulenum'],$filterent['tracker'],$filterent['act'])."</td>");
356
				
357
			  $int = strtolower($filterent['interface']);
358
			  $proto = strtolower($filterent['proto']);
359
			  if($filterent['version'] == '6') {
360
				$ipproto = "inet6";
361
				$filterent['srcip'] = "[{$filterent['srcip']}]";
362
				$filterent['dstip'] = "[{$filterent['dstip']}]";
363
			  } else {
364
			        $ipproto = "inet";
365
			  }
366

    
367
			  $srcstr = $filterent['srcip'] . get_port_with_service($filterent['srcport'], $proto);
368
			  $src_htmlclass = str_replace(array('.', ':'), '-', $filterent['srcip']);
369
			  $dststr = $filterent['dstip'] . get_port_with_service($filterent['dstport'], $proto);
370
			  $dst_htmlclass = str_replace(array('.', ':'), '-', $filterent['dstip']);
371
			  ?>
372
			  <td class="listMRr nowrap">
373
				<img onclick="javascript:resolve_with_ajax('<?php echo "{$filterent['srcip']}"; ?>');" title="<?=gettext("Click to resolve");?>" class="ICON-<?= $src_htmlclass; ?>" border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" alt="Icon Reverse Resolve with DNS"/>
374
				<a href="easyrule.php?<?php echo "action=block&amp;int={$int}&amp;src={$filterent['srcip']}&amp;ipproto={$ipproto}"; ?>" title="<?=gettext("Easy Rule: Add to Block List");?>" onclick="return confirm('<?=gettext("Do you really want to add this BLOCK rule?")."\n\n".gettext("Easy Rule is still experimental.")."\n".gettext("Continue at risk of your own peril.")."\n".gettext("Backups are also nice.")?>')">
375
				<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_block_add.gif" alt="Icon Easy Rule: Add to Block List" /></a>
376
				<?php echo $srcstr . '<span class="RESOLVE-' . $src_htmlclass . '"></span>';?>
377
			  </td>
378
			  <td class="listMRr nowrap">
379
				<img onclick="javascript:resolve_with_ajax('<?php echo "{$filterent['dstip']}"; ?>');" title="<?=gettext("Click to resolve");?>" class="ICON-<?= $dst_htmlclass; ?>" border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_log.gif" alt="Icon Reverse Resolve with DNS"/>
380
				<a href="easyrule.php?<?php echo "action=pass&amp;int={$int}&amp;proto={$proto}&amp;src={$filterent['srcip']}&amp;dst={$filterent['dstip']}&amp;dstport={$filterent['dstport']}&amp;ipproto={$ipproto}"; ?>" title="<?=gettext("Easy Rule: Pass this traffic");?>" onclick="return confirm('<?=gettext("Do you really want to add this PASS rule?")."\n\n".gettext("Easy Rule is still experimental.")."\n".gettext("Continue at risk of your own peril.")."\n".gettext("Backups are also nice.");?>')">
381
				<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_pass_add.gif" alt="Icon Easy Rule: Pass this traffic" /></a>
382
				<?php echo $dststr . '<span class="RESOLVE-' . $dst_htmlclass . '"></span>';?>
383
			  </td>
384
			  <?php
385
				if ($filterent['proto'] == "TCP")
386
					$filterent['proto'] .= ":{$filterent['tcpflags']}";
387
			  ?>
388
			  <td class="listMRr" nowrap="nowrap"><?php echo htmlspecialchars($filterent['proto']);?></td>
389
			</tr>
390
			<?php if (isset($config['syslog']['filterdescriptions']) && $config['syslog']['filterdescriptions'] === "2"):?>
391
			<tr class="<?=$evenRowClass?>">
392
			  <td colspan="2" class="listMRDescriptionL listMRlr" />
393
			  <td colspan="4" class="listMRDescriptionR listMRr nowrap"><?=find_rule_by_number_buffer($filterent['rulenum'],$filterent['tracker'],$filterent['act']);?></td>
394
			</tr>
395
			<?php endif;
396
			endforeach; 
397
			buffer_rules_clear(); ?>
398
<?php else: ?>
399
		  <tr>
400
			<td colspan="2" class="listtopic">
401
			  <?php printf(gettext("Last %s firewall log entries"),$nentries);?></td>
402
		  </tr>
403
		  <?php
404
			if($filtertext)
405
				dump_clog($filter_logfile, $nentries, true, array("$filtertext"));
406
			else
407
				dump_clog($filter_logfile, $nentries);
408
		  ?>
409
<?php endif; ?>
410
		<tfoot>
411
		<tr>
412
			<td align="left" valign="top" colspan="3">
413
				<form id="clearform" name="clearform" action="diag_logs_filter.php" method="post" style="margin-top: 14px;">
414
					<input id="submit" name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log");?>" />
415
				</form>
416
			</td>
417
		</tr>
418
		</tfoot>
419
		</table>
420
		</div>
421
	</td>
422
  </tr>
423
</table>
424

    
425
<p><span class="vexpl"><a href="https://doc.pfsense.org/index.php/What_are_TCP_Flags%3F">TCP Flags</a>: F - FIN, S - SYN, A or . - ACK, R - RST, P - PSH, U - URG, E - ECE, W - CWR</span></p>
426

    
427
<?php include("fend.inc"); ?>
428

    
429
<!-- AJAXY STUFF -->
430
<script type="text/javascript">
431

    
432
function resolve_with_ajax(ip_to_resolve) {
433
	var url = "/diag_logs_filter.php";
434

    
435
	jQuery.ajax(
436
		url,
437
		{
438
			type: 'post',
439
			dataType: 'json',
440
			data: {
441
				resolve: ip_to_resolve,
442
				},
443
			complete: resolve_ip_callback
444
		});
445

    
446
}
447

    
448
function resolve_ip_callback(transport) {
449
	var response = jQuery.parseJSON(transport.responseText);
450
	var resolve_class = htmlspecialchars(response.resolve_ip.replace(/[.:]/g, '-'));
451
	var resolve_text = '<small><br />' + htmlspecialchars(response.resolve_text) + '</small>';
452
	
453
	jQuery('span.RESOLVE-' + resolve_class).html(resolve_text);
454
	jQuery('img.ICON-' + resolve_class).removeAttr('title');
455
	jQuery('img.ICON-' + resolve_class).removeAttr('alt');
456
	jQuery('img.ICON-' + resolve_class).attr('src', '/themes/<?= $g['theme']; ?>/images/icons/icon_log_d.gif');
457
	jQuery('img.ICON-' + resolve_class).prop('onclick', null); 
458
	  // jQuery cautions that "removeAttr('onclick')" fails in some versions of IE
459
}
460

    
461
// From http://stackoverflow.com/questions/5499078/fastest-method-to-escape-html-tags-as-html-entities
462
function htmlspecialchars(str) {
463
    return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;');
464
}
465
</script>
466

    
467
</body>
468
</html>
(21-21/254)