|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Hi, where I work we are collecting info on our computers, and one thing we require is a listing of the latest IP addresses assigned to the users’ machines. They are mostly set to DHCP, so the idea I had was to check each machine every day with a script that would find their IP addresses, and then write the results to a file (and ideally enter those results into our database). I’ve found a perl script online (http://www.roth.net/perl/scripts/scripts.asp?GetIP.pl) that can check one machine at a time, if at all, but its behavior is strange; sometimes it just won’t display the IP, even when I’m using it as an administrator. Also, it relies on reading the Windows registry so it won’t work to get the IPs of our Macs. I was wondering if you could direct me to some place where I could get such a script, especially one that will work with our UNIX-based machines.
Thank you. |
|
#2
|
||||
|
||||
|
have you tried using something like arpwatch to keep a watch of machines?
|
|
#3
|
|||
|
|||
|
Hi,
I have a script here at my work running on a unix environment. The command to check the user IP for perl is simply $ip=$ENV{'REMOTE_ADDR'}; This gives the variable $ip the ip address of the client pc that entered the form of my web page. If you want to test your code on a HP-UNIX, just let me know |
|
#4
|
|||
|
|||
|
Thanks for the replies papajohns and Beyle,
I am now investigating the potential use of the ARP protocol and apps such as arpwatch as a solution. As for the perl script, this may sound kind of dumb but I'm not an expert on perl, so when I run: Code:
use warnings;
$ip = $ENV{'REMOTE_ADDR'};
print $ip "\n";
...it throws the error "Can't use an undefined value as a symbol reference..." How can I do this without making it a web app? |
|
#5
|
|||
|
|||
|
sorry, my last post must have seemed too dumb to respond to... i just don't know what to do with $ip=$ENV{'REMOTE_ADDR'}; in my script. It was suggested to me that I use this:
Code:
use Net::Address::IPv4::Local; # Get the local system's IP address that is "connected" to "the internet": my $address = Net::Address::IPv4::Local->public; print "IP:$address\n"; ...would this work better to retreive the IP addresses of many computers on our network? by the way, I don't know why this was moved to the Web Site Mgmt. forum, since it has little to do with a web site. It was originally in the Perl forum. |
![]() |
| Viewing: Dev Shed Forums > Web Site Management > Scripts > script for collecting IP addresses |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|