LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 10-23-2004, 10:07 PM   #1
noeffort
LQ Newbie
 
Registered: Feb 2004
Posts: 27

Rep: Reputation: 15
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.
 
Old 10-24-2004, 02:09 AM   #2
noeffort
LQ Newbie
 
Registered: Feb 2004
Posts: 27

Original Poster
Rep: Reputation: 15
OK, well I got both questions answered...

The first duh question was ... duh... I can query my own info

The other question was how to do this for a foreign address, and I "think" i may have had this answered over at PerlMonks...

Thanks anyway!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with perl module for w3c validator to work on my local Apache+PHP+perl instal tbamt Linux - Software 0 12-16-2004 05:37 PM
PERL question about getting input of current root window image joesbox Programming 3 01-02-2004 02:15 PM
Slackware-current Perl 5.8.1 Package tuxq Slackware 0 10-24-2003 07:37 AM
Updating php 4.3.1 from tar and keeping current php configuration with mandrake 9.1 mrjeep Linux - General 0 04-02-2003 07:50 AM
chrooting apache v2 (php, ssl, perl support) ; perl configuration markus1982 Linux - Security 3 01-26-2003 06:15 PM


All times are GMT -5. The time now is 02:22 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration