Saturday, 23 September 2017

ASPIRING TO BECOME HACKER-PART 2{ MAKING FILES}

In my first tutorial on Linux basics, I discussed the importance of hackers using Linux and the structure of the directory system. We also looked briefly at the cdcommand. In this second Linux guide, I'll spend a bit more time with changing directories, listing directories, creating files and directories, and finally, getting help.
Let's open up BackTrack and getting started learning more Linux for the aspiring hacker.

Step 1Change Directory (Cd)

We can change directories in multiple ways with cd. As I showed you in my previous article, we can use cd .. to move up one level in the directory tree. We can also move directly to the root directory by typing cd / or move to our home directory by cd ~.
More often, we will use cd to move to a directory by using the absolute path of the directory. This mean that we write out the entire path of the directory we want to move to after cd. We can also move to the directory by using the relative path of the directory. This means that we don't need to write the entire path, but simply use the path that we're currently in and append to it. Let's look at some examples.
Let's say we're in our root user directory in BackTrack and we want to move to theaircrack-ng directory (we'll be doing some aircrack tutorials soon). We can simply type:
  • bt > cd /pentest/wireless/aircrack-ng
This will take us directly to the aircrack-ng directory.
Now let's say we want to go to the scripts sub-directory within aircrack-ng. We could type out the full path to the sub-directory, but it's much simpler to type the relative path from where we are. We know we are /pentest/wireless/aircrack-ng, so type:
  • bt > cd scripts
And that takes us to the scripts sub-directory within aircrack-ng or/pentest/wireless/aircrack-ng/scripts.
Once again, it's critical to emphasize that Linux is case sensitive, so typing the directory without the proper case will result in the error message, "no such file or directory".

Step 2Listing Command (Ls)

Once of most used and important commands in Linux is ls or list. This command is used to list the contents of a directory or sub-directory so that we can see the contents. It's very similar to the dir command in Windows. So let's use it in theaircrack-ng directory;
  • bt > ls
We can see that Linux listed all the files and directories within the aircrack-ngdirectory. Linux allows us to modify its commands by using switches; these are usually letters preceded by the dash (-). With ls, it's helpful to use two of theses switches, -a and -l.
The -a switch means all, so when we use it, Linux will list all files and directories, even those that are hidden. When we use the -l switch, it gives us a long listing, meaning it gives us info on the security permissions, the size, the owner, the group of the file or directory, when it was created, etc.
Let's type:
  • bt > ls -la
We'll examine more closely the security permissions in a later tutorial, but you must know that you need execute (x) permission on any file you want to execute. So, if you download a new tool, you must make certain that you have execute permission on it.

Step 3Create a File (Touch)

The create a file in Linux, it's a bit different from Windows. In Linux, we use thetouch command. So, let's create a new file called newfile:
  • bt > touch newfile
Now we can check to see if that file exists by doing a directory listing:
  • bt > ls -la
We can see that new file has been created!

Step 4Create a Directory (Mkdir)

Similar to Windows, we can create a directory by using the make directory command (mkdir). Let's now make a new directory.
  • bt > mkdir newdirectory
Now type ls and we can see that a new directory has been created .

Step 5Getting Help (Man)

Linux has a very useful utility called manMan is the manual for nearly every command. If you should forget what a command does, simply type man and the name of the command and it will display the manual with all the info you need about that command, its switches, and arguments. For instance, type:
  • bt > man touch
With most commands, you can also use either the -h switch or the --help switch after the command to obtain "help" about a particular command. In the case of "touch", we must use the --help to obtain help on the touch command.
  • bt > touch --help

Aspiring to BECOME HACKER?-LINUX BASICS PART1

Welcome back, my hacker DUDE#
A number of you have written me regarding which operating system is best for hacking. I'll start by saying that nearly every professional and expert hacker uses Linux or Unix. Although some hacks can be done with Windows and Mac OS, nearly all of the hacking tools are developed specifically for Linux.
There are some exceptions, though, including software like Cain and Abel, Havij,Zenmap, and Metasploit that are developed or ported for Windows.
When these Linux apps are developed in Linux and then ported over to Windows, they often lose some of their capabilities. In addition, there are capabilities built into Linux that simply are not available in Windows. That is why hacker tools are in most cases ONLY developed for Linux.
To summarize, to be a real expert hacker, you should master a few Linux skills and work from a Linux distribution like BackTrack or Kali.
Image via wonderhowto.com
For those of you who've never used Linux, I dedicate this series on the basics of Linux with an emphasis on the skills you need for hacking. So, let's open up BackTrack or your other Linux distribution and let me show you a few things.

Step 1Boot Up Linux

Once you've booted up BackTrack, logged in as "root" and then type:
  • bt > startx
You should have a screen that looks similar to this.

Step 2Open a Terminal

To become proficient in Linux, you MUST master the terminal. Many things can be done now in the various Linux distributions by simply pointing and clicking, similar to Windows or Mac OS, but the expert hacker must know how to use the terminal to run most of the hacking tools.
NOW , let's open a terminal by clicking on the terminal icon on the bottom bar. That should give us a screen that looks similar to this.
If you've ever used the command prompt in Windows, the Linux terminal is similar, but far more powerful. Unlike the Windows command prompt, you can do EVERYTHING in Linux from the terminal and control it more precisely than in Windows.
It's important to keep in mind that unlike Windows, Linux is case-sensitive. This means that "Desktop" is different from "desktop" which is different from "DeskTop". Those who are new to Linux often find this challenging, so try to keep this in mind.

Step 3 TO Examine the Directory Structure

Let's start with some basic Linux. Many beginners get tripped up by the structure of the file system in Linux. Unlike Windows, Linux's file system is not linked to a physical drive like in Windows, so we don't have a c:\ at the beginning of our Linux file system, but rather a /.
The forward slash (/) represents the "root" of the file system or the very top of the file system. All other directories (folders) are beneath this directory just like folders and sub-folders are beneath the c:\ drive.
To visualize the file system, let's take a look at this diagram below.
It's important to have a basic understanding of this file structure because often we need to navigate through it from the terminal without the use of a graphical tool like Windows Explorer.
A couple key things to note in this graphical representation:
  • The /bin directory is where binaries are stored. These are the programs that make Linux run.
  • /etc is generally where the configuration files are stored. In Linux, nearly everything is configured with a text file that is stored under /etc.
  • /dev directory holds device files, similar to Windows device drivers.
  • /var is generally where log files, among other files, are stored.

Step 4Using  Pwd TO EXPLOIT

When we open a terminal in BackTrack, the default directory we're in is our "home" directory. As you can see from the graphic above, it's to the right of the "root" directory or one level "below" root. We can confirm what directory we are in by typing:
  • bt > pwd
pwd stands for "present working directory" and as you can see, it returns "/root" meaning we're in the root users directory (don't confuse this with the top of the directory tree "root." This is the root users directory).
pwd is a handy command to remember as we can use it any time to tell us where we are in the directory tree.

Step 5Using Cd Command

We can change the directory we're working in by using the cd (change directory) command. In this case, let's navigate "up" to the top of the directory structure by typing:
  • bt > cd ..
The cd command followed by the double dots (..) says, "move me up one level in the directory tree." Notice that our command prompt has changed and when we type pwd we see that Linux responds by telling us we are in the "/" or the top of the directory tree (or the root directory).
  • bt > pwd

Step 6Using the Whoami Command

In our last lesson of this tutorial, we'll use the whoami command. This command will return the name of the user we're logged in as. Since we're the root user, we can log in to any user account and that user's name would be displayed here.
  • bt > whoami
That's it for now. In the next several tutorials, I will continue to give you the basics of Linux that you'll need to be a pro hacker, so keep coming back!

ASPIRING TO BECOME HACKER-PART 2{ MAKING FILES}

In my first tutorial on Linux basics, I discussed the importance of hackers using Linux and the structure of the directory system. We also...