Scripts
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb Site ManagementScripts

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old August 11th, 2005, 02:22 PM
weloki weloki is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: in the area surrounding myself
Posts: 71 weloki User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 19 m 41 sec
Reputation Power: 5
Question script for collecting IP addresses

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.

Reply With Quote
  #2  
Old August 12th, 2005, 02:03 AM
papajohns's Avatar
papajohns papajohns is offline
perl virgin
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Seattle, WA
Posts: 436 papajohns User rank is Corporal (100 - 500 Reputation Level)papajohns User rank is Corporal (100 - 500 Reputation Level)papajohns User rank is Corporal (100 - 500 Reputation Level)papajohns User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 10 h 30 m 43 sec
Reputation Power: 8
have you tried using something like arpwatch to keep a watch of machines?

Reply With Quote
  #3  
Old August 12th, 2005, 07:37 AM
Beyle Beyle is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Location: Belgium
Posts: 28 Beyle User rank is Corporal (100 - 500 Reputation Level)Beyle User rank is Corporal (100 - 500 Reputation Level)Beyle User rank is Corporal (100 - 500 Reputation Level)Beyle User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 14 h 33 m 3 sec
Reputation Power: 0
Send a message via MSN to Beyle
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

Reply With Quote
  #4  
Old August 12th, 2005, 02:28 PM
weloki weloki is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: in the area surrounding myself
Posts: 71 weloki User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 19 m 41 sec
Reputation Power: 5
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?

Reply With Quote
  #5  
Old August 15th, 2005, 04:17 PM
weloki weloki is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: in the area surrounding myself
Posts: 71 weloki User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 19 m 41 sec
Reputation Power: 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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb Site ManagementScripts > script for collecting IP addresses


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway