skip to main | skip to sidebar

Smiertx Site

Copyleft (C) 2007 smiertx-bani-ikhyar. This tutorial comes with ABSOLUTELY NO WARRANTY. This is free tutorial, and you are welcome to redistribute it under certain conditions. See the GNU General Public License for more details.

About Me

My Photo
smiertx bani ikhyar ...............
View my complete profile

Facebook Badge

Ikhyar Smiertx Subani

Create Your Badge
HOW-TO SYMBIAN Free e-book Telco
Linux Solaris HP-UX F5 BIG-IP Streaming Misc.
Howto re-install PHP support Oracle Client
Monitoring Dual Master MySQL Replication
Howto Dual Master MySQL Replication
Howto Change datadir MySQL
Howto setting proxy on Linux
Howto RedHat Cluster Manager
Howto Linux GRUB recovery
Howto adjust max. simultaneous connection on apache
Howto MySQL Replication
Howto SSH gateway with iptables
Howto nmap on Linux
Howto setting Qmail on Linux 6
Howto setting Qmail on Linux 5
Howto setting Qmail on Linux 4
Howto setting Qmail on Linux 3
Howto setting Qmail on Linux 2
Howto setting Qmail on Linux 1
Howto install Drupal on Linux
Howto customize Gnome on Linux
Howto install MPlayer and codecs on Linux
Howto compile kernel on Linux
Howto setting IP Bonding on Linux
Howto setting OpenSSH SSH Server on Linux
Howto setting Webalizer on Linux
Howto setting MRTG on Linux
Howto setting Linux as Router
Howto setting Linux as Gateway
Howto setting Camserv on Linux
Howto setting edna on Linux
Howto setting Squid Proxy Server on Linux
Howto setting BIND DNS Server on Linux
Howto setting Apache Web Server on Linux
Howto setting vsftpd FTP Server on Linux
Howto setting DHCP Server on Linux
Howto setting Samba on Linux
Howto setting ILOM
Howto configure boot device order on ILOM
Howto configure network on ILOM
Howto soft partition on Solaris
Howto Hardening system kernel on Solaris
Howto Hardening Network on Solaris
Howto mirror disk on Solaris
Setting ALOM on Solaris
Howto Logadm on Solaris
Howto User Jail on ProFTPd
General Solaris Commands
Show I/O error on Solaris
Setting File Descriptor kernel paramater on Solaris
Setting TCP kernel parameter on Solaris
Howto IPMP on Solaris - link based detection
Howto IPMP on Solaris - probe based detection
Howto Virtual host on ProFTPd
Howto adjust free memory
Default SAR commands on Solaris
Howto netstat on Solaris
Howto vmstat on Solaris
Howto iostat on Solaris
Howto SAR on Solaris
Howto Install Oracle Client on Sparc
Howto Re-Install Oracle Database on Sparc
Howto Install Oracle Database on Sparc
Howto setting ethernet parameter on Solaris
Howto detect ethernet on Solaris
Howto Routing on Solaris
Howto setting IP virtual on Solaris
Howto setting IP address on Solaris
Howto NTP Server On Solaris 2
Howto NTP Server On Solaris 1
Howto NFS Server On Solaris 2
Howto NFS Server On Solaris 1
Differences between trusted and non-trusted systems
Howto cstm on HP-UX
Monitoring LED status on HP Server
Show HP-UX kernel parameter
Show Hardware info on HP Server
Howto Storage Area Network on HP-UX
Howto mirror disk on HP-UX 2
Howto mirror disk on HP-UX 1
Howto mirror root disk on HP-UX
Howto unlocked root/user on HP-UX
Show memory info on HP-UX
Show ethernet card info on HP-UX
Show machine info on HP-UX
Howto Install depot files on HP-UX
Howto setting hostname on HP-UX
Howto setting IP address on HP-UX
Howto Persistence Profile on F5 BIG-IP LTM
Howto Rebooting SCCP F5 BIG-IP LTM 2
Howto Rebooting SCCP F5 BIG-IP LTM 1
Howto resolve failed loading license on F5 BIG-IP LTM
Howto resolve chassis fan reported as bad on F5 BIG-IP LTM
Howto iRule on F5 BIG-IP LTM
Howto tagged & untagged interface on F5 BIG-IP LTM
Howto Activate License on F5 BIG-IP LTM
Howto Live transcoding HTTP/MMS/RTSP streaming 5
Howto Live transcoding HTTP/MMS/RTSP streaming 4
Howto Live transcoding HTTP/MMS/RTSP streaming 3
Howto Live transcoding HTTP/MMS/RTSP streaming 2
Howto Live transcoding HTTP/MMS/RTSP streaming 1
Howto channel redundant on Helix Server
Howto multicast on Switch
Streaming Solution with Helix and F5 BIG-IP LTM
Howto unicast on Helix Server
Howto setting Helix Mobile Producer
Howto setting Helix Server
Howto Pull Spliting and URL aliasing on Helix
Howto physical connection EMC CLAriion, IBM Blade, SAN Switch, Cisco Switch
Howto Initialized EMC Storage CLAriion
-----
Howto setting Cisco Switch 2960 G
-----
SAN Switch Config Commands
SAN Switch Show Commands
-----
Howto prevent SMTP Open Relay
Howto setting SMTP Open Relay 4
Howto setting SMTP Open Relay 3
Howto setting SMTP Open Relay 2
Howto setting SMTP Open Relay 1
Application Games
Advanced Call Manager
Application Manager
CellTrack NetMonitor
FExplorer
Flash SMS
Gmail
IP Dump
LCG Jukebox
n70 Torch
Nimbuzz
Power MP3
Putty Mobile
Real One Mobile
SeleQ
SMS Planner
3D bigfoot racing
4Wheel Xtreme 3D
Age of Empires III
Aiolos Fighter
Airstrike 1944
Asphalt 3 - Street Rules
Asphalt 4 - Elite Racing
Assassin Creed
Batman - The dark knight
Beowulf
Call Of Duty V - World At War
Dark Knight
Death Race
Delta Corps
Die Hard 4
Guitar Hero 3
Harry Potter - Mastering Magic
Harry Potter
High Speed 5 3D
Indiana Jones And The Kingdom Of The Crystal Skull
King Kong
Lords of the Rings - Two Towers
Metal Slug X
Mission Impossible III
NBA Pro Basketball 2009
NFS Most Wanted
Pro Evolution Soccer 2009
Power Rangers - mystic force
Prince of Persia - The Sands of Time
Prince of Persia - The Two Thrones
Prince of Persia - Warrior Within
Rush Hour 3
Sim City Metropolis
Sky Force Reloaded
Splinter Cell Chaos Theory
Street Fighter II champion edition
Wall-E
Zuma
RedHat Linux [based on experience] book
HLR (Home Location Register)
Definition
--------------------
GGSN (Gateway GPRS Support Node)
Definition

Another of me

  • Facebook
  • Linkedin
  • T-SHIRT Shop
  • YouTube

Translate to your Language



Add to Technorati Favorites

 

January 11, 2008

Nmap on Linux


Nmap is a very powerful tool with lots of options and features to visualize your network. Check which services are running on various hosts and find suspicious malicious programs running in your network. Even though Nmap is the swiss-army knife for network scanning, most of its benefits can be gained by the average Network Administrator without diving deep in to its complications. Chances are, most of the time you will find yourself using common switches even if you know all of them.

The basic syntax for Nmap is:

nmap 192.168.0.1

the above command scans the given host with defaults - standard TCP connect method (-sT option) and known ports (those specified in the /etc/services file. You may need to scan a whole subnet, in which case you can use:

nmap 192.168.0.1/24
nmap 192.168.0.*

both the command would do the same here.

One of the simplest scan methods that I come up with almost every day is the Ping Scan:

nmap -sP 192.168.0.1
Starting nmap 3.70 ( http://www.insecure.org/nmap/ ) at 2008-01-11 11:35 WIT
Host web.smiert.org (192.168.0.1) appears to be up.
MAC Address: 00:14:5E:1B:15:F0 (Unknown)
Nmap run completed -- 1 IP address (1 host up) scanned in 0.283 seconds

the -sP option simply pings the host and reports back whether the host is up or down. Run in the local network, it gives you some additional detail such as MAC Address and the Company for which the NIC card is registered. It is also possible to ping sweep your entire network by specifying a network address and the bitmask.

Stealth Scanning might come in handy too (-sS):

nmap -sS 192.168.0.1

Starting nmap 3.70 ( http://www.insecure.org/nmap/ ) at 2008-01-11 11:36 WIT
Interesting ports on web.smiert.org (192.168.0.1):
(The 1653 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
443/tcp open https
967/tcp open unknown
4444/tcp open krb524
8080/tcp open http-proxy
MAC Address: 00:14:5E:1B:15:F0 (Unknown)

Nmap run completed -- 1 IP address (1 host up) scanned in 0.353 seconds

The -sT method (default) makes a full connection to that port to see whether the port is open. But in a stealth scan a SYN packet is sent to the host and waits until a SYN from the target host is received to see whether the port is open or closed. In other words does not make a full connection, which reduces the chance of being seen on a target log file.

Scan specific ports and port ranges (-p) :

nmap -sS 192.168.0.1 -p 22,80,50-500

Starting nmap 3.70 ( http://www.insecure.org/nmap/ ) at 2008-01-11 13:15 WIT
Interesting ports on web.smiert.org (192.168.0.1):
(The 448 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
443/tcp open https
MAC Address: 00:14:5E:1B:15:F0 (Unknown)

Nmap run completed -- 1 IP address (1 host up) scanned in 0.301 seconds

the above command scans the target host for ports 25, 80 and the range between 50 and 500.

OS detection (-O):

nmap -sS 192.168.0.1 -O

Starting nmap 3.70 ( http://www.insecure.org/nmap/ ) at 2008-01-11 13:16 WIT
Interesting ports on web.smiert.org (192.168.0.1):
(The 1653 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
443/tcp open https
967/tcp open unknown
4444/tcp open krb524
8080/tcp open http-proxy
MAC Address: 00:14:5E:1B:15:F0 (Unknown)
Device type: general purpose
Running: Linux 2.4.X|2.5.X|2.6.X
OS details: Linux 2.4.18 - 2.6.4 (x86)
Uptime 36.737 days (since Wed Dec 5 19:35:30 2007)

Nmap run completed -- 1 IP address (1 host up) scanned in 2.366 seconds

the -O option displays the Operating System and its version running on target system. This may not be accurate and may sometimes fail to identify the target OS. But most of the time you’ll end up being lucky…trust me…!

Detect the version of running services (-sV):

nmap -sV 192.168.0.1

Starting nmap 3.70 ( http://www.insecure.org/nmap/ ) at 2008-01-11 13:17 WIT
Interesting ports on web.smiert.org (192.168.0.1):
(The 1653 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 3.9p1 (protocol 1.99)
80/tcp open http Apache httpd 2.0.52 ((Red Hat))
111/tcp open rpcbind 2 (rpc #100000)
443/tcp open ssl/http Apache httpd 2.0.52 ((Red Hat))
967/tcp open rpc
4444/tcp open krb524?
8080/tcp open http Apache Tomcat/Coyote JSP engine 1.1
MAC Address: 00:14:5E:1B:15:F0 (Unknown)

Nmap run completed -- 1 IP address (1 host up) scanned in 10.524 seconds

You may also use the -A switch to request Nmap to check for OS version as well as Services version which is easier. There are many other options such as -D (decoy), -sU (UDP scan), etc; not specified in this tutorial that might be useful to you. Please check the nmap documentation and evolve you knowledge on Nmap.
Newer Post Older Post Home