How to tell IP address of remote machine?

Paulo Cavalcanti promac at gmail.com
Sun Oct 25 18:12:42 UTC 2009


On Sun, Oct 25, 2009 at 3:32 PM, Bruno Wolff III <bruno at wolff.to> wrote:

> On Sun, Oct 25, 2009 at 14:17:48 +0000,
>  Timothy Murphy <gayleard at eircom.net> wrote:
> > Sam Varshavchik wrote:
> >
> > >> I had a little program which I ran each day
> > >> as a cron job to mail me the IP address of a machine
> > >> in a different country.
> > ...
> > >> In any case, the program has ceased to work
> > >> because the site heliohost seems to have gone off-line.
> >
> > > You don't need to use any site. The sender's IP address will be
> recorded
> > > in the test message's headers.
> >
> > Thanks very much for that suggestion.
> > I've looked at KMail showing all headers,
> > and there are a couple of IP addresses which could be the correct ones:
>
> If your mail is going through the ISPs mail server, then it could
> potentially
> do things that make it hard to get the IP address you want.
>
> You could note other kinds of direct connections to your machine. For
> example
> you could note http connections to a url at your machine that isn't
> published or discoverable.
>
>
>
If the game is not to use any external server, then
you can use your own computer to ping back the address.
Just install an script in /var/www/cgi-bin/ in your local computer and
call ipget.pl from your remote computer. Then, you can email
your external IP to wherever you want:

#!/usr/bin/perl -wT
# ipget.pl- the script that retrieves your IP for you. Run this on the box
# whose IP you want to figure out. You can make this part of a larger
program,
# obviously.
use LWP::Simple;
$numArgs = $#ARGV + 1;
# print "$numArgs arguments.\n";
if ($numArgs == 0) {
  print "using server1: ";
  $host = "http://external-computer1-name/cgi-bin/ipreport.cgi";
}
else {
  print "using server2: ";
  $host = "http://external-computer2-name/cgi-bin/ipreport.cgi";
}
my $ip=get($host);
print $ip;

-----------------------------------------------------

#!/usr/bin/perl -wT
# ipreport.cgi- the script that sits external to your router
use strict;
use CGI;
my $q=CGI->new();
print $q->header().$q->remote_addr()."\n";


-- 
Paulo Roma Cavalcanti
LCG - UFRJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20091025/88f96999/attachment-0001.htm>


More information about the fedora-list mailing list