In this section, we will prepare our Kali Linux machine as the attacker. Note that we are assuming that the operating system is already set up in VMware or VirtualBox. As of now, we will be using VirtualBox for all our chapters.
We can check the version of any Linux OS by running the following cat
command to display the content from the file /etc/os-release
, which contains OS distribution data. We will be using Kali Linux version 2018.1, as you can see from the following screenshot:
It doesn't matter what your Kali version is. For this book, we will be using the latest version available at the time of writing. Since, by default, Python is preinstalled in every Linux distribution, we can get the version details from either the interactive shell by running the command python
or by using python -V
, as shown in the following screenshot:
We will be using Python 2.7.14+
for now, which came preinstalled with our Linux version.
So, let's go for networking a little bit. In this chapter, the Kali IP is 10.0.2.15
. We can check the Kali IP by running the ifconfig eth0
command. This will return the network interface configuration as shown here:
To set up the internet on our system, we just need to change the network mode to Network Address Translation (NAT)
in VirtualBox. NAT
mode will mask all network activity as if it came from your host OS, although VirtualBox can access external resources. To do this, perform the following steps:
- Click on the
Devices
menu from VirtualBox's menu bar - Go to
Network
and selectNetwork Settings
- Select the network mode as
NAT
and click onOK
as shown in the following screenshot:
Once you perform the preceding steps, you should be able to reach the internet, as long as the VirtualBox host does. You can check internet access by running ping 8.8.8.8
from the terminal.
Now, if you don't have a GUI compiler for Python, you can just install it using the following command:
apt-get install idle
Once it's installed, let's do a quick print program using IDLE (using Python-2.7),which we installed using the previous command. Open a new Python file and type print ('hello there')
. Run the program and save it on the desktop. Once you finish accessing the internet, you now need to change the network mode back to Internal Network
so that we can reach out to our Windows target. This is shown in the following screenshot:
Note
Note that the Windows target globally machine is sitting on the same internal network as Kali attacker globally machine, intnet
, here.
And, as a last step, we should verify that we still got the same IP address, which is 10.0.2.15
by running ifconfig
in the terminal.