|
PHP or Perl help with probing current subnet
Testing at home. (small LAN of win, linux under a linksys WRT54G)
I have already written enough to grok an IP range based on form submittal... but herein lies the gist:
I am ostensibly writing this for work, testing at home since it's deemed very uncool to do port scanning at work (ever since the malicious portscanning worms of the last year.)
What I want to do...
Script would go out and query the local gateway as to the current subnet's connected machines. Only need to get the IP's of the current subnet, since I've already written the code to do the port scanning once I have the IP range in hand.
The problem seems to be how to find out the subnet's mask, to prevent from attempting to scan all addresses from xxx.xxx.xxx.1-254 if its on a subnet that is masked for only 64 hosts... nest pas?
Am I over thinking this? Or do I have to query the gateway and/or DHCP server for that info via ARP? What if the subnet is setup with static IP's and the DHCP's scope is only set for a subset of the full available range...
etc...
Any help appreciated.
TIA, Richard.
** Sorry forgot to note, this script would need to be portable/adaptable to which ever network it is installed upon...
Of course, In reading this, I realized for the current subnet, all I have to do is get the subnet mask from the current host... DOY!... Hmm...
Let me know if I just answered my own question. =)
Last edited by noeffort; 10-23-2004 at 10:16 PM.
|