Image
 
linkedin_logo.png rss_logo.jpg
twitter_logo.png youtube_logo.jpg
Latest Additions
 
EH-Net Login
Welcome Guest.






Lost Password?
No account yet? Register
Who's Online
We have 66 guests online
EH-Net News Feeds
Latest Additions
 
Advertisement

You are here: Home arrow Forum arrow Resourcesarrow Tutorialsarrow Nmap Scans: Part 1
EH-Net
May 25, 2012, 03:50:17 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Advertise on EH-Net!! - Reasonable Rates, Highly Targeted Audience.
 
   Home   Help Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Nmap Scans: Part 1  (Read 6452 times)
0 Members and 1 Guest are viewing this topic.
Equix3n-
Sr. Member
****
Offline Offline

Posts: 379



View Profile
« on: February 09, 2009, 04:08:49 AM »

In this tutorial I'll teach you some basic Nmap scans.

Before learning about the scan methods you should have a basic understanding of TCP and UDP. So I'll also cover these topics very briefly.

UDP

UDP stands  for User Datagram Protocol.
UDP is a connectionless protocol i.e packets are sent from one party to another without any prior connection establishment between the two. This method of transmission doesn't guarantee that the data will reach it's destination. The packets may be delayed, arrive out of sequence or lost.
Thus we can say that UDP isn't a reliable protocol.

TCP
TCP stands for Transmission Control Protocol.
TCP is a connection oriented protocol i.e data exchange occurs between the sender and the receiver only after a connection is established between the two.
Connection is established using three way handshake.

To understand the three way handshake you have to know about the flags field in a TCP header.

Flags field or control field is a 6 bit field and is used to relay control information between TCP peers.
The various types of flags are:
A: SYN or synchronize flag is used to synchronize the sequence numbers.

B:FIN or finish is used to tell the remote machine to terminate the connection.

C:ACK or acknowledgment is the acknowledgment field significant.

D:PSH or push flag is a notification from the sender to the receiver to pass all the data the receiver has to the receiving application.

E:URG or urgent flag signifies that the packet contains urgent data.

F:RST or reset flag is used to reset the connection.

With the knowledge of flags under our belt we can proceed to learn Three -way handshake.

Suppose computer A wants to establish a connection with computer B.
1:Firstly, computer A sends a packet with SYN flag set to computer B
2:Computer B after receiving the SYN packet sends packet with SYN-ACK flag  set to computer A.
3:When computer A receives the SYN-ACK packet it sends a packet with ACK flag set to computer B.
4:Finally, when computer B receives the ACK packet the connection is established.

Computer A --------------------->SYN------------------->Computer B

Computer A<-------------------SYN-ACK<-------------------Computer B

Computer B---------------------->ACK------------------->Computer B



Let's now discuss the Nmap scan methods.

The first scan we'll be talking about is the SYN Scan or sometimes called the half-open scan

A: SYN Scan

SYN scan or half-open scan is almost like the three-way handshake except for one step.
1: Firstly Nmap sends a SYN packet to the destination port.
2: The destination post -if open- replies with a SYN-ACK packet.
3: Now Nmap doesn't wants to establish a connection and instead of sending an ACK response sends a packet with RST flag, and this is where it deviates from the normal three-way handshake.

The steps explained above were for open ports. In case of closed ports:
1:Firstly Nmap sends a SYN packet to the destination port.
2:The remote port -since it's closed- sends a RST response.

Nmap ------------------>SYN------------------->Remote port

Nmap<----------------SYN-ACK<----------------Remote port

Nmap------------------->RST------------------->Remote port

                            OPEN PORT



Nmap ------------------>SYN---------------->Remote port

Nmap<-------------------RST<----------------Remote port

                           CLOSED PORT


Sometimes it happens that Nmap sends a SYN packet to the remote port and gets no response. It means that a firewall is blocking the packet. Nmap declares these posts as filtered

Nmap ------------------>SYN---------------->Remote port

Nmap---------------NO RESPONSE-------------Remote port

                        FILTERED PORTS



SYN scan is the default scan if you are running as a privileged user

The syntax to run this scan in CLI is:
nmap -sS Remote I.P

Here -sS is the SYN scan command and the remote I.P is the I.P address that you want to scan.

So the command looks like this:

You must be asking that if SYN scan is the default scan then for privileged users then why is it necessary to specify the SYN scan command? Well, it isn't. The scan will work perfectly by just using the command: 
nmap remote I.P

But it's a good practice to specify this command in case you are'nt running privileged in which case TCP connect() scan is the default scan.

That's it for this part. I'll be taking more scans in the other parts of this tutorial.
« Last Edit: February 13, 2009, 07:33:08 AM by Xen » Logged
pibe86
Newbie
*
Offline Offline

Posts: 7


View Profile WWW
« Reply #1 on: February 09, 2009, 09:30:28 AM »

nice, i am goint to install BACK TRACK after that  i will try this tutorial


thanks

just a question, where do u work men?
Logged

Equix3n-
Sr. Member
****
Offline Offline

Posts: 379



View Profile
« Reply #2 on: February 10, 2009, 06:52:22 AM »

Quote
nice, i am goint to install BACK TRACK after that  i will try this tutorial
There' a windows version of Nmap too.

just a question, where do u work men?


I'm a second year computer science engineering student.
« Last Edit: February 10, 2009, 07:46:53 AM by Xen » Logged
jason
Hero Member
*****
Offline Offline

Posts: 945



View Profile
« Reply #3 on: February 10, 2009, 12:24:37 PM »

You can find the various version of Nmap, as well as the source code here:

http://nmap.org/download.html
Logged
pibe86
Newbie
*
Offline Offline

Posts: 7


View Profile WWW
« Reply #4 on: February 14, 2009, 12:46:13 AM »

i dont like using windows, i rather using gnu/linux as my O.S

i have installed BT4 and it works better than  i thoght

now let's try nmap tutorials
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Page created in 0.117 seconds with 22 queries.
 

gk_static-ad_feb2012.jpg
Global Knowledge: Build Security Skills to Protect & Defend

els_130x200fixed2.gif
eLearnSecurity Student Course Now Live!
5% Off with Code
ELS-EH-5

SANS Deals 4 EH-Netters
$150 OFF Any SANS Course in Any Format!
Coupon Code: EHN_Connect Including SANS Security West 2012 & SANSFIRE 2012
Recent Forum Topics

cbtnuggets_logo_125.jpg
Try CBT Nuggets Free!

Vote For EH-Net

Add to Technorati Favorites
technorati fave

 
         
Advertisement

© 2012 The Ethical Hacker Network
Joomla! is Free Software released under the GNU/GPL License.