86
Chapter 8
This is a simple script, but it taught you how to use variables and take
input from the keyboard. These are both crucial concepts in scripting that
you will need to use in more complex scripts in future.
Your Very First Hacker Script: Scan for Open Ports
Now that you have some basic scripting skills, let’s move to some slightly
more advanced scripting that has real-world application to hacking. We’ll
use an example from the world of black hat hacking. Black hat hackers are
those with malicious intentions, such as stealing credit card numbers or
defacing websites. White hat hackers are those with good intentions, such
as helping software developers or system administrators make their systems
more secure. Gray hat hackers are those who tend to move between these
two extremes.
Before you continue, you need to become familiar with a simple yet
essential tool named nmap that comes installed on Kali by default. You’ve
likely heard the name; nmap is used to probe a system to see whether it
is connected to the network and finds out what ports are open. From the
open ports discovered, you can surmise what services are running on the
target system. This is a crucial skill for any hacker or system administrator.
In its simplest form, the syntax for running an nmap scan looks like this:
nmap
Not too difficult. The simplest and most reliable nmap scan is the TCP
connect scan, designated with the
-sT
switch in nmap. So, if you wanted to
scan IP address 192.168.181.1 with a TCP scan, you would enter the following: