Help with Perl script to verify IP addresses

Reply

Join Date: May 2006
Posts: 1
Reputation: meepsgood is an unknown quantity at this point 
Solved Threads: 0
meepsgood meepsgood is offline Offline
Newbie Poster

Help with Perl script to verify IP addresses

 
0
  #1
May 17th, 2006
I am having trouble getting this script started, if anyone has any ideas fell free to comment, i am new to perl script writing and am finding this one a bit difficult:

i need a Perl program which will check whether or not an IP Address entered by a user is in fact a valid one. The user is to enter the IP Address AS A COMMAND LINE PARAMETER eg the user will type check_ip.pl 192.168.9.23 and the script will attempt to validate the IP Address 192.168.9.23.

The script must first check whether the user has input any data at all and if not display an appropriate error message.



A valid IP Address must have:
  • 4 octets, each separated by “.â€?
· numbers in each of the 4 octets (ie no alphabetic or
punctuation characters are allowed within each octet)
  • have the first octet between 1 and 255
  • have the 2nd, 3rd & 4th octets between 0 and 255


Only one IP Address is to be input and validated (ie there is no looping through several IP Addresses)




menu for a network engineer.



i need a Perl script that would be useful for a network engineer. This script will display the following menu

Networking Tools

1. Show me the IP address of this PC
2. Show me the subnet mask of this PC
3. Show me the computer name of this PC
4. Quit

Please type your selection :



The user will type in their selection (1 – 4) and the script will keep running until the user types in 4. An error message will be given if the user inputs anything other than 1 to 4.


Example : if user selects “1�

If the user selects 1, the script will clear the screen and then display the following information on the screen :

“The IP address of this PC is <nnn.nnn.nnn.nnn>
Press any key to continue�

replacing the <nnn.nnn.nnn.nnn> address with the ACTUAL IP address of the PC

The message “The IP address ..� will remain on the screen until the uses presses any key, at which time the menu will be re-displayed.
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 898
Reputation: KevinADC has a spectacular aura about KevinADC has a spectacular aura about 
Solved Threads: 67
KevinADC's Avatar
KevinADC KevinADC is offline Offline
Practically a Posting Shark

Re: Help with Perl script to verify IP addresses

 
0
  #2
May 18th, 2006
This so smells of class work. You need to put some effort into it if you want help with class work, that means writing some code.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC