Hack Like a Pro: How to Compile a New Hacking Tool in Kali « Null Byte :: WonderHowTo

Welcome back, my newbie hackers!Recently, I "upgraded" toKalias my hacking platform, despite my preference forBackTrack. I did this reluctantly, primarily because new readers here could no longer download BackTrack from their site. I want to point out here that we all must keep in mind that with any software—or for that matter, any product—that is newer is not necessarily better.Although Kali has some new tools and has new version of old tools, the developers of Kali left out some very valuable ones. A tool that I am missing most isSnort.Snort is the world's most widely used Intrusion Detection System (IDS), and as such, I use it to test whether my exploits can get past it without detection. In the previous versions of BackTrack, Snort has always been included, but not Kali. I thought I would take this opportunity to show you how to download, install, and compile a new tool to Kali, using Snort as an example.The Process of Compiling Tools for KaliThe process will differ slightly for each tool, but the overall process is very similar. In the case of Snort, we have some dependencies that must be installed to make it work properly. Other tools may or may not have dependencies. One of the advantages of using a package manager such asrpmor.debis that it will usually handle the dependencies for you. The drawback is that you get a tool that is not necessarily optimized for your platform.By compiling the tool, we can optimize it for our platform. This means that it will run faster and more efficiently. In a production environment for Snort, this is critical. A slow or inefficient Snort will either drop packets or slowdown your network. Neither is good, so let's look at installing Snort from its source code and compiling it specifically for our platform.Step 1: Download SnortYou can download Snort atsnort.org.When you click on "Download Snort" button, it will take you to this page.Select the "Source" snort.2.9.6.1.tar.gz. If you are using a browser, it will prompt you with the following screen. Chose to save Snort. In this case, I saved it to my Desktop, but you can save it wherever is convenient and easiest for you.As you can see, the source file is now on my Desktop in Kali.Step 2: Pre-InstallationBefore we install Snort, there are few pieces of software that Snort needs to run properly. These are often referred to as dependencies. They can include library files and other files that an application needs to run. In the case of Snort, there are a few.Let's do that now.kali> sudo apt-get install flex bison build-essential checkinstall libpcap-dev libnet1-dev libpcre3-dev libmysqlclient15-dev libnetfilter-queue-dev iptables-devYou will be prompted twice with (y/n). Simply selectyto both.Step 3: Build & Install LibnetNext, we need to download, build, and installlibnetfrom the source. We can download it fromhere. In this case, I'm using the command-line download toolwget.kali >wgethttps://libdnet.googlecode.com/files/libdnet-1.12.tgzOnce we have successfully downloaded libdnet, we need to untar it, configure it and make it.First , untar it:kali >tar xvfvz libdnet-1.12.tgzThen, change directories to the new libnet directory:kali > cd libdnet-1.12And configure it with the "CFLAGS=-fPIC" for a 64-bit version:kali > ./configure "CFLAGS=-fPIC"And finally,makethe file:kali > makeWe should then be greeted by a screen like that below.Step 4: Build Symbolic Link to Where Snort Looks for LibnetWe need to build a symbolic link from where libnet is, to the location where Snort expects libnet to be, by typing:kali> ln -s /usr/local/lib/libdnet.1.0.1 /usr/lib/libdnet.1Step 5: Build & Install Data Acquisistion (DAQ) LibrarySnort has what is called a Data Acquisistion Library (DAQ). This is an abstraction layer for I/O (input/output) that enables us to plug different hardware/software interfaces for packet I/O. We can download it at snort.org as well.I've downloaded it and placed it on my Desktop as well.We go to the terminal and cd to the Desktop directory and then untar this file.kali> tar xvfvz daq-2.0.2.tar.gzThen we change directories to the new daq directory:kali> cd daq-2.0.2And configure it:kali > ./configureThen finally,makethe file:kali > makeStep 6: Install SnortNow that we have all the files we need to run Snort, let's complete the installation of Snort. Change to the Desktop directory. You should see the Snort source code there.Next, let's change directories to/binand make a directory in the /bin directory named snort. Let's now copy the snort source code to that directory:kali > cp /root/Desktop/ snort-2.9.6.1.tar.gz /bin/snortNext, let's untar it:kali > tar xzvf snort-2.9.6.1.tar.gzStep 7: CompileIn our final step, we need to compile Snort. Let's change to the new directory that was created when we untarred the source code file.kali> cd /bin/snort/snort-2.9.6.1Now, let's configure it.kali > ./configureAnd finally, make Snort.kali >makeNow we should have a compiled version of Snort specifically compiled for our platform! We can now run Snort by simply typing snort at the command prompt:kali >snortAlthough the steps with differ slightly for different tools, the basic steps to compile a new tool are:Download the toolUntar and uncompress the toolConfigure the toolMake the toolHope this all helps with having compiled Snort, but most importantly, I hope it helps with understanding how to compile ANY tool inLinux, and specifically, Kali. If all this seems too much, you can always simply use the package manager, aptitude (apt-get install snort). This will install the binaries for your platform, but not necessarily optimize it for your platform.Keep coming back, my newbie hackers, as we continue along this exhilarating learning path to becoming pro hackers!Want to start making money as a white hat hacker?Jump-start your hacking career with our2020 Premium Ethical Hacking Certification Training Bundlefrom the newNull Byte Shopand get over 60 hours of training from cybersecurity professionals.Buy Now (90% off) >Other worthwhile deals to check out:97% off The Ultimate 2021 White Hat Hacker Certification Bundle99% off The 2021 All-in-One Data Scientist Mega Bundle98% off The 2021 Premium Learn To Code Certification Bundle62% off MindMaster Mind Mapping Software: Perpetual LicenseCover image viaShutterstockRelatedHow To:Hack WPA WiFi Passwords by Cracking the WPS PINHow To:Use MinGW to Compile Windows Exploits on Kali LinuxHack Like a Pro:Digital Forensics Using Kali, Part 1 (The Tools of a Forensic Investigator)The Hacks of Mr. Robot:How to Build a Hacking Raspberry PiHow To:Links to Help You HackingHack Like a Pro:How to Build Your Own Exploits, Part 2 (Writing a Simple Buffer Overflow in C)Hack Like a Pro:How to Create a Smartphone Pentesting LabHow To:Run Kali Linux as a Windows SubsystemMac for Hackers:How to Install the Metasploit FrameworkHow To:Get Started with Kali Linux (2014 Version)How To:Install iLok plug-ins for Pro Tools 8 in Mac OS XHow to Hack Wi-Fi:Breaking a WPS PIN to Get the Password with BullyHow To:Mix and master in Pro Tools 8How To:Hack WiFi Using a WPS Pixie Dust AttackHow To:Load Kali Linux on the Raspberry Pi 4 for the Ultimate Miniature Hacking StationHow To:Build a Portable Pen-Testing Pi BoxHack Like a Pro:How to Hack Web Apps, Part 2 (Website Spidering with WebScarab)Hack Like a Pro:How to Clone Any Website Using HTTrackHack Like a Pro:How to Install BackTrack 5 (With Metasploit) as a Dual Boot Hacking SystemNews:Day 2 Of Our New WorldNews:What does Pro Tools HD Native mean for you?News:First Steps of Compiling a Program in Linux