Saturday, August 24, 2013

Installing Aircrack-NG on Linux

Aircrack-ng is an 802.11 WEP and WPA-PSK keys cracking program that can recover keys once enough data packets have been captured. Fir installation, run the following commands :

sudo apt-get install build-essential

sudo apt-get install libssl-dev


tar -zxvf aircrack-ng-1.1.tar.gz

cd aircrack-ng-1.1

Edit the file common.mak before you run make and make install.
sudo gedit common.mak

Locate and change the unused variable werror. Change :
CFLAGS          ?= -g -W -Wall -Werror -O3


CFLAGS          ?= -g -W -Wall -O3

Now run :
sudo make
sudo make install 

After the installation, if you get a prompt as follows :
[*] Run 'airodump-ng-oui-update' as root (or with sudo) to install 
or update Airodump-ng OUI file (Internet connection required). 

Then run the command :
sudo airodump-ng-oui-update

Friday, August 23, 2013

Installing ettercap on Linux

Ettercap is a comprehensive suite for man in the middle attacks. It features sniffing of live connections, content filtering on the fly and many other interesting tricks. It supports active and passive dissection of many protocols and includes many features for network and host analysis.

For installing ettercap, use the following commands :

sudo apt-get install zlib1g zlib1g-dev
sudo apt-get install build-essential
sudo apt-get install ettercap

You will be prompted to choose between ettercap text-only and ettercap-graphical packages. Choose accordingly.

For installing ettercap-graphical, use the command :

sudo apt-get install ettercap-graphical

For installing ettercap-text only, use the command :

sudo apt-get install ettercap-text-only
After the installation is done, you can open ettercap in different modes. For opening ettercap in graphic mode, use :

sudo ettercap -G

For text mode, use

sudo ettercap -T

To read about ettercap and its different modes, you can use :

man ettercap

Note : 'man' is short for manual. It can be used to read about all commands (description, syntax etc.)

Thursday, August 22, 2013

Capturing Packets using Wireshark

To start the capture of packets, select the interface from the left panel and click on Start.

Once you click on start, you'll notice that the capture of packets has begun and all the packets to and from your computer starts appearing.

If you just want to see a paticular type of packets, say ARP, HTTP etc., you can also add a filter. In the top left corner, type the desired type of packet. Only that type of packet will appear.

Wednesday, August 21, 2013

Cropping an image in Linux using GIMP

Cropping an image is a pretty basic feature in image editing software. Its pretty easy to do in Windows. You can even use Paint to do it in Windows. But I had a tough time doing it on Ubuntu. But its pretty easy to do it on GIMP. Here's how.

1. Open the image you want to crop on GIMP.

2. In the Toolbox, you have to look for the Crop Tool.

3. Use the Crop Tool to select the area you want to crop and click on the small rectangular box within the selected area to crop.

  4. You get the cropped image. Use Ctrl+S to save the image. Use Ctrl+Q to quit GIMP.

Installing MATLAB on Linux

I recently downloaded a MATLAB image to install on Linux thinking that it would be a walk in the park like Windows. But it wasn't. There a few things you need to take care of before installing MATLAB on Linux systems.

Firstly, you need to have Open JDK installed. I have read about people having problems installing MATLAB with Open JDK Java 7 (latest version). If you do, then  install Open JDK Java 6 and it should work fine.

In Windows you can just extract an ISO file and run the .exe file to install the software. But that doesn't work in Linux. First you need to mount the ISO. Ofcourse you can install some software for mounting with a GUI but I am going to tell you how to do it using commands.

To mount the ISO file, check this link here.

After mounting the ISO, enter the mounted drive using the following commands :

cd /mnt/disk

Now you can check the  files in this directory using ls command. You should find a file named install in the directory. Now use the commad :


This should start the installation.


After the installation, you will be prompted to activate your software. Choose the option that suits you. Since I had the activation file, I chose the option Activate Manually without Internet. 

After activating the software, MATLAB is ready to use. Now you can unmount the ISO file. For help on unmounting an ISO file, click here.  

Sunday, August 18, 2013

Mounting & Unmounting an ISO in Linux

Mounting an ISO

To mount an ISO in Linux, you need to follow these steps :

Firstly, you need to create a directory where you will be mounting the ISO. You can do so using the command :

sudo mkdir -p /mnt/disk

Next, we mount the ISO file using the command :

sudo mount -o loop [filename].iso /mnt/disk

If you get an error saying that loop is not up, first load the loop module and then repeat the mount command. To load the loop module, use the command :

sudo modprobe loop

Note that you can always use TAB key to auto-complete the filename. -o loop is used to denote the mounted ISO file is a loop device. A loop device is a pseudo-device which writes/reads from a file rather than a hardware.

Unmounting an ISO

To unmount an ISO file, use the command :

sudo umount /mnt/disk

Use the following command if you are getting an error :

sudo umount -f /mnt/disk

Note that it is 'umount' and not 'unmount'. 

Saturday, August 17, 2013

Moving Close, Maximise and Minimise Buttons to Right Side in Linux

If you are a windows user, then the one thing that you would find most annoying is the close, maximise and minimise buttons being on the opposite side. It can be done in a couple of ways. Just run this command to have the buttons on the right :

gconftool-2 --type string --set /apps/metacity/general/button_layout "menu:minimize,maximize,close"

If the above command doesn't work, try this :

gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,maximize,close"

It is also possible to do it using gconf-editor. If gconf-editor is not installed on your system, you can do so by searching it in the software centre. To change the buttons to right, follow these steps :

1. Press Alt+F2. This should open the Run Application window.
2. Type gconf-editor as shown.

3. In the editor, select apps -> metacity -> general.
4. In the value field of button_layout, change close,minimize,maximize: to menu:minimize,maximize,close  

Deleting a directory in Linux

To delete a directory in Linux OS, we use the command :

The syntax is :

rmdir [directory path]
But the rmdir or rm command works only for an empty directory. For deleting a directory, we need to perform what is called a Recursive Delete. Recursive Delete deletes the directory, its sub-directories and all the files contained within. To perform a recursive delete, we use the command :

rm -rf [directory path]

Obviously it doesn't make sense to have to run a command if you could do it manually. But sometimes, you cannot delete directories as a normal user and you will get an error saying you do not have necessary permissions. So you need to be a super user to do so. Use the command as follows :

sudo rm -rf [directory path]

Thursday, August 15, 2013

Installing Wireshark

Wireshark is a network protocol analyzer. If you are networking geek, its a software you would definitely have on your system. Whether you are looking at network troubleshooting, analysis, software and communications protocol development or just as a hobby, Wireshark is your go-to tool.
To install on Windows, you download the latest release from here. Each Windows package comes with the latest stable release of WinPcap, which is required for live packet capture. If needed you can install the latest development release from here.
To install on a Linux system, you can run the command :
yum install wireshark (Fedora/CentOS)

sudo apt-get install wireshark (Debian/Ubuntu)
After the installation, to run Wireshark, type wireshark in the terminal.

How to repair MBR in Windows 7?

When you install a Linux OS on your system, the Master Boot record (MBR) gets replaced by GRUB (GRand Unified Bootloader). If you decide to uninstall the Linux OS and go back to your Windows system, you need to fix your MBR. You have to follow these steps for that :

  1. Put the Windows 7 installation disc in the disc drive (or a bootable Windows 7 USB), and then start the computer.
  2. Select a language, a time, a currency, a keyboard or an input method, and then click Next.
  3. Click Repair your computer.
  4. Click the operating system that you want to repair, and then click Next.
  5. In the System Recovery Options dialog box, click Command Prompt.
  6. To restore the MBR, simply type : bootrec /fixmbr

Wednesday, August 14, 2013

Essential Shortcuts & Commands in Terminal

Ctrl + Shift + T - Open a new tab within the Terminal
Ctrl + Shift + C - Copy
Ctrl + Shift + V - Paste
Tab Key- Autocomplete the command if there is only one option, or else show all the available options.
Ctrl + C- Kill the current process (works mostly with small text-mode applications)
Ctrl + Z - Send the current process to the background.
clear - Clears the screen
ls - List all the contents of the current directory
cd - Change the current directory
exit - It will get you out of the shell

FAQs by Linux Newbies

How do I become "root"?
To become "root" on a Linux system, type :
su -
You will be prompted to enter your root password (you set this while installing your OS), entering which you will become the root of the system. Becoming the root will give you access to all the commands on the computer.
How do I change the GRUB boot order?
GRUB boot order can be configured using the file /etc/default/grub . Use the following command :
gedit /etc/default/grub
This command opens a window with the GRUB file. In this file, you will notice that there's a line :
In the list that appears at the start up, the Linux OS appears first. Here, the indexing starts from 0. So the first option on the list will have a value 0, second option has value 1 and so on. Check the position of your Windows OS and change the value of GRUB_DEFAULT.
Also, if you can change the amount of tume you have to wait during the boot time by changing the value of GRUB_TIMEOUT.
How do I untar a .tar.gz file?
Any compressed file can be decompressed by choosing "Extract Here" after right clicking on the file.
Command to untar a file is :
tar -xvzf 
Is there a Task Manager equivalent in Linux?
Yes there is. While logged in as root, type
ps -ax |more
ps -aux |more
You will get a list of all processes running on your computer. You will see the process id (PID), process status (STAT) various statistics, and the command name. You can kill a process by typing "kill" and the PID number right afterwards similar to the line below.
kill 1721
You can also stop and restart processes by sending them various signals as in the below examples:
kill -STOP 1721 - Stops (suspends) process 1721 by sending the STOP signal to the process. This process will still be on the task list. The process can't catch or ignore the STOP signal.
kill -CONT 1721 - Continue process 1721 causing it to resume. The CONT signal is sent to the process.
kill -TERM 1721 - Terminates process 1721 by sending the TERM signal to the process. This process will no longer show up on the task list if it is actually terminated. Process terminated cannot be continued. The TERM signal can be caught so TERM is not guaranteed to kill the process.
kill -HUP 1721 - Stops, then restarts process 1721. This is usually done when a process is not working properly or the configuration files for that process have been changed. This command sends the HUP signal to the process which means hangup. This signal can be caught by the process.
killall -HUP myprint - Restarts any process with the name "myprint".
kill -TERM myprint - Terminates any process with the name "myprint".

Monday, August 12, 2013

Commonly used Linux Commands

1. ls command

ls command is used to list the contents of the current directory.

2. cd command

cd command is used to change directories.

cd . - Takes you to the parent of the current directory
cd - Takes you to the root directory
cd PATH - Takes you to the specified PATH

3. uname command

It is used to print system information.

-a, --all
print all information, in the following order:
-s, --kernel-name
print the kernel name
-n, --nodename
print the network node hostname
-r, --kernel-release
print the kernel release
-v, --kernel-version
print the kernel version
-m, --machine
print the machine hardware name
-p, --processor
print the processor type
-i, --hardware-platform
print the hardware platform
-o, --operating-system
print the operating system
display this help and exit
output version information and exit

Things to do after installing Linux

When I installed Fedora 18, I realised that it doesn't include most of the software I am used to in Windows. Luckily, almost all the software that are available for Windows are available for Linux distros as well (atleast close substitutes). This is not an exhaustive list! Just to give an idea as to how to go about things.
Remember to run all the commands as super user, i.e., type ' su - ' first. You will be prompted to enter your password. After entering the correct password, you enter the root of your system, similar to admin in Windows.
1. Fedora Utils
Fedora Utils lets you install codecs and additional software that Fedora doesn't want to ship, like MP3 codecs, Adobe Flash, Oracle Java etc. It can also fix problems, tweak and cleanup your system, show system information and much more with just few clicks.

su -c "curl -o /etc/yum.repos.d/fedorautils.repo && yum install fedorautils"

2. VLC Media Player & Media Codecs

I find VLC more convenient to use than the default player that comes with Fedora, so that's usually the first thing I prefer installing.
yum install vlc
yum install gstreamer gstreamer-ffmpeg gstreamer-plugins-bad gstreamer-plugins-bad-free gstreamer-plugins-bad-nonfree gstreamer-plugins-base gstreamer-plugins-good gstreamer-plugins-ugly ffmpeg
3. Adobe Flash Plugin
You have to chose either based on the hardware architecture you are using.

x86_64 (64 bit)

sudo yum install -y 

x86 (32 bit)

 sudo yum install -y

Install the Adobe Flash web-browser plugin
The first command imports the GPG key for the Adobe Flash plugin repository and the second command installs the plugin itself.
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
sudo yum install flash-plugin -y
4. GNOME Tweak Tool
GNOME Tweak Tool is an application for changing the advanced settings of GNOME 3.
yum install gnome-tweak-tool
5. Installing Java Runtime Environment
For installing JRE, download the package required/ You can download the latest package from here or the previous releases from here. There are a variety of formats available and you can choose whichever suits you the best. Since I use a Fedora system, it would be *.rpm for me.
rpm -Uhv *.rpm
Wine is a free and open source software application that aims to allow applications designed for Microsoft Windows to run on Linux operating systems.
yum install wine
GIMP is an open source equivalent of Adobe Photoshop.
yum install gimp
8. Audacity
Audacity is free, open-source audio editor for recording, slicing, and mixing audio.
yum install audacity --disablerepo=LumenVox
9. Clementine Music Player
You do find some default music players on Linux like Rhythmbox or Brasero, but I found this music player really ineresting.

sudo add-apt-repository ppa:me-davidsansome/clementine
sudo apt-get update
sudo apt-get install clementine

Upgrading Fedora using yum

For upgrading Fedora, you have to install a script called 'fedora-upgrade'. After installing this script, you just have to run the script for the upgrade. Use the following commands :
# yum install fedora-upgrade
# fedora-upgrade
For upgrading from Fedora 18 to 19, follow this procedure :
# rpm --import
# yum update yum
# yum --releasever=19 distro-sync

Downloading YouTube Videos on Linux

There are many YouTube Downloaders available on net but I use a very simple command line program called 'youtube-dl' to download videos.

Installing youtube-dl

yum install youtube-dl (For Fedora/CentOS)
          sudo apt-get install youtube-dl (For Debian/Ubuntu)

How to download videos
youtube-dl - This command will download the video into your Downloads folder.
If you want to specify the download folder, then use the following command :
youtube-dl -o /home/"YourPATH"
This command can be used for downloading any video and is not limited to YouTube.

12. PTP Router (Precision Time Protocol Router)

a. NetFPGA Base Version : v2.0
b. PTP Package : PTP Router 1.0.0
After downloading this package, merge it with the NF2 folder in root.
c. After this, compile and load the driver again, i.e., use the following commands :
  1. cd ~/NF2
  2. make
  3. make install
d. Regression Tests : Regression tests for PTP Router are the same as those for reference router.
e. Building the software : For building the software, use the following command :
  1. cd NF2/projects/ptp_router/sw
  2. make install
  3. cd scone-ptp
  4. make
f. For running the PTP project, go to the directory sw/scone-ptp and use the command ./scone.
Sample Output : Follow the link


Tuesday, August 6, 2013

11. Regression Tests

Regression tests are a set of tests that exercise the functionality of the released gateware and software. The following are the initial tests that need to be followed :
1.Go to : Systems -> Administration -> Server Settings -> Services  and stop all the processes (except the process network) that are running (time consuming but has to be done). I had once faced a problem of not being able to open the Systems  due to insufficient rights (dunno how that happened as I was the only user on the computer). For that, you can log into the  root and type : system-config-services.
2. IPv6 needs to be disabled. This can be done as follows :
a. Type : /sbin/chkconfig ip6tables off
b. Type : gedit /etc/modprobe.conf and add the lines :
alias ipv6 off
alias net-pf-10 off

 c. Edit network file using the command : gedit /etc/sysconfig/network and make the sure the following line is there : NETWORKING_IPV6=no

Regression Tests
1. Connect 'eth1' to 'nf2c0' and 'eth2' to 'nf2c1'.
2. Connect 'nf2c2' to 'nf2c3' (Leaving these ports unconnected causes errors in the regression tests).
3. Pull up all the interfaces :
ifconfig eth1 up
ifconfig eth2 up
ifconfig nf2c0 up
ifconfig nf2c1 up
ifconfig nf2c2 up
ifconfig nf2c3 up
And assign an IP address of to all of them. This is done to remove the IPv4 address for each interface.
ifconfig eth1
ifconfig eth2
ifconfig nf2c0
ifconfig nf2c1
ifconfig nf2c2
ifconfig nf2c3
Now reprogram the CPCI using : /usr/local/sbin/ -all
Write the bitfile onto the NetFPGA using : nf_download ~/netfpga/bitfiles/reference_router.bit
Now start the regression tests using : ~/netfpga/bin/