Nmap (”Network Mapper”) is a free open source utility for network exploration or security auditing. It was designed to rapidly scan large networks, although it works fine against single hosts. Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics. Nmap runs on most types of computers and both console and graphical versions are available. (source)
First and foremost we will download, compile and install nmap from scratch under Linux. The latest Nmap sources available for download is 4.21ALPHA4 which you can download from here: http://download.insecure.org/nmap/dist/nmap-4.21ALPHA4.tar.bz2
However the stable version is 4.20 .
First we will download the latest source from it’s website:
Now we are going to go through the process Extracting the bzip2 file, “configure” it and “make install” it from the source. With this commands:
bzip2 -cd nmap-4.21ALPHA4.tar.bz2 | tar xvf -
cd nmap-4.21ALPHA4
./configure
make
su root
make install
During the process of installing I get this error:
nmapfe.c:114:2: error: #error “Your system does not appear to have GTK (www.gtk.org) installed. Thus the Nmap X Front End will not compile. You should still be able to use Nmap the normal way (via text console). GUIs are for wimps anyway :)”
Like it said GUIs are for wimps anyways. And besides we will be mostly using console for this demonstration.
You can look at the whole output from my console, during the installation here:
http://www.linuxhaxor.net/nmap_output.html
Nmap has a huge list of scanning options and scanning modes, here is the output list of options:
pavs@uberhaxor:~$ nmap
Nmap 4.21ALPHA4 ( http://insecure.org )
Usage: nmap [Scan Type(s)] [Options] {target specification}
TARGET SPECIFICATION:
Can pass hostnames, IP addresses, networks, etc.
Ex: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254
-iL: Input from list of hosts/networks
-iR: Choose random targets
–exclude: Exclude hosts/networks
–excludefile: Exclude list from file
HOST DISCOVERY:
-sL: List Scan - simply list targets to scan
-sP: Ping Scan - go no further than determining if host is online
-P0: Treat all hosts as online — skip host discovery
-PS/PA/PU [portlist]: TCP SYN/ACK or UDP discovery to given ports
-PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes
-n/-R: Never do DNS resolution/Always resolve [default: sometimes]
–dns-servers: Specify custom DNS servers
–system-dns: Use OS’s DNS resolver
SCAN TECHNIQUES:
-sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans
-sU: UDP Scan
-sN/sF/sX: TCP Null, FIN, and Xmas scans
–scanflags: Customize TCP scan flags
-sI: Idlescan
-sO: IP protocol scan
-b: FTP bounce scan
–traceroute: Trace hop path to each host
PORT SPECIFICATION AND SCAN ORDER:
-p: Only scan specified ports
Ex: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080
-F: Fast - Scan only the ports listed in the nmap-services file)
-r: Scan ports consecutively - don’t randomize
SERVICE/VERSION DETECTION:
-sV: Probe open ports to determine service/version info
–version-intensity: Set from 0 (light) to 9 (try all probes)
–version-light: Limit to most likely probes (intensity 2)
–version-all: Try every single probe (intensity 9)
–version-trace: Show detailed version scan activity (for debugging)
SCRIPT SCAN:
-sC: equivalent to –script=safe,intrusive
–script=: is a comma separated list of dirs or scripts
–script-trace: Show all data sent and received
–script-updatedb: Update the script database. Only performed if -sC or –script was also given.
OS DETECTION:
-O: Enable OS detection (try 2nd generation w/fallback to 1st)
-O2: Only use the new OS detection system (no fallback)
-O1: Only use the old (1st generation) OS detection system
–osscan-limit: Limit OS detection to promising targets
–osscan-guess: Guess OS more aggressively
TIMING AND PERFORMANCE:
Options which takeSEE THE MAN PAGE FOR MANY MORE OPTIONS, DESCRIPTIONS, AND EXAMPLES








Restart your system for good measure, and now you should see "InnoTek VirtualBox" in your application menu—it was in "System Tools' in Gutsy. Get your XP CD ready and fire up VirtualBox. Choose "New" from the button menu, and then give your virtual system a name (WIndows XP usually works for me) and choose "Windows XP" from the bottom menu, then hit "Next." Decide how much RAM you'll dedicate to it in the next window, hit "Next," then, assuming you haven't done this before, hit "New" and follow the prompts to set up hard drive space for your virtual XP system. Make sure that partition is selected, hit "Next," then hit "Finish" to set up your new XP space.
Back at VirtualBox's main screen, see if the "CD/DVD-ROM" menu is highlighted. If not, click it, and then check "Mount CD/DVD Drive," "Host CD/DVD Drive" (and make sure it points to your system's CD drive), and check yes for "Enable Passthrough." Hit OK, select your XP image from the left-hand column and hit "Start." You'll launch into the hopefully familiar XP installation routine; follow it through until you're at your Windows desktop.
Now you've got a working Windows inside a resizable box, but let's take this further. Remove your XP CD from the drive, head up to the "Devices" menu and choose "Unmount CD/DVD-ROM." In the same menu, choose "Install Guest Additions." VirtualBox should prompt you to download the Guest Additions ISO file, then select it to be mounted. This creates a virtual CD drive in XP, which you can get to through Start Menu->My Computer (it might take a moment to show up). Double-click the "CD drive" and follow the prompts to install the extra tools. Reboot once you're done for good measure, and restart the XP machine.
The Start panel's default bottom position can be a problem for GNOME-based systems, since you've already got an app-switching bar there. I recommend either moving your Start or GNOME menus to the left or right-hand sides, or setting your Start menu to double-height, which puts the Start button just above the GNOME bar. Either way, make sure you un-check the "Keep the taskbar on top of other windows" option on the Windows toolbar, or you might see a few graphical glitches. Otherwise, pretty neat, huh?
Now for the final touch: Synchronizing the two desktops. In XP, hit the "Run" dialog and type in "regedit." Make a backup first (File->Export), and then navigate to HKEY_CURRENT_USER -> Software -> Microsoft -> Windows -> CurrentVersion -> Explorer -> User Shell Folders. Double-click to open the properties on the "Desktop" key you'll find there, and enter a new value of (without the quotes) "x:". You should see the change immediately—everything you put on your Linux desktop is shown in Windows and vice versa—handy for storing downloads grabbed in Windows.