tshark 1.8.2: invalid option -- 'Y' - filter

I am running following command with tshark 1.8.2
tshark -nr 2calls.pcap -Y "ip.src eq 207.239.33.54 || ip.dst eq 207.239.33.54 " -w final.cap
But always encounter this type of error.
tshark: invalid option -- 'Y'
Running tshark -h does not show display filter option.
I tried installing tshark 1.12 on my debian (Linux debian 3.2.0-4-amd64 #1 SMP Debian 3.2.68-1+deb7u1 x86_64 GNU/Linux) but no luck, a lot of dependencies are involved there.
How can i run the above command or install tshark 1.12 on my debian server?
Any help would be much appreciated.
Thanks

Related

What does that script mean? What do i have to do to run it?

So, i have to update a firmware of a sonoff switch with a script i found on GitHub, i don't know how and where to run it, what programmes do i need. (I'm on windows)
I installed bash and tried to run it but it says "No such file or directory" and none of the tutorials on the internet works.
it says "line 8: esptool.py command not found"
esptool.py \
-p $SONOFF_PORT \
--baud 115200 \
write_flash \
-fs 8m \
-fm dout \
-ff 40m \
0x0 ./firmware/rboot.bin \
0x1000 ./firmware/blank_config.bin \
0x2000 ./firmware/Sonoff_$POWERON_STATE.bin
it should work and start the script but i keep getting error messages.
To install esptool using pip pip install esptool.
To check if you have python or pip installed:
python -V
pip -V
According to the filename (esptool.py) this should be a python script. So you need to have the correct python version (python2 or python3) installed and then run it via the respective python interpreter.
python esptool.py ...
Just executing it via bash tries to interpret as a bash script and that explains the error you are getting.

Named Pipe file on Windows 7

At the moment I'm successfully running the following tshark command on Windows 10 and Windows server 2012:
tshark -l -n -r "\\.\pipe\tsharkpipe2"
but when I run it on Windows 7 and Windows server 2012, tshark gives me File does not exist error. However I can use the pipe with -i like:
tshark -i "\\.\pipe\tsharkpipe2"
but I need to run -Y filter and -T pdml which seems cannot be done using -i.
I'm using tshark 2.0.5 and C# Example from Wireshark wiki and both tshark and my client are running as Administrator.
Am I missing something here?

Mac OS X /usr/bin/time verbose flag

I have been trying to run the usr/bin/time command in my terminal (Bash) with the verbose flag --verbose or -v but have repeatedly been getting this error:
/usr/bin/time: illegal option -- v
usage: time [-lp] command.
The command I have been running looks like basically like this:
/usr/bin/time -v python practice.py
Any ideas how to get this to work properly on a Mac? (I have OS X Yosemite)?
If you have homebrew, you can get GNU time by installing the gnu-time package:
brew install gnu-time
After that, it’s available as the gtime command:
$ gtime
Usage: gtime [-apvV] [-f format] [-o file] [--append] [--verbose]
[--portability] [--format=format] [--output=file] [--version]
[--help] command [arg...]
The case is similar for a lot of other homebrew-packaged GNU utilities for OSX; e.g., you can get the GNU df command with gdf, du with gdu, readlink with greadlink, etc.
The homebrew package that has most of those is coreutils, which installs about a hundred different GNU-flavored commands. Other useful packages: findutils, gnu-sed, gnu-tar.
If you don’t have homebrew installed yet, you can get it with just a single command:
Command to download and install homebrew
ruby -e "$(curl -fsSL\
https://raw.githubusercontent.com/Homebrew/install/master/install)"
I think looking at the man page the verbose flag is GNU only. Unfortunately, OSX implementation simply differs.

Find out which package I have to install on a Linux system

I made a bash script to install a software package on a Linux system.
There are 4 packages I can use to install the software:
x86.deb
x86.rpm
x86_64.deb
x86_64.rpm
I know when to install which package on which Linux server manually, but I would like to find out "automatically" (in my bash script) which one I have to install.
Is there any command to find out?
I already know there is a way to find out the architecture (32-bit or 64-bit) via the "arch" command, but I do not know how to find out which package I need.
uname -m or arch gives you the architecture (x86_64 or similar).
You can probably figure out whether your system is based on RPM or DEB (e. g. Ubuntu is DEB-based) by asking both variants which package installed /bin/ls:
dpkg -S /bin/ls
will print
coreutils: /bin/ls
on a DEB-based system.
rpm -q -f /bin/ls
will print
coreutils-5.97-23.el5_6.4
on an RPM-based system (with probably different version numbers).
On the "wrong" system each of these will give an error message instead.
if dpkg -S /bin/ls >/dev/null 2>&1
then
case "$(arch)" in
x86_64)
sudo dpkg -i x86_64.deb;;
i368)
sudo dpkg -i x86.deb;;
*)
echo "Don't know how to handle $(arch)"
exit 1
;;
esac
elif rpm -q -f /bin/ls >/dev/null 2>&1
then
case "$(arch)" in
x86_64)
sudo rpm -i x86_64.rpm;;
i368)
sudo rpm -i x86.rpm;;
*)
echo "Don't know how to handle $(arch)"
exit 1
;;
esac
else
echo "Don't know this package system (neither RPM nor DEB)."
exit 1
fi
Of course all this only makes sense in case you know what to do then, i. e. if you know which package is to be installed on which package system with which architecture.

Find the install location of brew on OS X

I'm creating a BASH scrip which requires a couple of applications to be installed. ffmpeg and sox
To ensure they are in place when my script runs I first check for the installation of Homebrew with :
#!/bin/bash
which -s brew
if [[ $? != 0 ]] ; then
# Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
fi
Then I check that sox and ffmpeg are installed with :
echo "---- checking for sox ----"
which -s sox || /usr/local/bin/brew install sox
echo "---- checking for ffmpeg ----"
which -s ffmpeg || /usr/local/bin/brew install ffmpeg
The problem I am facing is when Homebrew is installed but in a non-standard location.
I have to use the full path to Homebrew because this script is being run within Playtypus.
So the question is : How can I reliably get the installed path of Homebrew in a BASH script?
Answering my own question...
You can test the output of which brew and deal with things accordingly. To gracefully deal with the case where Homebrew is not installed you can use if which brew 2> /dev/null which redirects stderr to /dev/null.
brew --prefix is also useful here as it give the path to where Homebrew installed applications are symlinked to, rather than their actual install path.
A script which works and shows this working :
#!/bin/bash
if which brew 2> /dev/null; then
brewLocation=`which brew`
appLocation=`brew --prefix`
echo "Homebrew is installed in $brewLocation"
echo "Homebrew apps are run from $appLocation"
else
echo "Can't find Homebrew"
echo "To install it open a Terminal window and type :"
echo /usr/bin/ruby -e \"\$\(curl\ \-fsSL\ https\:\/\/raw\.github\.com\/Homebrew\/homebrew\/go\/install\)\"
fi
Thanks to Allendar for the pointers.
Just to add to this, Homebrew's --prefix mode has been enhanced here in the far-flung future of 2020 (or maybe it was always this way), so that it now takes a package name as an argument. Meaning locating those "keg-only" packages which aren't linked into standard paths is as easy as:
$ brew --prefix ffmpeg
/usr/local/opt/ffmpeg

Resources