Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi show all IP's on the network that listen to specific portnr (https://www.delphipraxis.net/84731-show-all-ips-network-listen-specific-portnr.html)

Glenndevos 20. Jan 2007 20:11


show all IP's on the network that listen to specific portnr
 
Hello All,

First, many thanks for sharing such good info on this site, it helped me very much.
I did however not find something I need : a small routine that show all IP's on a network that listen to a specific port. I work with the TclientSocket components under D7.
I tried already connecting to all IP's but when you try to connect to each client, you get errormsg that teh connection was not accepted.

Thanks in advance for some help in the right direction

GruBen
Glenn

marabu 20. Jan 2007 20:40

Re: show all IP's on the network that listen to specific por
 
Welcome to Delphi-PRAXiS, Glenn.

Your boat sails under the name "portscanner". Have a look at this short sample code to get started.

Enjoy your visit.

Glenndevos 20. Jan 2007 22:29

Re: show all IP's on the network that listen to specific por
 
Many thanks. I placed the code in a loop to check a certain range with a progressbar indicating the progress but found that for some IP adresses, there's a (too) big delay, takes approx. 4-5 seconds for an IP-adress that is not connected on the network. If I do a netstat on the doscommand prompt, that takes 0.5 seconds ... any option to speed things up ?

Thanks !
Glenn

Delphi-Quellcode:
for i := offset to last do
  begin
  progress := progress + progressstep;
  progressbar1.Position := round(progress);

  adrestocheck := IPA1.text + '.' + IPA2.text + '.' + IPA3.text + '.'+inttostr(i);

  WSAStartup($0101,WSAData);

  if checkportopen(adrestocheck,6363) then
    begin
      memo1.Lines.Add(adrestocheck);

    end
    else
    begin
      label1.caption :=('not');
    end;
  WSACleanUp;
  end;

marabu 21. Jan 2007 17:42

Re: show all IP's on the network that listen to specific por
 
Hi Glenn,

no matter what libraries or components your port scanner employs: You really should do an ICMP prescan to rule out dead IP addresses. Only thereafter you should run a port scan on the remaining set of addresses you kept in a TList or TStringList. That way you won't suffer from aggregating timeouts.

Regards


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:08 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz