Solved

UDP Port Scanner

Posted on 2003-11-14
8
1,763 Views
Last Modified: 2012-05-04
Could someone show me how to make a UDP port scanner in delphi.

I've aready made a TCP port scanner, but how would I make a UDP port scanner.

Could someone show me how this is done?
0
Comment
Question by:Shinez
  • 4
  • 2
8 Comments
 
LVL 6

Accepted Solution

by:
GloomyFriar earned 100 total points
ID: 9750481
Just open UDP socket instead TCP socket ;-)
0
 

Author Comment

by:Shinez
ID: 9751204
How Would I do this?
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9753785
Ok, I'll try to explain.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9753825
It's impossible to scan UDP port if it just was opened.
You can determine that UDP port is opened by sending some datagram to the port only.
And if you'll be lucky you'll got an answer from the server.
But server is not obliged to answer to you if you don't know its protocol ;-)

So, if you know what server you are looking for and you know its protocol then try to send some command (according to the protocol) and wait for an answer from the server. ip-by-ip, port-by-port ;-)

Good luck.
0
 

Author Comment

by:Shinez
ID: 9758218
could you show me how this is done, have edit1 for ip and edit2 for port and for label1 to display if port is open/close.

if I wanted to check if the port is open for ut2003.

default game port is 7777, the query port is 7778.

how would I get a responce that the server is up?

please could you give some code with your answer, I don't know that much about UDP.

thxs
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9762835
There is no "open" and "close" terms applying to the UDP protocol.

...
Var buff: array[0..256] of byte;
...
   UDPClient := TNMUDP.Create(self);
   UDPClient.RemoteHost := 'ut2003'; // or something like '192.168.1.15'
   UDPClient.RemotePort := 7778;
   UDPClient.LocalPort := 7777;
   UDPClient.OnDataReceived := UDPClientDataReceived;
   UDPClient.OnStatus := UDPClientStatus;
   UDPClient.OnInvalidHost := UDPClientInvalidHost;
   UDPClient.OnStreamInvalid := UDPClientStreamInvalid;
   UDPClient.OnBufferInvalid := UDPClientBufferInvalid;
...

   StrPCopy(buff, "Hello!");
   try UDPClient.SendBuffer(buff, 7);
   except;
     // Error
   end;

...
procedure TMainForm.UDPClientDataReceived(Sender: TComponent;
  NumberBytes: Integer; FromIP: String);
Var buff: array[0..256] of byte;
begin
  UDPClient.ReadBuffer(buff, NumberBytes);
end;

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi Form ownership 4 70
URL for downloading Google Chrome for Win XP 2 118
Dev Express grid collapse 2 39
Moving (cutting/pasting) controls in a TTabbedNotebook... 7 27
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now