summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Dale <sdale@pfsense.org>2007-05-14 23:33:55 +0000
committerScott Dale <sdale@pfsense.org>2007-05-14 23:33:55 +0000
commit9b1b06b5d8f041e335baea4313175648c5c01a82 (patch)
tree6dd49fbc7dd003e4c4849385841e2df41450aefd
parentf8554aeddf3099076803279cd8b4c9e711da29cc (diff)
downloadpfsense-9b1b06b5d8f041e335baea4313175648c5c01a82.zip
pfsense-9b1b06b5d8f041e335baea4313175648c5c01a82.tar.gz
save capture to /tmp, fix other various issues
-rw-r--r--usr/local/www/diag_packet_capture.php31
1 files changed, 16 insertions, 15 deletions
diff --git a/usr/local/www/diag_packet_capture.php b/usr/local/www/diag_packet_capture.php
index 94ea067..188d08f 100644
--- a/usr/local/www/diag_packet_capture.php
+++ b/usr/local/www/diag_packet_capture.php
@@ -27,7 +27,7 @@ $pgtitle = array("Diagnostics", "Packet Capture");
require_once("guiconfig.inc");
require_once("pfsense-utils.inc");
-$fp = "/usr/local/www/";
+$fp = "/tmp/";
$fn = "packetcapture.cap";
$snaplen = 1500;//default packet length
$count = 100;//default number of packets to capture
@@ -194,19 +194,18 @@ include("head.inc"); ?>
/*check to see if packet capture tcpdump is already running*/
$processcheck = (trim(shell_exec("ps axw -O pid= | grep tcpdump | grep $fn | grep -v pflog")));
+
+ $processisrunning = false;
- $processisrunning = False;
-
- if ($processcheck != False)
- $processisrunning = True;
-
-
- if (($action == "Stop" or $action == "") and $processisrunning != True)
+ if ($processcheck != false)
+ $processisrunning = true;
+
+ if (($action == "Stop" or $action == "") and $processisrunning != true)
echo "<input type=\"submit\" name=\"startbtn\" value=\"Start\">&nbsp;";
else{
echo "<input type=\"submit\" name=\"stopbtn\" value=\"Stop\">&nbsp;";
}
- if (file_exists($fp.$fn)){
+ if (file_exists($fp.$fn) and $processisrunning != true){
echo "<input type=\"submit\" name=\"downloadbtn\" value=\"Download Capture\">";
echo "&nbsp;&nbsp;(The packet capture file was last updated: " . date("F jS, Y g:i:s a.", filemtime($fp.$fn)) . ")";
}
@@ -216,8 +215,11 @@ include("head.inc"); ?>
<tr>
<td valign="top" colspan="2">
<?php
- if ($do_tcpdump) {
- echo "<font face='terminal' size='2'>";
+ echo "<font face='terminal' size='2'>";
+ if ($processisrunning == true)
+ echo("<strong>Packet Capture is running.</strong><br/>");
+
+ if ($do_tcpdump) {
if ($port != "")
{
@@ -251,13 +253,12 @@ include("head.inc"); ?>
$selectedif = convert_friendly_interface_to_real_interface_name($selectedif);
- if ($processisrunning)
- echo("<strong>Packet Capture is running.</strong><br/>");
+
if ($action == "Start")
{
echo("<strong>Packet Capture is running.</strong><br/>");
- mwexec_bg ("/usr/sbin/tcpdump -i $selectedif $searchcount -s $packetlength -w $fn $searchhost $searchport");
+ mwexec_bg ("/usr/sbin/tcpdump -i $selectedif $searchcount -s $packetlength -w $fp$fn $searchhost $searchport");
}
else //action = stop
{
@@ -266,7 +267,7 @@ include("head.inc"); ?>
?>
<textarea style="width:98%" name="code" rows="15" cols="66" wrap="off" readonly="readonly">
<?php
- system ("/usr/sbin/tcpdump $disabledns $detail -r $fn");?>
+ system ("/usr/sbin/tcpdump $disabledns $detail -r $fp$fn");?>
</textarea><?php
}
}?>
OpenPOWER on IntegriCloud