All Windows systems have implemented native tool allowing us to monitor current network connections as well as control what ports we have currently opened and what applications are listening on each port. We can use this simple tool for various purposes such as network connection troubleshooting, trojan and other backdoor application detection and security audits.

In this tutorial I will show you how to use netstat to monitor your current connections and how to make simple batch job to perform this monitoring task online. 

First of all lets have a look what sort of options are offered by netstat:

1. Go to menu Start>Run, type in cmd and press Enter or just press WINDOWS+R, type in cmd and press Enter.
2. Command prompt should pop up on your screen and next type in netstat /? and press Enter.

netstat's options
 Pic. 01.

To check what ports are open we will use command: netstat -a -n which shows us all open TCP and UDP ports. Some of this ports may be at established state that means there is already connection established to the remote host or may be at listening state which means that port is currently open and there is an application listening for incoming connections.

checking port's states by netstat
 Pic. 02.

In this case we can simply troubleshoot network connections for example: if we have DNS server running on our host but client machines cannot obtain DNS answers for their request, we can check if port 53 is opened and is at listening state by issuing netstat -a -n command. In this way we may check if there are any other ports open which could sugges that we have got some unwanted software installed such as trojan horses, key loggers or other backdoor applications.

To find out what application is listening on each port we can use netstat -b -v -n command. In this way netstat shows us what executables are involved in creating each connection.

checking connection executables by netstat
 Pic. 03.

All commands above certainly shows us connection state at the time they have been issued. To perform simple online monitor which shows us connection state by probing port's states every second we can create very simple batch job script:

1. In command prompt type in: edit netstatmon.bat and press Enter.
2. Now we should be in editor's window with blue background, please input such batch code:

:start
cls
netstat -b -n
ping localhost -n 2 >NUL


goto start

3. Press Alt key and choose Save and than Exit.

making simple batch job script to monitor by netstat
 Pic. 04.

In this case I have used ping command to make small delay between each probe so we can observe how our connections are changing. Now put the window with command prompt next to IE window as shown on picture below.

put windows next to each other
 Pic. 05.

1. In command prompt launch our monitor by typing in: netstatmon.bat and press Enter.
2. Try to access any website in IE and observe how the connection is initiated in your command prompt window.
3. To stop running batch job press Ctrl+C and then confirm ending by inputing Y when asked to do that.



If you are finding this article useful, please vote:
( 0 users found this article useful )

Comments

avatar zaczytany w google addsach
0
 
 
czyzby ta strona umarla smiercia naturalna? przypomnij no mi jak to sie nazywa....... chyba cos jak "Slomiany zapal"... albo jakos tak.... miesiac bez wpisu toz to zgroza.....
Name *
Email (For verification & Replies)
URL
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
avatar Runako
0
 
 
Hi all. Great work, webmaster, nice design. Help me! Could you help me find sites on the: Imitrex naproxen sodium. I found only this - Imitrex and naproxen sodium. Objective medication overuse headache moh in cluster headache ch patients methods the authors describe a retrospective series of patients men. Low price viagra pills never have to online imitrex price worry about. With love :mad:, Runako from Uzbekistan.
Name *
Email (For verification & Replies)
URL
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
Hey. It is curious that physical courage should be so common in the world and moral courage so rare.
I am from United and bad know English, give please true I wrote the following sentence: "Executive summary of object desktop 2007 object desktop is a layout of headline extraction sales divided to correct microsoft windows to begin a inventory of automatic manuals."

With respect :-(, Dogpiles stock ticker symbol.
Name *
Email (For verification & Replies)
URL
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
avatar MayoSara31
0
 
 
Cars and houses are quite expensive and not everybody is able to buy it. Nevertheless, loan are invented to aid people in such hard situations.
Name *
Email (For verification & Replies)
URL
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
avatar petrty
0
 
 
interesting ideas are aired there. I am generally interested in such kind of stuff and look for something fresh and new mostly by means of rapidshare search engine http://rapid4me.com . But this video is something absolutely new for me.
Name *
Email (For verification & Replies)
URL
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
Very interesting
Name *
Email (For verification & Replies)
URL
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
avatar Adriano
0
 
 
Molto interessante blog che ho bruciacchiato per il RSS tradotto tramite RssItaliano
Name *
Email (For verification & Replies)
URL
Code   
ChronoComments by Joomla Professional Solutions
Submit Comment
Cancel
Name *
Email (For verification & Replies)
URL
Code   
Submit Comment

Last Updated ( Friday, 24 April 2009 12:00 )