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

Stealth Linux code that can run on a machine and open a port invisibly.

This code that I found: http://paste.scratchbook.ch/view/6f74b58f can run on a Linux machine and open a port invisibly. This allows access to a Linux server without the process showing in process manager and on a port scan of the machine. This might be controversial thing to post on a Linux focused website, but this might be … Read more

Some useful bash shell scripts for the Linux user.

This function will allow your computer to speak. function shellspeak() { mplayer "http://translate.google.com/translate_tts?tl=en&q=$(echo $@ | sed ‘s/\s/+/’)" > /dev/null 2>&1; }function shellspeak() { mplayer "http://translate.google.com/translate_tts?tl=en&q=$(echo $@ | sed ‘s/\s/+/’)" > /dev/null 2>&1; } A script that will change all files in a directory to lowercase filenames. function lowercase() # move filenames to lowercase. { for … Read more

How to shutdown your Linux system properly with the command prompt.

The shutdown command for Linux and UNIX is used to shutdown your Linux system properly. This command will bring down the system immediately. shutdown -h nowshutdown -h now This will shut down the system in 60 minutes. shutdown -h +60shutdown -h +60 Use this command to reboot the computer immediately. shutdown -r nowshutdown -r now … Read more

Some useful tips for Linux Mint users.

To open a new virtual terminal to enter commands, use the Ctrl-Alt-F2 key combination and enter your username and password. This is a virtual terminal where you can control your system with a distraction free full-screen terminal. There are key combinations to switch between virtual terminals, read more here: http://www.tldp.org/LDP/GNU-Linux-Tools-Summary/html/virtual-terminals.html. To get a version of … Read more