Hacking

Environmental setup

Environmental setup

The first step in performing ethical hacking involves preparing your system for it. For this, you need to download Kali Linux Operating System and the Virtual Box. 

Kali Linux is a software that comes pre-loaded with command lick hacking tools used in penetration testing and auditing. 

Before you start the installation process, make sure that your system fulfills these installation requirements -

  • Minimum 20 GB of free space in the hard drive. 
  • At least 4 GB of ram is recommended for using Virtual Box.
  • CD-DVD Drive / USB Support

Here are the steps required for the setup -

  • Download Virtual Box

Your system needs some visualization software in order to run Kali Linux, so we are downloading Virtual Box here. It will create a virtual machine inside your current operating system without the need for using another laptop or system. 

You can install Virtual Box using this link -

https://www.virtualbox.org/wiki/Downloads 

  • Download Kali Linux  

Next, we will download Kali Linux using their official download link -

https://www.kali.org/get-kali/

It comes pre-configured with all the programs and applications that we will need for ethical hacking. You can either install it as a virtual machine within the existing operating system or simply download it as your system’s main operating system depending on the compatibility of your system.

  • Now that you have downloaded Kali Linux, you will receive a file with .ova extension. Simply double-click on that file and then click Import to install the Kali Linux. It will be ready to use after this step.
  • Before you start, you can change the settings to modify the RAM, CPU processor, etc. As a rule of thumb, 1 GB of RAM and 1 CPU are enough for running Kali.
  • You can launch Kali by clicking on the Start button. It will prompt the user to insert the username and password. Make sure that you do not forget the password. 

Network Penetration Testing

A network Penetration test can be simply defined as the simulation of a scenario where the hacker will launch an attack on the computer systems or networks. The main aim of this process is to assess the risks or weaknesses of the system before hackers can exploit them. 

The entire process can be divided into four main steps -

  • Gathering information as per client expectations
  • Reconnaissance
  • Penetration testing
  • Reporting on recommendations to improve system security 

Basic of Network

A network is a group of two or more computers linked to share data or resources. They can be connected via a physical connection such as a router or a wireless connection such as a server. 

In networking, each device acts as a node to communicate with other connected devices using packets. For instance, if you share an email or send a message from one computer to another, it will be sent as packets with each packet having the source media control access (MAC address) and destination MAC. 

Pre-connection Attacks

This is the first step in network penetration testing. To perform pre-connection attacks, we need to know the details of connected devices and networks using the following steps -

  • Wireless Interface in Monitor mode

In this mode, the wireless adapter can monitor all traffic by capturing every packet around its range. Often, the mode of wireless interface is set to ‘managed’ in default. This implies that the wireless adapter will only pick packets directed towards our MAC address. But if we wish to capture every packet that’s around us, we need to set it to ‘monitor mode.’

It can be done using the ‘iwconfig’ command which checks your wireless interface. It usually displays the results as wlan0 or managed mode. 

Here are the commands to enable Monitor Mode:-

$ sudo iwconfig

$ sudo ifconfig IFACE down

$ sudo iwconfig IFACE mode monitor

$ sudo ifconfig IFACE up

And then,

$ sudo ifconfig wlan0 down

$ sudo iwconfig wlan0 mode monitor

$ sudo ifconfig wlan0 up

To disable Monitor Mode, use the following commands -

$ sudo ifconfig wlan0 down

$ sudo iwconfig wlan0 mode managed

$ sudo ifconfig wlan0 up

  • About airodump-ng

Airodump-ng is a packet sniffer that displays information on all the networks around us. It is a part of the aircrack-ng package software suite and can list networks around us within seconds. It helps us to collect useful information such as channel names, encryption types, mac addresses, and more. Here is its syntax -

airodump-ng [MonitorModeInterface]  

  • Run airodump-ng

This step involves running airodump-ng and collect information on all devices connected to a particular network. It is useful to run it when we have a target network. 

For instance, if we want to sniff on a specific network DS1Y-UY5 whose BSSID is 60:C6:Y5:AF:F4:53, we will use the command -

root@kali:~# airodump-ng --bssid 60:C6:Y5:AF:F4:53 --channel 6 --write test wlan0

Where --bssid 60:C6:Y5:AF:F4:53 is the access point MAC address. 

--channel 6 is the channel for airodump-ng. 

--write test stores the data in a file named test. 

wlan0 is the name of the wireless interface in Monitor Mode. 

After executing this command, it will show the list of ‘n’ number of devices connected to the network we want to sniff on.  

  • Deauthenticate the wireless client 

Deauthentication attacks enable us to deauthenticate or disconnect from a device from any network. This can be done using a tool called aireplay-ng and its syntax is -

aireplay-ng --deauth [#DeauthPackets] -a [NetworkMac] -c [TargetMac] [Interface]