Projet

Général

Profil

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

univnautes / usr / local / www / diag_logs_filter.php @ 99d55f5a

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" style="sortableMultirow:<?=$config['syslog']['filterdescriptions'] === "2"?2:1?>" summary="main area">
163
			<tr>
164
				<td colspan="<?=(!isset($config['syslog']['rawfilter']))?7:2?>" align="left" valign="middle">
165
				<div id="filterlogentries_show" class="widgetconfigdiv" style="<?=(!isset($config['syslog']['rawfilter']))?"":"display:none"?>">
166
					<form id="filterlogentries" name="filterlogentries" action="diag_logs_filter.php" method="post">
167
						<?php 
168
							$Include_Act = explode(",", str_replace(" ", ",", $filterfieldsarray['act']));
169
							if ($filterfieldsarray['interface'] == "All") $interface = "";
170
						?>
171
					<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="action">
172
					<tr>
173
						<td rowspan="2">
174
							<div align="center"><?=gettext("Action");?></div>
175
							<div align="left">
176
							<input id="actpass"   name="actpass"   type="checkbox" value="Pass"   <?php if (in_arrayi('Pass',   $Include_Act)) echo "checked=\"checked\""; ?> /> Pass<br />
177
							<input id="actblock"  name="actblock"  type="checkbox" value="Block"  <?php if (in_arrayi('Block',  $Include_Act)) echo "checked=\"checked\""; ?> /> Block<br />
178
							<input id="actreject" name="actreject" type="checkbox" value="Reject" <?php if (in_arrayi('Reject', $Include_Act)) echo "checked=\"checked\""; ?> /> Reject<br />
179
							</div>
180
						</td>
181
						<td>
182
							<div align="center"><?=gettext("Time");?></div>
183
							<div align="center"><input id="filterlogentries_time" name="filterlogentries_time" class="formfld search" type="text" size="12" value="<?= $filterfieldsarray['time'] ?>" /></div>
184
						</td>
185
						<td>
186
							<div align="center"><?=gettext("Source IP Address");?></div>
187
							<div align="center"><input id="filterlogentries_sourceipaddress" name="filterlogentries_sourceipaddress" class="formfld search" type="text" size="35" value="<?= $filterfieldsarray['srcip'] ?>" /></div>
188
						</td>
189
						<td>
190
							<div align="center"><?=gettext("Source Port");?></div>
191
							<div align="center"><input id="filterlogentries_sourceport" name="filterlogentries_sourceport" class="formfld search" type="text" size="10" value="<?= $filterfieldsarray['srcport'] ?>" /></div>
192
						</td>
193
						<td>
194
							<div align="center"><?=gettext("Protocol");?></div>
195
							<div align="center"><input id="filterlogentries_protocol" name="filterlogentries_protocol" class="formfld search" type="text" size="5" value="<?= $filterfieldsarray['proto'] ?>" /></div>
196
						</td>
197
						<td>
198
							<div align="center" style="vertical-align:top;"><?=gettext("Quantity");?></div>
199
							<div align="center" style="vertical-align:top;"><input id="filterlogentries_qty" name="filterlogentries_qty" class="" type="text" size="6" value="<?= $filterlogentries_qty ?>" /></div>
200
						</td>
201
					</tr>
202
					<tr>
203
						<td valign="top">
204
							<div align="center"><?=gettext("Interface");?></div>
205
							<div align="center"><input id="filterlogentries_interfaces" name="filterlogentries_interfaces" class="formfld search" type="text" size="12" value="<?= $filterfieldsarray['interface'] ?>" /></div>
206
						</td>
207
						<td valign="top">
208
							<div align="center"><?=gettext("Destination IP Address");?></div>
209
							<div align="center"><input id="filterlogentries_destinationipaddress" name="filterlogentries_destinationipaddress" class="formfld search" type="text" size="35" value="<?= $filterfieldsarray['dstip'] ?>" /></div>
210
						</td>
211
						<td valign="top">
212
							<div align="center"><?=gettext("Destination Port");?></div>
213
							<div align="center"><input id="filterlogentries_destinationport" name="filterlogentries_destinationport" class="formfld search" type="text" size="10" value="<?= $filterfieldsarray['dstport'] ?>" /></div>
214
						</td>
215
						<td valign="top">
216
							<div align="center"><?=gettext("Protocol Flags");?></div>
217
							<div align="center"><input id="filterlogentries_protocolflags" name="filterlogentries_protocolflags" class="formfld search" type="text" size="5" value="<?= $filterfieldsarray['tcpflags'] ?>" /></div>
218
						</td>
219
						<td valign="bottom">
220
							<div align="center"><input id="filterlogentries_submit" name="filterlogentries_submit" type="submit" class="formbtn" value="<?=gettext("Filter");?>" /></div>
221
						</td>
222
					</tr>
223
					<tr>
224
						<td></td>
225
						<td colspan="5">
226
							<?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;
227
							<?=gettext("Precede with exclamation (!) as first character to exclude match.");?>&nbsp;&nbsp;
228
						</td>
229
					</tr>
230
					</table>
231
					</form>
232
				</div>
233
				<div id="filterform_show" class="widgetconfigdiv" style="<?=(!isset($config['syslog']['rawfilter']))?"display:none":""?>">
234
					<form id="filterform" name="filterform" action="diag_logs_filter.php" method="post">
235
					<table width="0%" border="0" cellpadding="0" cellspacing="0" summary="firewall log">
236
					<tr>
237
						<td>
238
							<div align="center" style="vertical-align:top;"><?=gettext("Interface");?></div>
239
							<div align="center" style="vertical-align:top;">
240
							<select name="interface" onchange="dst_change(this.value,iface_old,document.iform.dsttype.value);iface_old = document.iform.interface.value;typesel_change();">
241
							<option value="" <?=$interfacefilter?"":"selected=\"selected\""?>>*Any interface</option>
242
							<?php						
243
							$iflist = get_configured_interface_with_descr(false, true);
244
							//$iflist = get_interface_list();
245
							// Allow extending of the firewall edit interfaces 
246
							pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/pre_interfaces_edit");
247
							foreach ($iflist as $if => $ifdesc)
248
								$interfaces[$if] = $ifdesc;
249

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

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

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

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

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

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

    
365
			  $srcstr = $filterent['srcip'] . get_port_with_service($filterent['srcport'], $proto);
366
			  $src_htmlclass = str_replace(array('.', ':'), '-', $filterent['srcip']);
367
			  $dststr = $filterent['dstip'] . get_port_with_service($filterent['dstport'], $proto);
368
			  $dst_htmlclass = str_replace(array('.', ':'), '-', $filterent['dstip']);
369
			  ?>
370
			  <td class="listMRr nowrap">
371
				<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"/>
372
				<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.")?>')">
373
				<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_block_add.gif" alt="Icon Easy Rule: Add to Block List" /></a>
374
				<?php echo $srcstr . '<span class="RESOLVE-' . $src_htmlclass . '"></span>';?>
375
			  </td>
376
			  <td class="listMRr nowrap">
377
				<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"/>
378
				<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.");?>')">
379
				<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_pass_add.gif" alt="Icon Easy Rule: Pass this traffic" /></a>
380
				<?php echo $dststr . '<span class="RESOLVE-' . $dst_htmlclass . '"></span>';?>
381
			  </td>
382
			  <?php
383
				if ($filterent['proto'] == "TCP")
384
					$filterent['proto'] .= ":{$filterent['tcpflags']}";
385
			  ?>
386
			  <td class="listMRr nowrap"><?php echo htmlspecialchars($filterent['proto']);?></td>
387
			</tr>
388
			<?php if (isset($config['syslog']['filterdescriptions']) && $config['syslog']['filterdescriptions'] === "2"):?>
389
			<tr class="<?=$evenRowClass?>">
390
			  <td colspan="2" class="listMRDescriptionL listMRlr" />
391
			  <td colspan="4" class="listMRDescriptionR listMRr nowrap"><?=find_rule_by_number_buffer($filterent['rulenum'],$filterent['tracker'],$filterent['act']);?></td>
392
			</tr>
393
			<?php endif;
394
			endforeach; 
395
			buffer_rules_clear(); ?>
396
<?php else: ?>
397
		  <tr>
398
			<td colspan="2" class="listtopic">
399
			  <?php printf(gettext("Last %s firewall log entries"),$nentries);?></td>
400
		  </tr>
401
		  <?php
402
			if($filtertext)
403
				dump_clog($filter_logfile, $nentries, true, array("$filtertext"));
404
			else
405
				dump_clog($filter_logfile, $nentries);
406
		  ?>
407
<?php endif; ?>
408
		<tr>
409
			<td align="left" valign="top" colspan="3">
410
				<form id="clearform" name="clearform" action="diag_logs_filter.php" method="post" style="margin-top: 14px;">
411
					<input id="submit" name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log");?>" />
412
				</form>
413
			</td>
414
		</tr>
415
		</table>
416
		</div>
417
	</td>
418
  </tr>
419
</table>
420

    
421
<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>
422

    
423
<?php include("fend.inc"); ?>
424

    
425
<!-- AJAXY STUFF -->
426
<script type="text/javascript">
427
//<![CDATA[
428
function resolve_with_ajax(ip_to_resolve) {
429
	var url = "/diag_logs_filter.php";
430

    
431
	jQuery.ajax(
432
		url,
433
		{
434
			type: 'post',
435
			dataType: 'json',
436
			data: {
437
				resolve: ip_to_resolve,
438
				},
439
			complete: resolve_ip_callback
440
		});
441

    
442
}
443

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

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

    
464
</body>
465
</html>
(21-21/254)