From 9b1b06b5d8f041e335baea4313175648c5c01a82 Mon Sep 17 00:00:00 2001 From: Scott Dale Date: Mon, 14 May 2007 23:33:55 +0000 Subject: save capture to /tmp, fix other various issues --- usr/local/www/diag_packet_capture.php | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'usr/local/www/diag_packet_capture.php') 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 " "; else{ echo " "; } - if (file_exists($fp.$fn)){ + if (file_exists($fp.$fn) and $processisrunning != true){ echo ""; echo "  (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"); ?> "; + echo ""; + if ($processisrunning == true) + echo("Packet Capture is running.
"); + + if ($do_tcpdump) { if ($port != "") { @@ -251,13 +253,12 @@ include("head.inc"); ?> $selectedif = convert_friendly_interface_to_real_interface_name($selectedif); - if ($processisrunning) - echo("Packet Capture is running.
"); + if ($action == "Start") { echo("Packet Capture is running.
"); - 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"); ?> ?> -- cgit v1.1