Revision f8ec8de4
Added by Renato Botelho about 15 years ago
usr/local/www/diag_packet_capture.php | ||
---|---|---|
35 | 35 |
##|*MATCH=diag_packet_capture.php* |
36 | 36 |
##|-PRIV |
37 | 37 |
|
38 |
$pgtitle = array("Diagnostics", "Packet Capture");
|
|
38 |
$pgtitle = array(gettext("Diagnostics"), gettext("Packet Capture"));
|
|
39 | 39 |
require_once("guiconfig.inc"); |
40 | 40 |
require_once("pfsense-utils.inc"); |
41 | 41 |
|
... | ... | |
64 | 64 |
} |
65 | 65 |
|
66 | 66 |
if ($_POST['startbtn'] != "" ) { |
67 |
$action = "Start";
|
|
67 |
$action = gettext("Start");
|
|
68 | 68 |
|
69 | 69 |
//delete previous packet capture if it exists |
70 | 70 |
if (file_exists($fp.$fn)) |
71 | 71 |
unlink ($fp.$fn); |
72 | 72 |
|
73 | 73 |
} elseif ($_POST['stopbtn']!= "") { |
74 |
$action = "Stop";
|
|
74 |
$action = gettext("Stop");
|
|
75 | 75 |
$processes_running = trim(shell_exec('/bin/ps axw -O pid= | /usr/bin/grep tcpdump | /usr/bin/grep $fn | /usr/bin/grep -v pflog')); |
76 | 76 |
|
77 | 77 |
//explode processes into an array, (delimiter is new line) |
... | ... | |
95 | 95 |
} else { |
96 | 96 |
$do_tcpdump = false; |
97 | 97 |
} |
98 |
$pgtitle = "Diagnostics: Packet Capture"; |
|
99 | 98 |
include("head.inc"); ?> |
100 | 99 |
|
101 | 100 |
<body link="#000000" vlink="#0000CC" alink="#0000CC"> |
... | ... | |
110 | 109 |
<form action="diag_packet_capture.php" method="post" name="iform" id="iform"> |
111 | 110 |
<table width="100%" border="0" cellpadding="6" cellspacing="0"> |
112 | 111 |
<tr> |
113 |
<td colspan="2" valign="top" class="listtopic">Packet capture</td>
|
|
112 |
<td colspan="2" valign="top" class="listtopic"><?=gettext("Packet capture");?></td>
|
|
114 | 113 |
</tr> |
115 | 114 |
<tr> |
116 |
<td width="17%" valign="top" class="vncellreq">Interface</td>
|
|
115 |
<td width="17%" valign="top" class="vncellreq"><?=gettext("Interface");?></td>
|
|
117 | 116 |
<td width="83%" class="vtable"> |
118 | 117 |
<select name="interface"> |
119 | 118 |
<?php |
... | ... | |
125 | 124 |
</option> |
126 | 125 |
<?php endforeach;?> |
127 | 126 |
</select> |
128 |
<br/>Select the interface the traffic will be passing through. Typically this will be the WAN interface.
|
|
127 |
<br/><?=gettext("Select the interface the traffic will be passing through. Typically this will be the WAN interface.");?>
|
|
129 | 128 |
</td> |
130 | 129 |
</tr> |
131 | 130 |
<tr> |
132 |
<td width="17%" valign="top" class="vncellreq">Host Address</td>
|
|
131 |
<td width="17%" valign="top" class="vncellreq"><?=gettext("Host Address");?></td>
|
|
133 | 132 |
<td width="83%" class="vtable"> |
134 | 133 |
<input name="host" type="text" class="formfld host" id="host" size="20" value="<?=htmlspecialchars($host);?>"> |
135 |
<br/>This value is either the Source or Destination IP address. The packet capture will look for this address in either field.
|
|
136 |
<br/>This value can be a domain name or IP address.
|
|
137 |
<br/>If you leave this field blank, all packets on the specified interface will be captured.
|
|
134 |
<br/><?=gettext("This value is either the Source or Destination IP address. The packet capture will look for this address in either field.");?>
|
|
135 |
<br/><?=gettext("This value can be a domain name or IP address.");?>
|
|
136 |
<br/><?=gettext("If you leave this field blank, all packets on the specified interface will be captured. ");?>
|
|
138 | 137 |
</td> |
139 | 138 |
</tr> |
140 | 139 |
<tr> |
141 |
<td width="17%" valign="top" class="vncellreq">Port</td>
|
|
140 |
<td width="17%" valign="top" class="vncellreq"><?=gettext("Port");?></td>
|
|
142 | 141 |
<td width="83%" class="vtable"> |
143 | 142 |
<input name="port" type="text" class="formfld unknown" id="port" size="5" value="<?=$port;?>"> |
144 |
<br/>The port can be either the source or destination port. The packet capture will look for this port in either field.
|
|
145 |
<br/>Leave blank if you do not want to filter by port.
|
|
143 |
<br/><?=gettext("The port can be either the source or destination port. The packet capture will look for this port in either field.");?>
|
|
144 |
<br/><?=gettext("Leave blank if you do not want to filter by port.");?>
|
|
146 | 145 |
</td> |
147 | 146 |
</tr> |
148 | 147 |
<tr> |
149 |
<td width="17%" valign="top" class="vncellreq">Packet Length</td>
|
|
148 |
<td width="17%" valign="top" class="vncellreq"><?=gettext("Packet Length");?></td>
|
|
150 | 149 |
<td width="83%" class="vtable"> |
151 | 150 |
<input name="snaplen" type="text" class="formfld unknown" id="snaplen" size="5" value="<?=$snaplen;?>"> |
152 |
<br/>The Packet length is the number of bytes the packet will capture for each payload. Default value is 1500.
|
|
151 |
<br/><?=gettext("The Packet length is the number of bytes the packet will capture for each payload. Default value is 1500.");?>
|
|
153 | 152 |
</td> |
154 | 153 |
</tr> |
155 | 154 |
<tr> |
156 |
<td width="17%" valign="top" class="vncellreq">Count</td>
|
|
155 |
<td width="17%" valign="top" class="vncellreq"><?=gettext("Count");?></td>
|
|
157 | 156 |
<td width="83%" class="vtable"> |
158 | 157 |
<input name="count" type="text" class="formfld unknown" id="count" size="5" value="<?=$count;?>"> |
159 |
<br/>This is the number of packets the packet capture will grab. Default value is 100. <br/>Enter 0 (zero) for no count limit.
|
|
158 |
<br/><?=gettext("This is the number of packets the packet capture will grab. Default value is 100.") . "<br/>" . gettext("Enter 0 (zero) for no count limit.");?>
|
|
160 | 159 |
</tr> |
161 | 160 |
<tr> |
162 |
<td width="17%" valign="top" class="vncellreq">Level of Detail</td>
|
|
161 |
<td width="17%" valign="top" class="vncellreq"><?=gettext("Level of Detail");?></td>
|
|
163 | 162 |
<td width="83%" class="vtable"> |
164 | 163 |
<select name="detail" type="text" class="formselect" id="detail" size="1"> |
165 |
<option value="-q" <?php if ($detail == "-q") echo "selected"; ?>>Normal</option>
|
|
166 |
<option value="-v" <?php if ($detail == "-v") echo "selected"; ?>>Medium</option>
|
|
167 |
<option value="-vv" <?php if ($detail == "-vv") echo "selected"; ?>>High</option>
|
|
168 |
<option value="-vv -e" <?php if ($detail == "-vv -e") echo "selected"; ?>>Full</option>
|
|
164 |
<option value="-q" <?php if ($detail == "-q") echo "selected"; ?>><?=gettext("Normal");?></option>
|
|
165 |
<option value="-v" <?php if ($detail == "-v") echo "selected"; ?>><?=gettext("Medium");?></option>
|
|
166 |
<option value="-vv" <?php if ($detail == "-vv") echo "selected"; ?>><?=gettext("High");?></option>
|
|
167 |
<option value="-vv -e" <?php if ($detail == "-vv -e") echo "selected"; ?>><?=gettext("Full");?></option>
|
|
169 | 168 |
</select> |
170 |
<br/>This is the level of detail that will be displayed after hitting 'Stop' when the packets have been captured. <br/><b>Note:</b> This option does not affect the level of detail when downloading the packet capture. |
|
169 |
<br/><?=gettext("This is the level of detail that will be displayed after hitting 'Stop' when the packets have been captured.") . "<br/><b>" . |
|
170 |
gettext("Note") . ":</b> " . |
|
171 |
gettext("This option does not affect the level of detail when downloading the packet capture.");?> |
|
171 | 172 |
</tr> |
172 | 173 |
<tr> |
173 |
<td width="17%" valign="top" class="vncellreq">Reverse DNS Lookup</td>
|
|
174 |
<td width="17%" valign="top" class="vncellreq"><?=gettext("Reverse DNS Lookup");?></td>
|
|
174 | 175 |
<td width="83%" class="vtable"> |
175 | 176 |
<input name="dnsquery" type="checkbox"<?php if($_POST['dnsquery']) echo " CHECKED"; ?>> |
176 |
<br/>This check box will cause the packet capture to perform a reverse DNS lookup associated with all IP addresses.
|
|
177 |
<br/><b>Note: </b>This option can cause delays for large packet captures.
|
|
177 |
<br/><?=gettext("This check box will cause the packet capture to perform a reverse DNS lookup associated with all IP addresses.");?>
|
|
178 |
<br/><b><?=gettext("Note");?>: </b><?=gettext("This option can cause delays for large packet captures.");?>
|
|
178 | 179 |
</td> |
179 | 180 |
</tr> |
180 | 181 |
<tr> |
... | ... | |
190 | 191 |
if ($processcheck != false) |
191 | 192 |
$processisrunning = true; |
192 | 193 |
|
193 |
if (($action == "Stop" or $action == "") and $processisrunning != true)
|
|
194 |
echo "<input type=\"submit\" name=\"startbtn\" value=\"Start\"> ";
|
|
194 |
if (($action == gettext("Stop") or $action == "") and $processisrunning != true)
|
|
195 |
echo "<input type=\"submit\" name=\"startbtn\" value=\"" . gettext("Start") . "\"> ";
|
|
195 | 196 |
else { |
196 |
echo "<input type=\"submit\" name=\"stopbtn\" value=\"Stop\"> ";
|
|
197 |
echo "<input type=\"submit\" name=\"stopbtn\" value=\"" . gettext("Stop") . "\"> ";
|
|
197 | 198 |
} |
198 | 199 |
if (file_exists($fp.$fn) and $processisrunning != true) { |
199 |
echo "<input type=\"submit\" name=\"downloadbtn\" value=\"Download Capture\">";
|
|
200 |
echo " (The packet capture file was last updated: " . date("F jS, Y g:i:s a.", filemtime($fp.$fn)) . ")";
|
|
200 |
echo "<input type=\"submit\" name=\"downloadbtn\" value=\"" . gettext("Download Capture") . "\">";
|
|
201 |
echo " (" . gettext("The packet capture file was last updated") . ": " . date("F jS, Y g:i:s a.", filemtime($fp.$fn)) . ")";
|
|
201 | 202 |
} |
202 | 203 |
?> |
203 | 204 |
</td> |
... | ... | |
207 | 208 |
<?php |
208 | 209 |
echo "<font face='terminal' size='2'>"; |
209 | 210 |
if ($processisrunning == true) |
210 |
echo("<strong>Packet Capture is running.</strong><br/>");
|
|
211 |
echo("<strong>" . gettext("Packet Capture is running.") . "</strong><br/>");
|
|
211 | 212 |
|
212 | 213 |
if ($do_tcpdump) { |
213 | 214 |
|
... | ... | |
234 | 235 |
|
235 | 236 |
$selectedif = convert_friendly_interface_to_real_interface_name($selectedif); |
236 | 237 |
|
237 |
if ($action == "Start") {
|
|
238 |
echo("<strong>Packet Capture is running.</strong><br/>");
|
|
238 |
if ($action == gettext("Start")) {
|
|
239 |
echo("<strong>" . gettext("Packet Capture is running.") . "</strong><br/>");
|
|
239 | 240 |
mwexec_bg ("/usr/sbin/tcpdump -i $selectedif $searchcount -s $packetlength -w $fp$fn $searchhost $searchport"); |
240 | 241 |
} else { |
241 | 242 |
//action = stop |
242 |
echo("<strong>Packet Capture stopped. <br/><br/>Packets Captured:</strong><br/>");
|
|
243 |
echo("<strong>" . gettext("Packet Capture stopped.") . "<br/><br/>" . gettext("Packets Captured") . ":</strong><br/>");
|
|
243 | 244 |
?> |
244 | 245 |
<textarea style="width:98%" name="code" rows="15" cols="66" wrap="off" readonly="readonly"> |
245 | 246 |
<?php |
Also available in: Unified diff
Sync with mainline, diag_* files were missing