Sunday, 29 March 2015

Kali linux tutorial

New to Kali Linux ? or to Linux world at all ...
yes welcome to this new experience be sure you will enjoy once you start to try ...
and why not to try over and over we are learning at end and this is the most import part of it,
commands and commands almost everything in Linux need a command we are not in Windows to click we are in Linux to write!
so here is a list for some of the basic commands for Kali Linux 
lets start with details of commands
1.Command: ls
The command “ls” stands for (List Directory Contents), List the contents of the folder, be it file or folder, from which it runs. The most common options are -a (all files) and -l (long or details)
Tab completion is supported and may be configured with .inputrc
When output to file the files are listed one per line.
By default, colour is not used to distinguish types of files. That is equivalent to using --color=none.
Using the --color option without the optional WHEN argument is equivalent to using --color=always.
With --color=auto, color codes are output only if standard output is connected to a terminal (tty).
 

ls commend kali
ls

A.Command “ls -a“, list the content of folder, including hidden files the hidden files is colored blue
ls -a
ls -a
 2. Command: lsblk
The “lsblk” stands for (List Block Devices), print block devices by their assigned name (but not RAM) on the standard output in a tree-like fashion.

lsblk commend
lsblk
The “lsblk -l” command list block devices in ‘list‘ structure (not tree like fashion).
Note: lsblk is very useful and easiest way to know the name of New Usb Device you just plugged in, especially when you have to deal with disk/blocks in terminal.
3. Command: sudo
he “sudo” (super user do) command allows a permitted user to execute a command as the superuser or another user, as specified by the security policy in the sudoers list.
exp: root@Kali:~# sudo add-apt-repository ppa:tualatrix/ppa

Note: sudo allows user to borrow superuser privileged, while a similar command ‘su‘ allows user to actually log in as superuser. Sudo is safer than su.
It is not advised to use sudo or su for day-to-day normal use, as it can result in serious error if accidentally you did something wrong, that’s why a very popular saying in Linux community is:
“To err is human, but to really foul up everything, you need root password.”

4. Command: mkdir
The “mkdir” (Make directory) command create a new directory with name path. However is the directory already exists, it will return an error message “cannot create folder, folder already exists”.

exp: root@Kalitut:~# mkdir Kalitut

Note: Directory can only be created inside the folder, in which the user has write permission. mkdir: cannot create directory `Kalitut‘: File exists
(Don’t confuse with file in the above output, you might remember what i said at the beginning – In Linux every file, folder, drive, command, scripts are treated as file).

5.Command: chmod
The Linux “chmod” command stands for (change file mode bits). chmod changes the file mode (permission) of each given file, folder, script, etc.. according to mode asked for.
There exist 3 types of permission on a file (folder or anything but to keep things simple we will be using file).
Read (r)=4
Write(w)=2
Execute(x)=1
So if you want to give only read permission on a file it will be assigned a value of ‘4‘, for write permission only, a value of ‘2‘ and for execute permission only, a value of ‘1‘ is to be given. For read and write permission 4+2 = ‘6‘ is to be given, ans so on.
Now permission need to be set for 3 kinds of user and usergroup. The first is owner, then usergroup and finally world.
rwxr-x--x   abc.sh
Here the root’s permission is rwx (read, write and execute).
usergroup to which it belongs, is r-x (read and execute only, no write permission) and
for world is –x (only execute).
To change its permission and provide read, write and execute permission to owner, group and world.
root@Kali:~# chmod 777 abc.sh
only read and write permission to all three.
root@Kalitut:~# chmod 666 abc.sh
read, write and execute to owner and only execute to group and world.
root@Kalitut:~# chmod 711 abc.sh
Note: one of the most important command useful for sysadmin and user both. On a multi-user environment or on a server, this command comes to rescue, setting wrong permission will either makes a file inaccessible or provide unauthorized access to someone.

6.Command: tar
The “tar” command is a Tape Archive is useful in creation of archive, in a number of file format and their extraction.
root@Kali:~# tar -zxvf abc.tar.gz (Remember 'z' for .tar.gz)
root@Kali:~# tar -jxvf abc.tar.bz2 (Remember 'j' for .tar.bz2)
root@Kali:~# tar -cvf archieve.tar.gz(.bz2) /path/to/folder/abc
Note: A ‘tar.gz‘ means gzipped. ‘tar.bz2‘ is compressed with bzip which uses a better but slower compression method.

7. Command: cp
The “copy” stands for (Copy), it copies a file from one location to another location.
root@Kali:~# cp /home/user/Downloads abc.tar.gz /home/user/Desktop (Return 0 when sucess)
Note: cp is one of the most commonly used command in shell scripting and it can be used with wildcard characters (Describe in the above block), for customised and desired file copying.

8. Command: mv
The “mv” command moves a file from one location to another location.
root@Kali:~# mv /home/user/Downloads abc.tar.gz /home/user/Desktop (Return 0 when sucess)
Note: mv command can be used with wildcard characters. mv should be used with caution, as moving of system/unauthorised file may lead to security as well as breakdown of system. 


9.Command: pwd
The command “pwd” (print working directory), prints the current working directory with full path name from terminal.
root@Kali:~# pwd
/home/user/Desktop
Note: This command won’t be much frequently used in scripting but it is an absolute life saver for newbie who gets lost in terminal in their early connection with nux. (Linux is most commonly referred as nux or nix).

10. Command: cd
Finally, the frequently used “cd” command stands for (change directory), it change the working directory to execute, copy, move write, read, etc. from terminal itself.
root@Kali:~# cd /home/user/Desktop
server@localhost:~$ pwd
/home/user/Desktop
Note: cd comes to rescue when switching between directories from terminal. “Cd ~” will change the working directory to user’s home directory, and is very useful if a user finds himself lost in terminal. “Cd ..” will change the working directory to parent directory (of current working directory).

Now i will leave you with few more commends

File Operations:
pwd                        Print Name Of Current/Working Directory
The pwd is an acronym for print working directory. The pwd command is considered as one of the most frequently used commands on Linux, AIX, HP-UX, *BSD, and other UNIX like operating systems along with the ls, and cd commands. It can be used for the following purposes under Apple OS X or UNIX or Linux operating systems:
=> Find the full path to the current directory.
=> Store the full path to the current directory in the shell variable.
=> Verify the absolute path.
=> Verify the physical path i.e exclude .

cd                            Changing The Working Directory
cp                            Copy Files Or Directory
rm                            Remove Files And Directory
ls                              List Of Directory Contents
mkdir                       Make Directory
cat                            Concatenate Files And Print On Standard Output
mv                            Move Files
chmod                      Change Files Permissions

Know Your System                                                 
uname                      Print System Information
who                         Show Who Is Logged On
cal                           Displays Calculator
date                         Print System Date And Time
df                            Report File System Disk Space Usage
du                            Estimate File Space Usage
ps                            Displays Information Of Current Active Processes
kill                          Allows To Kills Process
clear                        Clear The Terminal Screen
cat /proc/cpuinfo          Cpuinfo Display CPU Information
cat /proc/meminfo          Display Memory Information

Compression
tar                        Store and Extract Files From An Archive File
gzip                       Compress Or Decompress Named Files

Network
ifconfig                   To Config Network Interface
ping                       Check Other System are reachable from The Host System
wget                       Download Files From Network
ssh                        Remote Login Program
ftp                        Download/Upload Files From/To Remote System
last                       Displays List Of Last Logged In User
telnet                     Used To Communicate With Another Host Using THe Telnet Protocol

Searching Files
grep                       Search Files(s) For Specific Text
find                       Search For Files In A Directory Hierarchy
locate                     Find Files By Name

How to hack wifi password

Crack WPA/WPA2 Wireless Password Using Reaver in Kali Linux!









EDITOR’S NOTE: Be advised, in order to perform this exercise, you WILL need to see Offensive Security As Your Self Defense. This will instruct you on how andwhere to download and install Kali Linux. It is essential that you download the correct version for your machine’s archetype. The instructions are simple if you follow them correctly. Leave a comment with any questions.
Also, check out my latest video tutorial Hacking Accounts Using SSLstrip and Arpspoof!
People assume that because their wireless encryption key is WPA2 standard, they are safe from cyber attack. They are wrong. Reaver is a program inside of Kali Linux that allows an attacker (maybe that creepy neighbor of yours that never comes out of their apartment without taking weird to a new level), easily compromise your routers password by attacking the PIN authorization process between your router and other devices. See, with your router’s PIN, a password is not needed. In fact, because Reaver doesn’t use a dictionary file to bruteforce your password, it doesn’t matter how strong or long it is and Reaver WILL eventually crack the PIN!
Your router’s PIN is eight (8) numbers long. Your router knows four of these numbers and any devices that use the wireless password knows the other four numbers. Reaver randomly runs every possible combination of four numbers until it cracks the PIN! Then voila! The attacker gets your full PIN and your Password!!

How to protect yourself:

Set your wireless router to LOCK WPS. This locks your WPS PIN and makes you invulnerable to this method of attack.

Lets Learn How This Attack Is Carried Out

In order to use Reaver, you need to get your wireless card’s interface name, the BSSID of the router you’re attempting to crack (which I will show you how to find), and you need to make sure your wireless card is in monitor mode. So let’s do all that!

Find your wireless card:

Inside Terminal, type: iwconfig
Press Enter. You should see a wireless device in the subsequent list. Most likely, it’ll be named:
wlan0 or wlan1
But if you have more than one wireless card, or a more unusual networking setup, it may be named something different.

Put your wireless card into monitor mode: Assuming your wireless card’s interface name is: wlan0
Execute the following command to put your wireless card into monitor mode:
airmon-ng start wlan0

This command will output the name of monitor mode interface, which you’ll also want to make note of. Most likely, it’ll be: mon0

Find the BSSID of the router you want to crack:

Lastly, you need to get the unique identifier of the router you’re attempting to crack so that you can point Reaver in the right direction. To do this, execute the following command:
airodump-ng mon0
When you see the network you want, press Ctrl+C to stop the list from refreshing, then copy that network’s BSSID (it’s the series of letters, numbers, and colons on the far left). The network should have WPA or WPA2 listed under the ENC column.
Now, with the BSSID and monitor interface name in hand, you’ve got everything you need to start up Reaver.

Crack a Network’s WPA Password with Reaver

To find out if the AP you are attacking usese WPS (vulnerable to Reaver), you can use:
wash -i mon0
Look under the LOCK column. If your target BSSID has it’s WPS LOCKED (you will see “yes” for LOCKED WPSs), then Reaver will not be able to crack the PIN. If you see a “no”, then continue…
Now execute the following command in the Terminal. (replacing and monitor interface and the BSSID with the BSSID that you copied down above):
reaver -i mon0 -b [bssid] -vv
For example, if your monitor interface was mon0 like mine, and your BSSID was
8D:AE:9D:65:1F:B2
(a BSSID I just made up), your command would look like:
reaver -i mon0 -b 8D:AE:9D:65:1F:B2 -vv
Press Enter, sit back, and let Reaver work its disturbing magic. Reaver will now try a series of PINs on the router in a brute force attack, one after another. This will take a while. In my successful test, Reaver took about 6 hours to crack the PIN and deliver me the correct password. The Reaver documentation says it can take between 4 and 10 hours so it could take more or less time than I experienced, depending.
***THIS TUTORIAL IS INTENDED FOR INFORMATIONAL AND EDUCATIONAL USE ONLY***
Use these techniques only on networks that you explicitly own.


How to hack facebook by kali linux


Welcome back, my  hackers!Continuing with my series on how to crack passwords, I now want to introduce you to one of the newest and best designed password crackers out there—hashcat. The beauty of hashcat is in its design, which focuses on speed and versatility. It enables us to crack multiple types of hashes, in multiple ways, very fast.As mentioned in the first part of this series, passwords are stored in a one-way encryption called hashes. There are multiple ways of obtaining these hashes, such as .dll injection in Windows systems or capturing the hash in transit, such as in WPA2 wireless cracking.


Once we can grab the hash, the next step becomes one of finding an effective and efficient way of cracking it. There are numerous tools, some of which I have highlighted in other articles here, but hashcat is unique in its design and versatility, so let’s take a look at how it works.


Step 1: Fire Up Kali & Open Hashcat

Let’s start by firing up Kali and opening hashcat. Go to Applications -> Kali Linux -> Password Attacks -> Offline Attacks -> hashcat, as seen below.
When we click on the hashcat menu item, it opens the help screen.
At the top of the screen, you can see the basic hashcat syntax:
kali > hashcat options hashfile mask|wordfiles|directories
We can see some of the options for hashcat displayed below the basic syntax. Some of the most important of these are -m (the hashtype) and -a(attack mode). In general, we will need to use both of these options in most password cracking attempts with hashcat.

Step 2: More Extensive Options

If we scan a bit further down this hashcat help screen, we can see more options. The first two below are some of the key options that hashcat enables.
First, hashcat enables rules that allow us to apply specifically designed rules to use on our wordlist file. These rules can take our wordlist file and apply capitalization rules, special characters, word combinations, appended and prepended numbers, and so on. Each of these will help us to break passwords that have been made more complex to avoid dictionary attacks.
The next stanza shows us custom character sets. This enables us to set the character set that we want to use to crack the passwords. If we know the company’s or institution’s password policy, we can choose a subset of all characters to meet their policy and speed up our cracking. For instance, if a company allows an all-numeric character set, choose to crack the hashes with just numbers. These types of passwords are VERY easy to crack.
The next screen includes some of the more obscure options, including theoutput file type, the debug mode and the built-in character sets.
Finally, we have to chose the type of hash we are trying to crack. Hashcat gives us numerous options. When we get ready to crack the hash, we need to designate in our command what type of hash we are working with by giving hashcat the number associated with the hash type. Here we can see a list of some of the hash types hashcat can work with.

Step 3: Choose Your Wordlist

In this tutorial, we will be using a simple dictionary attack on some Linuxhashes. To do so, we need a wordlist to work from. There are literally thousands of wordlists available on the web, but Kali has numerous wordlists built right in, so let’s try using one of those.
To find the built in wordlists in Kali, we can type:
kali > locate wordlist
When we do, we can see that there are dozens of wordlists available.                                                  
I will be using the wordlist built for sqlmap, which has over one million words and hybrid words.

Step 4: Grab the Hashes

In the next step, we need to grab the hashes on our Kali system. If we are logged in as root, we can see and grab the hashes. In Linux, the hashes are stored in the/etc/shadow file, so if we type:
kali > tail /etc/shadow
We can see the shadow file with the hashes, as below.
Next, we need to know what type of hashing the system is using. In Linux, we go to the /etc/login.defs to view what encryption type the system is using. We open that file by typing:
kali > more /etc/login.defs
When we navigate about 85% down the file, we can see that Kali is using SHA512 encryption. This is important, as we will need to tell hashcat this information when we are ready to crack the hashes.

Step 5: Crack the Hashes!

Now, that we know the basics of hashcat, where the hashes are located and the type of encryption, we are ready to begin cracking the hashes.
Let’s first put those hashes into a separate file we will name hash.lst.
kali > cp /etc/shadow hash.lst
To make sure that they were copied over, let’s check by typing:
more hash.lst
As we can see, the hashes have been copied over to the hash.lst file.
To prepare this file for cracking, we need to remove all of the information in this file, except the hashes. The /etc/shadow file includes the username, then the salted hash, and then information about the applicable user policy. We need to remove all that information leaving just the hash.
We can see that this file starts with the username, i.e., “user1″, “user2″, etc. Open this file in your favorite text editor (vim, vi, leafpad) and delete the username and the following colon. Then, go to the end of the line and remove the information after the hash that starts with a colon (:). Now we will have a file with just the hashes and nothing else.
In the final step, we can now start cracking the hashes. Here’s the command I used.
kali > hashcat -m 1800 -a 0 -o cracked.txt –remove hash.lst /usr/share/sqlmap/txt/wordlist.txt
  • -m 1800 designates the type of hash we are cracking (SHA-512)
  • -a 0 designates a dictionary attack
  • -o cracked.txt is the output file for the cracked passwords
  • –remove tells hashcat to remove the hash after it has been cracked
  • hash.lst is our input file of hashes
  • /usr/share/sqlmap/txt/wordlist.txt is the absolute path to our wordlist for this dictionary attack
Once the cracking process starts, we can hit <enter> to get an update on the process. When hashcat has completed its work, you will see a screen like below where hashcat announces that it has recovered all my hashes after 9 :47:16 of work.
Now, we only need to open the cracked.txt file to view our cracked passwords!
Hashcat may be the world’s best password cracking tool right now, so take some time to get to know it. It has many more features that we have not yet touched on, and a version that uses your GPU (oclhashcat) that can crack passwords many times faster than your CPU can!

Tutorial on Hacking With Kali Linux

Tutorial on Hacking With Kali Linux


Hacking With Kali Linux


Why Kali Linux?


With Kali Linux, hacking becomes much easier since you have all the tools (more than 300 pre-installed tools) you are probably ever gonna need. Others can be downloaded easily. Now this tutorial will get you started and you'll be hacking with Kali Linux before you know it.





The problem with beginners

Now, I've been dealing with beginners since a long time. What they want is magic. A tool which is easy to use, works on Windows, can be download by searching on Google and clicking on the first link we see, and will do all the hacking itself on the push of a button. Sadly, no such tool exists. Hacking is an art, and it takes years of practice to master it. So how to get started? Having no idea about hacking is okay, but being a newbie with computers in general is not allowed. When I say beginner, I mean someone who has no experience with programming and with hacking methodologies. I didn't mean someone who needs a 1 page guide on how to download a tool. If you want to be a hacker, you have to work hard. So how to get started? If you have installed Kali Linux,  click here to skip past the installation paragraphs and go to hacking section of this post)
Download Kali Linux:-
Click on this Link
                                                                          Download Torrent file



Getting StartedNow, I am not boring you with theory (^ As if all this wasn't enough theory). My aim is to get you to the point where you can start hacking with Kali Linux as soon as possible. What I'm gonna do is tell you what to do. The process is rather simple :-
  • If you are totally clueless as to what kali linux is - Go to kali.org and get an idea.
  • If you haven't already done that,go to their download page and download Kali Linux.

Now this is where things get tougher. If you have no previous experience with Linux and virtual machines and all that stuff, getting Kali Linux up and running won't be a piece of cake.You have 2 options :
1) Read the Kali documentation and get an idea about what is a virtual machine, how OS can be run from USB, and how to create a partition and run 2 OS simultaneously. This is what I recommend. For that, go to Kali Official Documentation . 
2) The second option is to look at these posts, which are just sparingly modified versions of the Kali docs, and offer no advantage other than saving your time as their documentations cover much more than what the ones here do, and you don't really need to know all so much... yet.



Command Line Interface

Some bash commands
Now, if you are really sure about becoming a hacker, you have to get used to linux, and specifically the command line interface. It is often compared to (and rightly so) to command prompt of Windows, but Linux' cli is much efficient and better than command prompt. What you have to do is do all the usual tasks you do in Windows in cli of Linux. Use cd to navigate, poweroff to shutdown, etc.
A pretty awesome site for that is - http://linuxcommand.org/
Going through the complete site is on its own enough exercise to keep you occupied for a month, but you can proceed gradually. The first few tutorials here will keep in mind that you don't have much info about cli, and will be really beginner friendly.



    Some Useful Commands:

    If you don't plan on learning all of linux cli commands, here are a few that will keep your boat afloat.
    1. The default username and password is 'root' and 'toor'. 
    2. Type 'poweroff' in the terminal to shutdown. 
    3. apt-get command can be used to install tools and updates. 
    4. apt-get update and apt-get upgrade will update all the programs installed on your machine. 
    5. apt-get dist-upgrade will install the latest distribution of Kali(i.e. it upgrades your OS).
    PS : Tapping <tab> while typing makes Kali complete the word for you . Double tapping <tab> makes it display all possible words starting with the incomplete word. Ctrl+c stops the functioning of any tool that is running. Pressing the up arrow key shows the command you last typed.


    Some Real Hacking With Kali Linux

    Assuming you've gone through the above steps and are comfortable with your new hacking environment, its time to do some real hacking with Kali Linux.My recommendation would be to start by hacking a wifi, then do some penetration testing, and maybe read something on Denial of Service when you have free time.

    Kali Linux Commands

    A-Z of Kali Linux commands are here below: a apropos  Search Help manual pages (man -k) apt-get  Search for and install sof...