Yesterday my eagerly awaited package was in the mail. I received my Atheros AR9271 USB WiFi Adapter that I ordered from AliExpress. A network interface that can easily be used with Kali Linux. Better yet, since it’s a USB adapter, it can be used within a virtual machine as a WiFi interface. Perfect! So we have everything we need to go from zero to Kali on a MacBook with external WiFi. Let’s get this up and running!
I used VirtualBox as I am planning to ditch my MacBook Pro sooner or later in favor of a Dell XPS. Since I want to keep using the VM then, I want to use a cross-platform solution for my virtualization. You can of course use whatever you like. But I need you to figure out the equivalent settings yourself. That being said, here’s what we need to get our system up:
- Kali Linux (I used 2018.1, you can use the latest version)
- A USB WiFi adapter with a supported chipset, I used an Atheros AR9271
Go ahead and download the first ones, then run through the VirtualBox installation. It is straightforward and after that we can get to work.
Setting up the VM
After starting the setup, you will be prompted to give your VM a name. I called mine Kali Linux, the Type is Linux and as the version I selected Linux 2.6 / 3.x / 4.x (64-bit) as the Linux Kernel of Kali 2018.1 is 4.14.x. I’ve seen people using Debian as the Version as well since Kali is based on Debian. So either one should be fine.
I gave my machine 4096 MB of RAM as my host has 8GB. More is better, so feel free to bump it up if you can. 1GB is the required minimum and 2 is recommended. Those values come from the Kali docs itself. Next, you should select to create a hard drive. Leave the default of VDI (Virtual Disk Image) when asked. After that you’ll be asked if you want a dynamically growing machine or one of a fixed size. The decision is yours. A fixed size will run a bit faster but a dynamically growing partition will not allocate the entire disk space right from the beginning. I chose the dynamically growing partition and gave it 40GB. That’s it, you should now have a list entry in VirtualBox similar to this one:
Configuring the VM
Perfect, we still need to do a bit of configuration before we can fire up the machine. Select the gear icon for Settings. Under Storage select the empty IDE Controller and choose your Kali Linux iso. This will be your boot image.
Next, navigate over to Network and select a Bridged Network for your adapter. Either use your WiFi adapter (AirPort) or a wired connection, depending on how you are connected to your network. That’s it. Click OK and then hit Start to boot up your machine, the installation will start
Installing Kali Linux
The Kali installation is pretty straightforward. Select the Graphical Install and go through the installer. As there is no specific install for a VM, I’d recommend using the official docs to get through the installation.
Basically you select your language, your location, you choose a hostname (I used kali). For partitioning towards the end, use Guided, use entire disk. Also keep all files on one partition. Select yes when asked to use a network mirror, so the system will be updated during installation. I also installed the Grub boot loaded when I was asked. That are basically all major screens. Kali will eject the disk and reboot. Please refer to the official documentation for screen shots as they are always up-to-date.
Kali for the first time
Next, you’ll find yourself in Kali. First, let’s install the Guest Additions from VirtualBox to improve the VM experience. Open up the Terminal, you’ll find it as the second icon in the task bar in the left
apt-get update apt-get install -y virtualbox-guest-x11 reboot
That will also restart your machine. When it comes back up, let’s update all the packages. Open the Terminal back up.
apt-get update apt-get dist-upgrade shutdown -h now
The first two commands will take quite a while, so prepare to get yourself a coffee – or two, if you’re like me and you’re drinking it a bit faster. The third command will shut down your machine.
Provide the external WiFi adapter
So, now that your machine is turned off, plug your USB WiFi adapter into your MacBook, open the VM’s settings again and navigate to Ports. The Mac itself probably won’t support the WiFi adapter, because… Well, it’s Apple. Apple won’t support what they don’t know, own whatsoever. As you can see, there is a reason why I want to ditch the MacBook, right?! I’m really getting annoyed by this. Anyways, in the VM’s Ports Settings, select USB, enable it and select the add symbol (the one with the plus, you know). The select, your ATHEROS device.
Then unplug the device again and boot up Kali.
After Kali booted, plug the device back in. Kali should catch it itself, since the drivers are already installed. Wait for a moment to have it initialized. After a few seconds, maybe thirty, open the Terminal and try
to list network interfaces and their wifi status.
If it’s not picked up yet, like in the print screen above, try to grep the usb info from
dmesg displays the Kernel information and we might be able to see what’s going on.
dmesg | grep usb
The output of that should be similar to the following. You see that the device is registered and the firmware properly installed. That’s why I can see it in iwconfig.
I had trouble when the adapter was already plugged into my machine when Kali booted. If you experience the same issue, make sure to have the adapter unplugged and only attach it, when Kali is already up and running.
Installation done, now for the housekeeping!
Congratulations! You should now have an up-to-date Kali Linux that is able to recognize your WiFi adapter. Let’s create a snapshot of the Virtual Machine to have a fallback if we ever messed up the environment. Shut down Kali and open VirtualBox back up. Select Machine Tools in the top right corner and then Snapshots. Hit the new snapshot button – again the one with the plus symbol. Give it a name, I named it Clean start and save it. Whenever you mess up the environment now, you can always select Clean start and select to restore. You can then start from this configuration.
So, that’s it. Enjoy your fresh Kali installation. Run through the documentation of Kali, aircrack-ng, metasploit, whatever you want. Start small and crack your first WiFi. Make sure, you only crack your own or you have permission to crack it! Don’t mess with other peoples networks!