How to get the routing table of your network with Windows and Linux.

Showing the routing table in Linux is very useful when you are required to get information about a network. This is the output when retrieving the routing table in Windows 7. C:\Users\jason>route PRINT =========================================================================== Interface List 16…00 ff f0 18 9a f5 ……TAP-Windows Adapter V9 13…00 13 46 3a 02 83 ……Realtek RTL8139/810x Family Fast … Read more

Another way to get the IP address of your machine with the arp command.

This command will lookup the network adapter that you are using and return the gateway IP address. jason@eyjafjallajkull:~$ arp -n | grep : | awk ‘{print $1}’ 10.10.0.1jason@eyjafjallajkull:~$ arp -n | grep : | awk ‘{print $1}’ 10.10.0.1 This looks for the : character that is in the MAC address like this. jason@Yog-Sothoth:~$ arp -n … Read more

Universal archive unpacker script for Linux. Easily unpack any archive with the terminal.

The unp script for Linux is a script that will detect what the archive is and call the appropriate program to handle it. This is a very useful script for the command line user. In the example below I am unpacking a zip file. jason@eyjafjallajkull:~/Downloads$ unp northwind.sql_.zip Archive: northwind.sql_.zip inflating: northwind.sqljason@eyjafjallajkull:~/Downloads$ unp northwind.sql_.zip Archive: northwind.sql_.zip … Read more

A good utility for finding all executables in a given path.

Finding all executables in a given path is easy if you use the lsx utility. Firstly install the required packages. jason@eyjafjallajkull:~$ sudo apt-get install suckless-tools [sudo] password for jason: Reading package lists… Done Building dependency tree Reading state information… Done Suggested packages: dwm stterm surf The following NEW packages will be installed: suckless-tools 0 to … Read more

How to force a re-boot or shutdown if the traditional commands will not work.

If your machine has errors with the hard disk and your machine has booted with a read-only filesystem, these commands can force your machine to either shutdown or reboot. Forced re-boot. echo 1 > /proc/sys/kernel/sysrq echo b > /proc/sysrq-triggerecho 1 > /proc/sys/kernel/sysrq echo b > /proc/sysrq-trigger Forced shutdown. echo 1 > /proc/sys/kernel/sysrq echo o > … Read more

How to do a SQL injection attack against Damn Vulnerable Web App.

Damn Vulnerable Web App is a PHP web application that is deliberately vulnerable. This is used to learn how to attack websites by exploiting various vulnerabilities in the software. In this example, I am showing you how to use an SQL injection attack to get information out of the database. This line of code will … Read more

What is the loopback address of your network interface?

The loopback address of the network interface, usually 127.0.0.1, is the address used by the operating system to access the network interface itself. This is represented in IPv6 as 0:0:0:0:0:0:0:1:/128 or ::1/128 when compressed. This gives the computer user a way to ping a network interface and verify that it is actually working. The ping6 … Read more

How to find files on the Linux filesystem.

The find command is very useful for locating files on your Linux filesystem. Below is an example of wildcards to locate files in the /boot directory. ubuntu@ip-172-31-20-16:~$ sudo find /boot -name "vm*" /boot/vmlinuz-3.13.0-44-genericubuntu@ip-172-31-20-16:~$ sudo find /boot -name "vm*" /boot/vmlinuz-3.13.0-44-generic Here I am searching the whole / filesystem for a set of files that end in … Read more

How to use foremost to recover deleted files on a USB thumb drive with Kali Linux.

Below is a snippet of output from my Kali Linux session. I am trying to recover files from a USB thumb drive and I am having some success. root@kali:/home/root/Desktop/files# foremost /dev/sdb1 -v -o /home/root/Desktop/files/ Foremost version 1.5.7 by Jesse Kornblum, Kris Kendall, and Nick Mikus Audit File   Foremost started at Thu Mar 12 11:12:06 … Read more

How to crack Linux passwords using john the ripper.

Firstly, for the purposes of this exercise, we are creating a new user with a simple password. I used a user named “vaas” and gave him the simple password “password”. Then run this command to create the file that john the ripper will be using. ubuntu@ip-172-31-20-16:~$ sudo unshadow /etc/passwd /etc/shadow > pass.outubuntu@ip-172-31-20-16:~$ sudo unshadow /etc/passwd … Read more

How to remove unneeded packages on your Ubuntu Linux system.

I wanted to update my Ubuntu 14.04 server and I saw this output. I needed to remove these unwanted packages on my system. ubuntu@ip-172-31-20-16:~$ sudo apt-get upgrade Reading package lists… Done Building dependency tree Reading state information… Done Calculating upgrade… Done The following packages were automatically installed and are no longer required: libdigest-hmac-perl libdrm-intel1 libdrm-nouveau2 … Read more

How to convert a jpg image to ASCII using the Linux command line.

The jp2a package for Ubuntu will convert a jpeg image into an ascii text representation. This is useful for creating useful ascii images to post on the Internet. Install it by typing: sudo apt-get install jp2a and then convert an image this way. ~$ jp2a myimage.jpg~$ jp2a myimage.jpg This will output ascii text to the … Read more

How to get the brand and model of your graphics card with the command line.

This command will print out the model and make of your graphics card. This is another command to run on an unknown computer to see what hardware is in it. jason@eyjafjallajkull:~$ lspci -vnn | grep VGA -A 12 | head -n 1 01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Turks XT [Radeon … Read more

C code that will select a random word from an array and include it in a string.

This code will pick a random word from the x[] array and include it in the printed string. This program will also get your current Linux username to customize the output. I am sure this code would be very useful to someone who wants to know how to handle arrays in C. #include <stdio.h> #include … Read more

How to format a partition in Linux. This is very easy.

Formatting a partition in Linux is very easy when you use the mkfs command. In this example I am formatting a 35 gigabyte partition with an EXT4 file-system. I am intending to try out a Linux From Scratch build and I want to have a dedicated partition to build this on. jason@eyjafjallajkull:~/Documents$ sudo mkfs.ext4 /dev/sdb2 … Read more

C code that will open a file and print the contents to the terminal.

This code will print the contents of a file to the terminal. Feel free to use this in your own projects if you wish. #include <stdio.h>   #define MEM "/proc/diskstats"   int main (void) {   FILE *g; char Meminfo[40]; g = fopen(MEM, "r"); if(!g) { printf ("Sorry, I cannot open: %s.\n", MEM); } else … Read more

How to delete a directory on Linux.

Deleting a directory on Linux is very easy indeed. The rmdir command will perform this task adequately. You could also use the rm -rf abc/ command to delete a directory, but rmdir is easier to remember. eyjafjallajkull% rmdir abceyjafjallajkull% rmdir abc The rmdir command will not be able to delete a directory that is not … Read more