Feb 052013

So I wrote this script because I often need to run tcpdump on a remote host and then view it in wireshark.  The old method was to run tcpdump on remote host, scp/rsync the file back to my local machine, open it in wireshark, view it.  This script saves a lot of time.  It assumes you are logging in as root and will need modified if you are running as a normal user (change root to your username and make sure you have sudo privileges for tcpdump)

# By Ed Wiget
# This runs tcpdump on a remote hosts and pipes it back locally to wireshark to view in realtime
# 20130205 - original script
if [ $1 == "" ]; then
	echo "What is the remote host by fqdn, i.e. server1.domain.com"
	read RHOST
wireshark -k -i <( ssh -l root ${RHOST} /usr/sbin/tcpdump -i eth0 -w - )
# after you kill wireshark, the tcpdump still runs on remove host...we need to kill it
PIDOF=`ssh root@${RHOST} "ps aux | grep [t]cpdump" | awk -F" " '{print$2}'`
echo "killing pid ${PIDOF} on ${RHOST}...please wait...."
ssh root@${RHOST} "pkill tcpdump"
# now we make sure it is killed
PIDOF2=`ssh root@${RHOST} "ps aux | grep [t]cpdump" | awk -F" " '{print$2}'`
if [ ${PIDOF2} == "" ]; then
	echo "pid check returns ${PIDOF2}"
	echo "pid check returns ${PIDOF2}"

Oct 312012
# By Ed Wiget
# This script grabs the latest nmap, zenmap, ncat, nping in rpm format and converts them to deb
# 20121031 - original script
# the version we are grabbing
# the architecture we are using
# our working dir
# check if it exists and if not, create it
if [ ! -d ${TEMP_DIR} ]; then
	mkdir -p ${TEMP_DIR}
# check to make sure alien is installed and if not, install it
if [ ! -f /usr/bin/alien ]; then
	sudo apt-get install alien
# cd to the working dir
cd ${TEMP_DIR}
# 386 files
# http://nmap.org/dist/nmap-6.01-1.i386.rpm
# http://nmap.org/dist/zenmap-6.01-1.noarch.rpm
# http://nmap.org/dist/ncat-6.01-1.i386.rpm
# http://nmap.org/dist/nping-0.6.01-1.i386.rpm
# x86_64 files
# http://nmap.org/dist/nmap-6.01-1.x86_64.rpm
# http://nmap.org/dist/ncat-6.01-1.x86_64.rpm
# http://nmap.org/dist/nping-0.6.01-1.x86_64.rpm
# no arch
# http://nmap.org/dist/zenmap-6.01-1.noarch.rpm
# grab the files
wget -O ${TEMP_DIR}/nmap-${VER}.${ARCH}.rpm http://nmap.org/dist/nmap-${VER}.${ARCH}.rpm
wget -O ${TEMP_DIR}/ncat-${VER}.${ARCH}.rpm http://nmap.org/dist/ncat-${VER}.${ARCH}.rpm
wget -O ${TEMP_DIR}/nping-0.${VER}.${ARCH}.rpm http://nmap.org/dist/nping-0.${VER}.${ARCH}.rpm
wget -O ${TEMP_DIR}/zenmap-${VER}.noarch.rpm http://nmap.org/dist/zenmap-${VER}.noarch.rpm
# remove any deb files currently in this dir
rm -f *.deb
# convert the downloaded files to deb
sudo alien nmap-${VER}.${ARCH}.rpm
sudo alien ncat-${VER}.${ARCH}.rpm
sudo alien nping-0.${VER}.${ARCH}.rpm
sudo alien zenmap-${VER}.noarch.rpm
# install the packages
sudo dpkg --install *.deb

Jun 132012

I love tweetdeck, so imagine my surprise when Adobe decided to not support AIR on linux anymore.  So until today, I had still been using the native adobe air version of tweetdeck on linux.  Yesterday though, tweetdeck would randomly lock up.  Today, it wouldn’t post or anything so I set out to install the windows version on linux using wine.  Its actually pretty damn easy and so far, no problems.

This is how you do it in 5 steps or less in ubuntu’ish linux:

Continue reading »

Mar 022012

After upgrading to Linux kernel 3.2.6, rebooting, reconfiguring initramfs for encrypted drives, rebooting again, and reinstalling ati graphics, my normal xrandr command no longer worked.  That command is:

xrandr --output LVDS --mode 1920x1200 --pos 1680x0 --rotate normal --output CRT1 --mode 1680x1050 --pos 0x0 --rotate normal --output DFP2 --off --output DFP1 --off

And the error was “xrandr screen only supports 1920 x 1200”

The fix is really simple….

Continue reading »

Dec 102011

Why did I build a new xchat package for backtrack 5?  Because there is a bug in the one that is included.  The bug causes favorites to not be saved on exit.  I don’t know if it affects everybody but I found a bug on the xchat website that is over a year old regarding it.  So, if ubuntu or backtrack maintainers won’t fix it…..I will.

You can get the source and deb packages here:


The requires libperl-dev which apparently doesn’t exist in the repos too….so its here:

Dec 012011
$ lspci -vvv | grep Audio
00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03)
$ cat /proc/asound/card0/codec* | grep Codec
Codec: Conexant CX20561 (Hermosa)
Codec: Conexant ID 2c06
sudo echo "options snd-hda-intel model=generic" >> /etc/modprobe.d/alsa-base.conf
sudo alsa force-reload
sudo /etc/init.d/mpd restart

Nov 302011

I have set up many laptops and netbooks with linux and have always used either full-disk encryption or ~/ encrypted.  Its really easy to do and ANY laptop/netbook/tablet/pad/whatever_next mobile device should be encrypted.  I won’t get into the mechanics of why, just do it.  The last article I wrote about this is no longer online (Maysville Linux Users Group, circa 2007) and it was much harder to accomplish back then, often requiring custom kernels to be compiled, etc.  Backtrack has “nearly” everything it takes right on the live cd.


  1. A laptop
  2. bootable media (backtrack on usb stick, cdrom, some other distro, etc)
  3. Internet connection (backtracks only requirement is to download two files)

Continue reading »

Oct 132011

Over the years, I have tried various methods to get more life out of a laptop battery.  I generally always buy a higher capacity battery.  So my current laptop was getting about 3 hours out of a full charge and I was happy with that but lately it has dropped considerably…to about 1 hour.  Usually when I am on the road or away from home, I have my netbook which gets about 9 hours of actual battery time while working.  I wish I had a way to get that kind of battery time out of my full size laptop.

I started looking through old scripts I had from a couple years ago (I replace my laptops every two years), I found these scripts I use for management of power settings.  This has drastically increased the battery time, up to near 3 hours again.  So, I don’t know if some recent kernel update (that I did about two weeks ago) was what was killing battery time or not.

Continue reading »

Aug 112011

ï£ ¥ð ¢åñ’† rêåÐ ßå§h, gê† Ðå £µ¢k 𵆆å hêrê

# By Ed Wiget
# This script automates downloading youtube video and converting to mp3 file
# I use it to grab new songs for my ipod that I am too lazy to insert store bought cd 🙂
# set this variable to the location of your scripts:
# this sets the location of the python youtube-dl script, relative to above
# this sets the path of the downloaded files and temp directory
# this sets the path to were the final mp3 is stored
# this checks for the youtube-dl script and if it doesn't exist, it gets it
# if it does exist, it checks to make sure its the latest version
if [ ! -d ${BASE_DIR}/youtube-dl ];
echo "grabbing the youtube-dl script"
cd ${BASE_DIR}
git clone git://github.com/rg3/youtube-dl.git youtube-dl
echo -e "youtube-dl already exists\n\nMaking sure we have the latest version"
# this checks to make sure we have ffmpeg and lame installed, and if not, grabs them
FFMPEG1=`which ffmpeg | wc -l`
LAME1=`which lame | wc -l`
if [ ${FFMPEG1} = 1 ];
echo "ffmpeg already exists"
echo "grabbing ffmpeg"
# for ubuntu based distros, use this line
sudo apt-get install ffmpeg
# for redhat based distros, use this line
#sudo yum install ffmpeg
# for arch
#pacman -S ffmpeg
if [ ${LAME1} = 1 ];
echo "lame already exists"
echo "grabbing lame"
# for ubuntu use this line
sudo apt-get install lame
# for redhat use this line
# sudo yum install lame
# for arch linux
#pacman -S lame
# next we ask the user for the video file, it should be in format like:
# http://www.youtube.com/watch?v=6E2hYDIFDIU
echo -e "What is the video to download, ie. http://www.youtube.com/watch?v=6E2hYDIFDIU"
echo "You entered ${VIDEO_URL} is this correct? ( y / n )"
read ANS
        if [ ${ANS} = "y" ];
                        cd ${DL_FILES}
                        # grab the song title
                        SONG_TITLE=`${YOUTUBE_DL} --get-title ${VIDEO_URL}`
                        echo -e "the song title is ${SONG_TITLE}"
                        # downloading video
                        echo "downloading video....please wait"
                        ${YOUTUBE_DL} ${VIDEO_URL}
                        # we need to convert the dl url to a filename for later processing
                        # the url is like:  http://www.youtube.com/watch?v=6E2hYDIFDIU 
                        # the downloaded file will be 6E2hYDIFDIU.mp4
                        MP4_FILE=`echo ${VIDEO_URL} | awk -F/ '{print$4}' | awk -F= '{print$2}'`
                        # get the downloaded file extension
                        FILE_EXT=`ls ${DL_FILES}/${MP4_FILE}* | awk -F. '{print$2}'`
                        echo "your video is located in ${DL_FILES}/${MP4_FILE}.${FILE_EXT}"
                        echo ""
                        echo "converting ${DL_FILES}/${MP4_FILE}.${FILE_EXT} to wav.....please wait"
                        # ffmpeg -i 6E2hYDIFDIU.flv 6E2hYDIFDIU.wav
                        ffmpeg -i ${DL_FILES}/${MP4_FILE}.${FILE_EXT} ${DL_FILES}/"${SONG_TITLE}".wav
                        echo "video converted to wav file....converting wav to mp3"
                        lame -b 128 ${DL_FILES}/"${SONG_TITLE}".wav ${MP3_LOCATION}/"${SONG_TITLE}".mp3
                        echo "${SONG_TITLE} is now available at ${MP3_LOCATION}/${SONG_TITLE}.mp3"
                        echo -e "\n\nmoving video download file ${DL_FILES}/${MP4_FILE}.${FILE_EXT} to ${MP3_LOCATION}/${SONG_TITLE}.${FILE_EXT}"
                        mv ${DL_FILES}/${MP4_FILE}.${FILE_EXT} ${MP3_LOCATION}/"${SONG_TITLE}".${FILE_EXT}
                        echo "video file is now at ${MP3_LOCATION}/"${SONG_TITLE}".${FILE_EXT}"
                        echo -e "\n\ndone .... and enjoy"
                echo "there was an error...."