Recent

Author Topic: Code for scanning systems attached to network  (Read 9204 times)

vfclists

  • Hero Member
  • *****
  • Posts: 856
    • HowTos Considered Harmful?
Code for scanning systems attached to network
« on: May 21, 2010, 09:18:36 am »
I am looking for some code which can scan a network range for address, and obtain the MAC addresses of those that respond.

I am looking for code which works like http://www.radmin.com/products/utilities/ipscanner.php

Is there some code snippet or component for this?
« Last Edit: May 21, 2010, 09:26:18 am by vfclists »
Lazarus 2.1.0/FPC 3.2.0

Almindor

  • Sr. Member
  • ****
  • Posts: 412
    • http://www.astarot.tk
Re: Code for scanning systems attached to network
« Reply #1 on: May 21, 2010, 06:52:19 pm »
You can use lNet's UDP broadcast for basic "find computers on the network". I use this in Lentilwars to find server on the LAN.

vfclists

  • Hero Member
  • *****
  • Posts: 856
    • HowTos Considered Harmful?
Re: Code for scanning systems attached to network
« Reply #2 on: June 03, 2010, 06:45:41 am »
Do you have some sample code for this?

Looking in Lentilwars should be interesting.

« Last Edit: June 03, 2010, 08:50:13 am by vfclists »
Lazarus 2.1.0/FPC 3.2.0

Almindor

  • Sr. Member
  • ****
  • Posts: 412
    • http://www.astarot.tk
Re: Code for scanning systems attached to network
« Reply #3 on: June 03, 2010, 02:44:20 pm »
Well lNet doesn't provide IP-scanner functionality per-se. What I mean is cooperative server discovery over LAN where the server waits for udp packets on a set port and the looking clients broadcast them on the same port. When the server gets them it replies to the clients directly and they get the IP this way.

vfclists

  • Hero Member
  • *****
  • Posts: 856
    • HowTos Considered Harmful?
Re: Code for scanning systems attached to network
« Reply #4 on: June 03, 2010, 04:41:29 pm »

Can it be used to scan the network like an ip scanner tool, in some kind of threaded manner?

I am writing software that needs to identify devices via their MAC addresses as the DHCP assigned addresses may change.
Lazarus 2.1.0/FPC 3.2.0

Almindor

  • Sr. Member
  • ****
  • Posts: 412
    • http://www.astarot.tk
Re: Code for scanning systems attached to network
« Reply #5 on: June 04, 2010, 04:14:46 pm »
I'm not sure. Do the devices "reply" to some specific UDP packets for example? If so one could get the mac-address out of the received replies (not sure exactly how since the info is in the ethernet heather of the packet and std. socket api only returns the UDP data part, not heather info).

If you need lower level stuff like ARP or RARP lNet doesn't provide that at all.

You're basically looking at low level stuff, under lNet's radar.

vfclists

  • Hero Member
  • *****
  • Posts: 856
    • HowTos Considered Harmful?
Re: Code for scanning systems attached to network
« Reply #6 on: June 05, 2010, 01:17:11 am »
It turns out the nmap command can do that quite easily and it works on Windows and Mac as well, but something more compact would be ideal.
Lazarus 2.1.0/FPC 3.2.0

 

TinyPortal © 2005-2018