summaryrefslogtreecommitdiff
path: root/scripts/vyatta-tshark.pl
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-10-20 16:43:27 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-10-27 17:11:33 -0500
commit28ecee135be5a62e4224b6eedd5fcdabddee75a7 (patch)
tree18c06b1746beffe6cd990a98fdabdfa7c297a302 /scripts/vyatta-tshark.pl
parentcc2d1c8575d0b50efe5d9449cac22e7749754d26 (diff)
downloadvyatta-op-28ecee135be5a62e4224b6eedd5fcdabddee75a7.tar.gz
vyatta-op-28ecee135be5a62e4224b6eedd5fcdabddee75a7.zip
Bugfix 7575: Make tshark run as a normal user so that writing files works properly
(cherry picked from commit 03ff4a8d1f8f31eac014e227cdcd9d1a6d4af907)
Diffstat (limited to 'scripts/vyatta-tshark.pl')
-rwxr-xr-xscripts/vyatta-tshark.pl24
1 files changed, 14 insertions, 10 deletions
diff --git a/scripts/vyatta-tshark.pl b/scripts/vyatta-tshark.pl
index 75b1a5b..c065cbe 100755
--- a/scripts/vyatta-tshark.pl
+++ b/scripts/vyatta-tshark.pl
@@ -32,7 +32,7 @@ use Getopt::Long;
sub check_if_interface_is_tsharkable {
my $interface = shift;
- my @grep_tshark_interfaces = `sudo /usr/bin/tshark -D | grep $interface`;
+ my @grep_tshark_interfaces = `/usr/bin/tshark -D | grep $interface`;
my $any_interface;
for my $count (0 .. $#grep_tshark_interfaces) {
@@ -68,7 +68,11 @@ GetOptions("detail!" => \$detail,
check_if_interface_is_tsharkable($intf);
if (defined($save)){
- exec "sudo /usr/bin/tshark -i $intf -w '$save' | grep -v root";
+ if (!($save =~ /.*\.pcap/)) {
+ print("Please name your file <filename>.pcap\n");
+ exit 1;
+ }
+ exec "/usr/bin/tshark -i $intf -w '$save'";
exit 0;
}
@@ -76,32 +80,32 @@ if (defined($filter)) {
if (defined($detail)) {
if (defined($unlimited)){
print "Capturing traffic on $intf ...\n";
- exec "sudo /usr/bin/tshark -n -i $intf -V $filter 2> /dev/null";
+ exec "/usr/bin/tshark -n -i $intf -V $filter 2> /dev/null";
} else {
print "Capturing traffic on $intf ...\n";
- exec "sudo /usr/bin/tshark -n -i $intf -c 1000 -V $filter 2> /dev/null";
+ exec "/usr/bin/tshark -n -i $intf -c 1000 -V $filter 2> /dev/null";
}
} elsif (defined($unlimited)) {
print "Capturing traffic on $intf ...\n";
- exec "sudo /usr/bin/tshark -n -i $intf $filter 2> /dev/null";
+ exec "/usr/bin/tshark -n -i $intf $filter 2> /dev/null";
} else {
print "Capturing traffic on $intf ...\n";
- exec "sudo /usr/bin/tshark -n -i $intf -c 1000 $filter 2> /dev/null";
+ exec "/usr/bin/tshark -n -i $intf -c 1000 $filter 2> /dev/null";
}
} elsif (defined($detail)) {
if (defined($unlimited)) {
print "Capturing traffic on $intf ...\n";
- exec "sudo /usr/bin/tshark -n -i $intf -V 2> /dev/null";
+ exec "/usr/bin/tshark -n -i $intf -V 2> /dev/null";
} else {
print "Capturing traffic on $intf ...\n";
- exec "sudo /usr/bin/tshark -n -i $intf -c 1000 -V 2> /dev/null";
+ exec "/usr/bin/tshark -n -i $intf -c 1000 -V 2> /dev/null";
}
} elsif (defined($unlimited)) {
print "Capturing traffic on $intf ...\n";
- exec "sudo /usr/bin/tshark -n -i $intf 2> /dev/null";
+ exec "/usr/bin/tshark -n -i $intf 2> /dev/null";
} else {
print "Capturing traffic on $intf ...\n";
- exec "sudo /usr/bin/tshark -n -i $intf -c 1000 2> /dev/null";
+ exec "/usr/bin/tshark -n -i $intf -c 1000 2> /dev/null";
}
exit 0;