Daniel W. Dieterle
Cover design and photo provided by Moriah Dieterle.
Thanks to my family for their unending support and prayer, you are truly a gift from God!
Thanks to my friends in the infosec & cybersecurity community for sharing your knowledge and
time with me. And thanks to my friends in our local book writers club (especially you Bill!),
without your input, companionship and advice, this would have never happened.
Daniel Dieterle
“It is said that if you know your enemies and know yourself, you will not be imperiled in a
hundred battles” - Sun Tzu
“Behold, I send you forth as sheep in the midst of wolves: be ye therefore wise as serpents, and
harmless as doves.” - Matthew 10:16 (KJV)
Thanks to my friends in the infosec & cybersecurity community for sharing your knowledge and
time with me. And thanks to my friends in our local book writers club (especially you Bill!),
without your input, companionship and advice, this would have never happened.
Daniel Dieterle
“It is said that if you know your enemies and know yourself, you will not be imperiled in a
hundred battles” - Sun Tzu
“Behold, I send you forth as sheep in the midst of wolves: be ye therefore wise as serpents, and
harmless as doves.” - Matthew 10:16 (KJV)
Daniel W. Dieterle has worked in the IT field for over 20 years. During this time he
worked for a computer support company where he provided computer and network
support for hundreds of companies across Upstate New York and throughout Northern
Pennsylvania.
He also worked in a Fortune 500 corporate data center, briefly worked at an Ivy League school’s computer support department and served as an executive at an electrical engineering company.
For about the last 5 years Daniel has been completely focused on security. He created and authors the “CyberArms Computer Security Blog”, and his articles have been published in international security magazines, and referenced by both technical entities and the media.
Daniel has assisted with numerous security training classes and technical training books mainly based on Backtrack and Kali Linux.
Daniel W. Dieterle
Introduction
What is Kali?
Kali is the latest and greatest version of the ever popular Backtrack Linux penetration testing
distribution. The creators of the Backtrack series kept Kali in a format very similar to Backtrack, so anyone familiar with the older Backtrack platform will feel right at home.
Kali has been re-vamped from the ground up to be the best and most feature rich Ethical Hacking/
Pentesting distribution available. Kali also runs on more hardware devices greatly increasing your
options for computer security penetration testing or “pentesting” systems.
If you are coming to Kali from a Backtrack background, after a short familiarization period you
should find that everything is very similar and your comfort level should grow very quickly.
If you are new to Kali, once you get used to it, you will find an easy to use security testing platform that includes hundreds of useful and powerful tools to test and help secure your network systems.
Why Use Kali?
Kali includes over 300 security testing tools. A lot of the redundant tools from Backtrack have been removed and the tool interface streamlined. You can now get to the most used tools quickly as they appear in a top ten security tool menu. You can also find these same tools and a plethora of others all neatly categorized in the menu system.
Kali allows you to use similar tools and techniques that a hacker would use to test the security of your network so you can find and correct these issues before a real hacker finds them.
I would think the biggest drive to use Kali over commercial security solutions is the price. Security testing tools can be extremely costly, Kali is free! Secondly, Kali includes open source versions of numerous commercial security products, so you could conceivably replace costly programs by simply using Kali.
All though Kali does includes several free versions of popular software programs that can be
upgraded to the full featured paid versions and used directly through Kali.
There really are no major tool usage differences between Backtrack and Kali. Kali is basically
Backtrack version 6, or the latest version of Backtrack. But it has been completely retooled from the ground up, making software updates and additions much easier.
In Backtrack updating some programs seemed to break others, in Kali, you update everything using the Kali update command which keeps system integrity much better.
Simply update Kali and it will pull down the latest versions of the included tools for you. Just a note of caution, updating tools individually could break Kali, so running the Kali update is always the best way to get the latest packages for the OS.
I must admit though, some tools that I liked in the original Backtrack are missing in Kali. It is not too big of a deal as another tool in Kali most likely does the same or similar thing. And then again you can install other programs you like if needed.
In addition to stand alone and virtual machine instances of Kali, I also use Kali on a Raspberry Pi - a mini credit card sized ARM based computer. With Kali, you can do almost everything on a Pi that you could do on a full sized system. In my book I will cover using the PI as a security testing platform including testing Wireless networks.
Testing networks with a computer you could fit in your pocket, how cool is that?
Though Kali can’t possibly contain all the possible security tools that every individual would prefer, it contains enough that Kali could be used from beginning to end. Don’t forget that Kali is not just a security tool, but a full-fledged Linux Operating System. So if your favorite tool runs under Linux, but is not included, most likely you can install and run it in Kali.
Ethical Hacking Issues
Using Ethical Hacking a security tester basically acts like a hacker. He uses tools and techniques that a hacker would most likely use to test a target network’s security. The difference is, the penetration tester is hired by the company to test its security and when done reveals to the leadership team how they got in and what they can do to plug the holes.
The biggest issue I see in using these techniques is ethics and law. Some security testing techniques that you can perform with Kali and its included tools are actually illegal to do in some areas. So it is important that users check their local, State and Federal laws before using Kali.
Also, you may have some users that try to use Kali, a very powerful set of tools, on a network that they do not have permission to do so. Or they will try to use a technique they learned but may have not mastered on a production network.
All of these are potential legal and ethical issues.
Scope of this Book
This book focuses on those with beginning to intermediate experience with Backtrack/ Kali. I think it would also be a good tool for network administrators and non-security IT professionals that are looking to get into the field.
We will cover everything from a basic overview of Kali to using the included tools to test security on Windows and Linux based systems. We will cover Social Engineering, Wi-Fi security, using Kali on a Raspberry Pi, exploiting passwords, basic computer security testing from reconnaissance to finding & using exploits, and finally securing your systems.
Why did I write this book?
I have written technical articles on Backtrack for several years now, and have helped out with
multiple Backtrack/ Kali books and training series. I get a lot of questions on how to use Kali/
Backtrack, so I decided that it was time to write my own beginners guide book.
My other reason for writing this book is to help get young people interested in the field of computer security. The US is currently facing a crisis when it comes to young professionals choosing technical careers and the cyber security field is no different.
The US government is in need of thousands1 of cyber warriors and some industry experts have even suggested that the US consider hiring security experts2 from other countries to fill in the gap. Think about that for a minute.
The numbers game is against us also. The US is the number two user of the internet, with 81% of our population connected. Now consider the fact that China is in the number one spot3 with almost double the amount of users. And their connected rate is only at about 41%!
Though many think that the US is ranked number one in cyber offense capabilities, our defense is not ranked that well. With foreign countries making marked advances in cyber security the US needs to get as many brilliant young people into the field as possible, and they need to do it sooner rather than later.
Table of Contents
Chapter 1 - Introduction
What is Kali?
Why Use Kali?
Ethical Hacking Issues
Scope of this Book
Why did I write this book?
Disclaimer
Part 1: Installing and Basic Overview
Chapter 2 - Installing Kali with VMWare Player
Install VMWare Player & Kali
Updating Kali
Installing VMWare Tools for Linux
Installing Metasploitable 2
Windows Virtual Machines
Quick Desktop Tour
Part 2 - Metasploit Tutorial
Chapter 3 – Introduction to Metasploit
Metasploit Overview
Picking an Exploit
Setting Exploit Options
Multiple Target Types
Getting a remote shell on a Windows XP Machine
Picking a Payload
Setting Payload Options
Running the Exploit
Connecting to a Remote Session
Chapter 4 – Meterpreter Shell
Basic Meterpreter Commands
Core Commands
File System Commands
Network Commands
System Commands
Capturing Webcam Video, Screenshots and Sound
Running Scripts
Playing with Modules - Recovering Deleted Files from Remote System
Part 3 - Information Gathering & Mapping
Chapter 5 – Recon Tools
Recon-NG
Using Recon-NG
Dmitry
Netdiscover
Zenmap
Chapter 6 - Shodan
Why scan your network with Shodan?
Filter Guide
Filter Commands
Combined Searches
Shodan Searches with Metasploit
Part 3 - Attacking Hosts
Chapter 7 – Metasploitable Tutorial - Part One
Installing and Using Metasploitable
Scanning for Targets
Exploiting the Unreal IRC Service
Chapter 8 – Metasploitable - Part Two: Scanners
Using a Scanner
Using Additional Scanners
Scanning a Range of Addresses
Exploiting the Samba Service
Chapter 9 – Windows AV Bypass with Veil
Installing Veil
Using Veil
Getting a Remote Shell
Chapter 10 – Windows Privilege Escalation by Bypassing UAC
UAC Bypass
Chapter 11 - Packet Captures and Man-in-the-Middle Attacks
Creating a Man-in-the-Middle attack with Arpspoof
Viewing URL information with Urlsnarf
Viewing Captured Graphics with Driftnet
Remote Packet Capture in Metasploit
Wireshark
Xplico
Chapter 12 – Using the Browser Exploitation Framework
BeEF in Action
PART FOUR - Social Engineering
Chapter 13 – Social Engineering
Introduction
Social Engineering Defense
Chapter 14 – The Social Engineering Toolkit
Staring SET
Mass Emailer
SET ’ s Java PYInjector Attack
Social Engineering Toolkit: PowerShell Attack Vector
More Advanced Attacks with SET
Chapter 15 - Subterfuge
Automatic Browser Attack with Subterfuge
Browser Autopwn
PART FIVE - Password Attacks
Chapter 16 – Cracking Simple LM Hashes
Cracking LM passwords Online
Looking up Hashes in Kali
Chapter 17 – Pass the Hash
Passing the Hash with Psexec
Passing the Hash Toolkit
Defending against Pass the Hash Attacks
Chapter 18 – Mimikatz Plain Text Passwords
Loading the Module
Recovering Hashes and Plain Text Passwords
Chapter 19 – Mimikatz and Utilman
Utilman Login Bypass
Recovering password from a Locked Workstation
Chapter 20 - Keyscan and Lockout Keylogger
Key logging with Meterpreter
Automating KeyScanning with Lockout Keylogger
Chapter 21 - HashCat
Cracking NTLM passwords
Cracking harder passwords
Using a Larger Dictionary File
More advanced cracking
Chapter 22 - Wordlists
Wordlists Included with Kali
Wordlist Generator
Crunch
Download Wordlists from the Web
Chapter 23 – Cracking Linux Passwords
Cracking Linux Passwords
Automating Password Attacks with Hydra
PART SIX – Router and Wi-Fi Attacks
Chapter 24 – Router Attacks
Router Passwords
Routerpwn
Wi-Fi Protected Setup (WPS)
Attacking WPS with Reaver
Attacking WPS with Fern WiFi Cracker
Cracking WPS with Wifite
Chapter 25 – Wireless Network Attacks
Wireless Security Protocols
Viewing Wireless Networks with Airmon-NG
Viewing Wi-Fi Packets and Hidden APs in Wireshark
Turning a Wireless Card into an Access Point
Using MacChanger to Change the Address (MAC) of your Wi-Fi Card
Chapter 26 – Fern WIFI Cracker
Using Fern
Chapter 27 – Wi-Fi Testing with WiFite
Using WiFite
More advanced attacks with WiFite
Chapter 28 – Kismet
Scanning with Kismet
Analyzing the Data
Chapter 29 – Easy Creds
Installing Easy-Creds
Creating a Fake AP with SSL strip Capability
Recovering passwords from secure sessions
PART SEVEN - Raspberry Pi
Chapter 30 – Installing Kali on a Raspberry Pi
Pi Power Supplies and Memory Cards
Installing Kali on a Raspberry Pi
Connecting to a “ Headless ” Pi remotely from a Windows system
Viewing Graphical X Windows Programs Remotely through Putty
Chapter 31 – WiFi Pentesting on a Raspberry Pi
Basic Wi-Fi Pentesting using a Raspberry Pi
WEP and WPA/WPA2 Cracking
CHAPTER EIGHT - Defending your Network
Chapter 32 – Network Defense and Conclusion
Patches & Updates
Firewalls and IPS
Anti-Virus/ Network Security Programs
Limit Services & Authority Levels
Use Script Blocking Programs
Use Long Complex Passwords
Network Security Monitoring
Logging
Educate your users
Scan your Network
Learn Offensive Computer Security
Index