Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 14th, 2008, 6:24 PM   #1
joeserhal
Newbie
 
Join Date: Feb 2008
Posts: 12
Rep Power: 0 joeserhal is on a distinguished road
port scan detection

Hi there,
I'm currently working on a PROJECT (so it can be clear) regarding port scan detection. I have written a code which is able to read all packets arriving on the device, and extract necessary information such as source & destination addresses, destination port, protocol used... Having done this, I have no idea how to proceed next regarding the actual the detection of a port scan...
I have some questions regarding this:

1) How can I know if a port being scanned is "open" or not (if the port is closed, and someone sends a packet/request to that port, doesn't it imply that it's an attack??)
2) Also, when I receive the packets, and I want to do a real-time/ live detection, should I only read the info in the packets and then determine whether it is an attack and discard after that the packet, OR do I have to store the packets in someway in order to use them later for the detection??

Can anybody provide with some info regarding this...I really need some help as I do not know how to proceed from this current point?!

Thanks
joeserhal is offline   Reply With Quote
Old Apr 14th, 2008, 8:34 PM   #2
Wizard1988
Professional Programmer
 
Wizard1988's Avatar
 
Join Date: Oct 2005
Location: Chitown
Posts: 414
Rep Power: 3 Wizard1988 is on a distinguished road
Send a message via AIM to Wizard1988
Re: port scan detection

Well for a port being open, I would say you would somehow check if there is a program/service listening for connection requests. For example if you wanted to get all the active phone numbers in a certain area code you could simply dial them one by one. If someone picks up then you say is an "open" port. This isn't a perfect analogy, because you would get a different signal, but I hope you still get the point.
__________________
JG-Webdesign
Wizard1988 is offline   Reply With Quote
Old Apr 15th, 2008, 7:03 AM   #3
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 630
Rep Power: 4 Jessehk is on a distinguished road
Re: port scan detection

I don't know anything about this, but if I wanted to, I would look at the source for nmap. nmap is a fairly popular port-scanner for (Li, U)nix and you might get some ideas from it.
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS!
Jessehk is offline   Reply With Quote
Old Apr 15th, 2008, 7:17 AM   #4
Wizard1988
Professional Programmer
 
Wizard1988's Avatar
 
Join Date: Oct 2005
Location: Chitown
Posts: 414
Rep Power: 3 Wizard1988 is on a distinguished road
Send a message via AIM to Wizard1988
Re: port scan detection

This might help you a bit http://www.cs.wright.edu/~pmateti/Courses/499/Probing/
__________________
JG-Webdesign
Wizard1988 is offline   Reply With Quote
Old Apr 15th, 2008, 11:39 AM   #5
joeserhal
Newbie
 
Join Date: Feb 2008
Posts: 12
Rep Power: 0 joeserhal is on a distinguished road
Re: port scan detection

Thanks for the info guys...I have another question: Do you know how I can modify the attached file to determine/print the values of the flags in the TCP header (I'm talking about the FYN, SYN, RST, ACK....flags) when I receive the packets??

Thanks again for the info!
Attached Files
File Type: c grab_packets.c (9.5 KB, 4 views)
joeserhal is offline   Reply With Quote
Old Apr 15th, 2008, 1:41 PM   #6
Ka0s
Newbie
 
Join Date: Apr 2008
Posts: 2
Rep Power: 0 Ka0s is on a distinguished road
Re: port scan detection

I'm supposing you dont want to do a port scanner but you want to detect if you're being target of a port scanner right?

In that case, the next thing i would do is to check if you receive connection requests from the same ip address but to a large number of different ports...
This is not perfect because the one who is port scanning you can spoof his ip address making connection requests with different ip numbers... but that's up to you to solve (but i dont think there's a real solution to this)
Ka0s is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Serial Port Communication hoffmandirt C# 3 Sep 19th, 2007 3:38 PM
Very simple Python port scanner. Riddle Python 4 Jul 29th, 2005 3:59 PM
Getting the process that's opening port x? layer C++ 2 May 12th, 2005 8:44 AM
Program related to Printer Port Programming post shadowhunter C++ 9 Apr 6th, 2005 7:04 PM
port programming dominic C++ 1 Feb 14th, 2005 10:52 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:32 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC