diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2007-01-29 20:47:39 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2007-01-29 20:47:39 +0000 |
commit | d5c2fde54c4944e2b324fd53921577bf30febd02 (patch) | |
tree | d21f0dabe99027f6e61236b3a5270a68d6321ba4 | |
parent | 1071e028a5b7cd229cdcc30feacedb1e09069894 (diff) | |
download | pfsense-d5c2fde54c4944e2b324fd53921577bf30febd02.zip pfsense-d5c2fde54c4944e2b324fd53921577bf30febd02.tar.gz |
MFC latest tcpdump changes from Scott Dale
-rw-r--r-- | usr/local/www/diag_packet_capture.php | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/usr/local/www/diag_packet_capture.php b/usr/local/www/diag_packet_capture.php index f3f5453..579f125 100644 --- a/usr/local/www/diag_packet_capture.php +++ b/usr/local/www/diag_packet_capture.php @@ -70,7 +70,19 @@ if ($_POST) { elseif ($_POST['stopbtn']!= "") { $action = "Stop"; - stop_service(tcpdump); + $processes_running = trim(shell_exec("ps axw -O pid= | grep tcpdump | grep $fn")); + + //explode processes into an array, (delimiter is new line) + $processes_running_array = explode("\n", $processes_running); + + //kill each of the packetcapture processes + foreach ($processes_running_array as $process) + { + $process_id_pos = strpos($process, ' '); + $process_id = substr($process, 0, $process_id_pos); + exec("kill $process_id"); + } + } else //download file { @@ -91,6 +103,8 @@ include("head.inc"); ?> <body link="#000000" vlink="#0000CC" alink="#0000CC"> <? include("fbegin.inc"); ?> + + <p class="pgtitle"><?=$pgtitle?></p> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> @@ -169,8 +183,16 @@ include("head.inc"); ?> <td width="17%" valign="top"> </td> <td width="83%"> <?php - if (is_process_running(tcpdump)) + + /*check to see if packet capture tcpdump is already running*/ + $processcheck = (trim(shell_exec("ps axwu | grep tcpdump | grep -v 'grep' | grep -i $fn"))); + + $processisrunning = False; + + if ($processcheck != False) $processisrunning = True; + + if (($action == "Stop" or $action == "") and $processisrunning != True) echo "<input type=\"submit\" name=\"startbtn\" value=\"Start\"> "; else @@ -210,6 +232,7 @@ include("head.inc"); ?> } else //action = stop { + echo("<strong>Packet Capture stopped. <br><br>Packets Captured:</strong><br>"); ?> <textarea style="width:98%" name="code" rows="15" cols="66" wrap="off" readonly="readonly"> |