Saltar al contenido
Underc0de /foro

Pentesting Workshop with Kali Linux #2

🌐 This is an automatic translation of a topic from Underc0de, the largest Spanish-speaking hacking and IT community. Read the original (Spanish) and reply →
ANTRAX ·
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />INTRODUCTION<br /><br />Dear reader, welcome to this new edition of the Pentesting saga of the Underc0de forum. I am MagoAstral and I am pleased to be the tutor who will develop this edition. Like you, I am an enthusiast of computer security and insecurity, and I think it is very timely to create a manual talking a bit about that toolbox the pentester usually uses in their audits, and what better moment than with the release of the new version of Kali Linux.<br /><br />I must say this will be an installation from the perspective of a novice user. Before starting with the topic, I will list the requirements to carry out the phases that will be developed in this workshop or manual:<br /><br />•   Virtualization software; on this occasion VMware Workstation 11 will be used<br />•   Kali Linux version 2.0 image<br />•   10 GB free for the system installation<br />•   768 MB of RAM for Gnome 3<br /><br />These would be the recommended requirements; it is worth noting that the desktop environment will be changed throughout the manual to a lighter one (xfce), this step is a matter of taste and comfort. If you feel confident with Gnome, you can stay with Gnome, I am nobody to push you to use an environment you don't know, although I do advise you to try it.<br /><br />As we know, when performing a penetration test, time is a factor that plays against us and therefore it is very important to automate the process. That is why we use a distribution oriented to that task, since it will normally supply us with any tool we need. Personally I like the quote: "What matters is not the time you have, but how you use that time", and that is where Kali  Linux comes into play.<br /><br />Before starting the installation let's talk a bit about Kali Linux. Obviously it is a distribution designed for computer security and audits, which in turn is based on Debian (GNU/Linux) and was founded by Offensive Security Ltd.<br /><br />Its initial release was on March 13, 2013 and it is considered the successor of BackTrack (those who have been in the pentest world for a little while will have worked with it); the second version of Kali Linux was released on August 11, 2015. An important fact to highlight is that, since Kali Linux has various security and auditing tools, it is recommended to run it as a superuser (root) to avoid conflicts. <br />From my point of view I recommend using it virtualized and on an isolated network segment when auditing your labs, since it is not advisable to expose those machines to the network of networks; obviously if you are going to work with this system continuously you will see that many auditors have it as their base system, but if you are in the initial stages, that is my recommendation.<br /><br />Regarding the changes in Kali Linux, its new version has a 4.0 kernel based on Debian Jessie, they have obviously updated their arsenal of tools, and it has become a rolling release distribution. As for the desktop environment, we now have Gnome 3 -but as I said before- I lean towards XFCE, so I will show how to install it.<br /><br />With nothing more to add, we can now proceed to download the system image; for that we go to: Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br />Once downloaded I would recommend verifying that it is the original image, so we will proceed to check its SHA-1 hash:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />As we can see the hashes match, therefore we can now begin creating the virtual machine and installing Kali Linux.<br /><br />CREATING THE VIRTUAL MACHINE: VMWARE<br /><br />We will start by opening VMware and creating a new virtual machine; this time we will select typical configuration and load the ISO like this:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />The next step, continuing with the installation, is to select Debian 7.x and the corresponding architecture, in my case 64 bit (if you have the Debian 8 option, select it, since it would correspond to Debian Jessie):<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />We continue by choosing the machine name, which in my case will be Kali Linux:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />In the next window it asks us to specify the virtual disk size; in my case I will set 25 GB and leave the second option selected as follows:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />Then all that's left is to finish the creation process and we will have our virtual machine. Finally we are going to configure the network; in my case I will set it to bridged adapter mode and add a little more random access memory (RAM). The final result would be:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />At this point we have finished creating and configuring our virtual machine. In the next section we will proceed to install Kali Linux. <br /><br /><br />INSTALLING KALI LINUX<br /><br />Once the machine boots we will select the graphical install:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />When we enter graphical mode we will select our keyboard, location and language (I will skip these steps since it is just clicking). Next it will ask for our hostname; obviously you can put whatever you want:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />Then it will ask for a domain name, which we will leave blank, and after that it's time to fill in the superuser password.<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />We will continue by configuring the clock to match our time zone and we will reach the disk partitioning section. As I said, this will be an installation from a novice's perspective, so we will select guided - use entire disk:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />We will select the only disk we have and then put all files in one partition:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />We finish partitioning and write the changes to disk:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />Then we would confirm the operation and the system installation process would begin. Next it asks whether we want to use a network mirror; we will leave it at yes since it is essential for installing from the Kali Linux repositories:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />The proxy is optional; in my case I will leave it blank. Now it's time to install GRUB and we will install it to the master boot record, so we select the default option:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />In this step we will select the device where we are going to install the boot loader:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />And after selecting it we will have successfully finished installing our Kali Linux:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />After rebooting the system and entering our credentials (root) the final result will be:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />Perfect! Now we have our Kali Linux ready to use, but obviously we still have the post-installation process, which is almost as important as, or more important than, the installation process. <br />The first thing will be to check that our sources.list contains all the Kali repositories (Los enlaces son solo para miembros. Registrate o iniciá sesión); for that we will simply run:<br /><br />
Código: bash
cat /etc/apt/sources.list
<br /><br />As we can see everything is correct:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />So now it's time to update our Kali Linux and keep it up to date, so we will run:<br /><br />
Código: bash
apt-get clean && apt-get update && apt-get upgrade –y && apt-get dist-upgrade –y
<br /><br />My terminal output:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />After this, we can proceed to install the respective Linux headers:<br /><br />
Código: bash
aptitude install build-essential Linux-headers-$(uname –r)
<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />Once the headers are installed, we can proceed to insert the VMware tools to freely adjust our system's resolution: <br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />After inserting the VMware tools, we proceed to extract the file, enter the directory and install them:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />Once the installation of these tools is finished, we will be ready to adjust the display:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />This concludes the basic post-installation part. <br /><br /><br />INSTALLING XFCE<br /><br />We are going to install another desktop environment; this time, as I said before, we will install XFCE, and for that we type in our terminal:<br /><br />
Código: bash
apt-get install kali-defaults kali-root-login desktop-base xfce4 xfce4-places-plugin xfce4-goodies
<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />Now we will install lightdm using the following syntax:<br /><br />
Código: bash
apt-get install lightdm xfce4
<br /><br />And we will configure the session from:<br /><br />
Código: bash
/usr/share/xsessions/
<br /><br />We will use our favorite editor, in my case nano:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />After editing the session manager our xfce should start; if we reboot we will see that the changes have been applied correctly:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />The final result:<br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />I would leave it here since I don't like to overload the system with unnecessary effects or customize it, but since I admit it doesn't look very attractive visually, let's customize the system a bit. To customize our xfce we can go to: Los enlaces son solo para miembros. Registrate o iniciá sesión , where we will find a variety of wallpapers, icons, themes, etc... <br /><br />I will assume you know how to install themes and icons, since it is simply moving them to the path /usr/share/themes or /usr/share/icons (depending on what you are installing).<br /><br />Then in the applications menu we go to settings and in appearance we select the installed themes and icons.<br /><br />And after this customization process, you could end up with something similar to the following image: <br /><br />
Los enlaces son solo para miembros. Registrate o iniciá sesión
<br /><br />With this I conclude this installment; it has been a pleasure guiding you through this process. <br /><br /><br /><br />
zupa ·
You're good at explaining, which is why it's perfectly understandable.<br /><br />I know it will be useful to many, and since it's my base system I recommend Kali to dive fully into pentesting.<br /><br />Regards
D3ivid ·
Great @MagoAstral  I'll get on it first thing tomorrow, I hope I manage it, even if just out of curiosity  xD
RisingMage ·
Hi, how's it going, thanks for the article.<br /><br />By any chance would you know how to install the KDE graphical environment?<br /><br />Regards.
salem ·
I can't install xfce4, it says aborted, why
R.JimSor ·
Thanks a lot for the workshop. I've been trying to install Kali Linux on my old laptop; it installs, and when it boots the screen stays on the Kali wallpaper but with no icons and no response to any key. I reinstalled Ubuntu and that one does work.
matadorg7 ·
Hi Mago Astral, a question: I'm new to Linux in general. I installed Kali following your post, did the updates and everything was fine. However, when I try to start the metasploit service with the command " Service Metasploit Start" I get the error "Failed yo start metasploit.service: Unir metasploit.service failed to load: No such file or directory<br /><br />If I run service postgresql start it does start correctly.<br /><br />I'd appreciate it if you could point me in the right direction<br /><br />Sent from my A0001 using Tapatalk<br /><br />
MagoAstral ·
Cita de: matadorg7 en Septiembre 04, 2015, 12:18:09 PM<br />Hi Mago Astral, a question: I'm new to Linux in general. I installed Kali following your post, did the updates and everything was fine. However, when I try to start the metasploit service with the command " Service Metasploit Start" I get the error "Failed yo start metasploit.service: Unir metasploit.service failed to load: No such file or directory<br /><br />If I run service postgresql start it does start correctly.<br /><br />I'd appreciate it if you could point me in the right direction<br /><br />Sent from my A0001 using Tapatalk<br /><br /><br />
<br />Hi, basically you don't have it installed as a service. You can verify my hypothesis with the following syntax:<br />
Código: bash
<br />ls /etc/init.d
<br />Regards
Snifer ·
Cita de: matadorg7 en Septiembre 04, 2015, 12:18:09 PM<br />Hi Mago Astral, a question: I'm new to Linux in general. I installed Kali following your post, did the updates and everything was fine. However, when I try to start the metasploit service with the command " Service Metasploit Start" I get the error "Failed yo start metasploit.service: Unir metasploit.service failed to load: No such file or directory<br /><br />If I run service postgresql start it does start correctly.<br /><br />I'd appreciate it if you could point me in the right direction<br /><br />Sent from my A0001 using Tapatalk<br />
<br /><br />Check the following link and your doubts will be cleared up .. Los enlaces son solo para miembros. Registrate o iniciá sesión<br /><br />Regards<br />Snifer
matadorg7 ·
Cita de: MagoAstral en Septiembre 04, 2015, 12:38:57 PM<br />
Cita de: matadorg7 en Septiembre 04, 2015, 12:18:09 PM<br />Hi Mago Astral, a question: I'm new to Linux in general. I installed Kali following your post, did the updates and everything was fine. However, when I try to start the metasploit service with the command " Service Metasploit Start" I get the error "Failed yo start metasploit.service: Unir metasploit.service failed to load: No such file or directory<br /><br />If I run service postgresql start it does start correctly.<br /><br />I'd appreciate it if you could point me in the right direction<br /><br />Sent from my A0001 using Tapatalk<br /><br /><br />
<br />Hi, basically you don't have it installed as a service. You can verify my hypothesis with the following syntax:<br />
Código: bash
<br />ls /etc/init.d
<br />Regards<br />
<br />Thanks a lot MagoAstral, as soon as I have access to my PC I'll check. Now, if I didn't have it as a service, how do I install it?<br /><br />Sent from my A0001 using Tapatalk<br /><br />
Grupo de WhatsApp