Loading ...
Sorry, an error occurred while loading the content.

Capture IP address

Expand Messages
  • zen_e_boy
    Hi, how can I capture the IP address of a user filling in a HTML form. The backend procesing is using Perl. I dont know what modules are installed by the ISP.
    Message 1 of 6 , Sep 14, 2007
    • 0 Attachment
      Hi,
      how can I capture the IP address of a user filling in a HTML form. The
      backend procesing is using Perl. I dont know what modules are installed
      by the ISP.
    • Ramesh Polepalli
      You can check the modules installed. Check the link http://www.mimedefang.org/kwiki/index.cgi?PerlModulesINFO or use this script on web page 1. #!/usr/bin/perl
      Message 2 of 6 , Sep 14, 2007
      • 0 Attachment
        You can check the modules installed. Check the link

        http://www.mimedefang.org/kwiki/index.cgi?PerlModulesINFO



        or use this script on web page



        1. #!/usr/bin/perl -w

        use ExtUtils::Installed;
        my $instmod = ExtUtils::Installed->new();
        foreach my $module ($instmod->modules()) {
        my $version = $instmod->version($module) || "Version Not Found";
        print "$module - $version\n";
        }







        Capturing IP,

        Check following links, this might give you some idea.

        http://www.scriptarchive.com/dano.html
        http://www.scriptarchive.com/download.cgi?s=dano&c=txt&f=dan_o%2Epl

        http://bignosebird.com/carchive/bnbbook.shtml



        Though not straight answer, Hope this helps.







        ________________________________

        From: perl-beginner@yahoogroups.com
        [mailto:perl-beginner@yahoogroups.com] On Behalf Of zen_e_boy
        Sent: Friday, September 14, 2007 2:27 PM
        To: perl-beginner@yahoogroups.com
        Subject: [PBML] Capture IP address



        Hi,
        how can I capture the IP address of a user filling in a HTML form. The
        backend procesing is using Perl. I dont know what modules are installed
        by the ISP.





        Ramesh Polepalli









        mFormation Technologies Inc.
        Direct Line: +91 80 6620 5939
        Switchboard: +91 80 6620 5900

        http://www.mformation.com










        Visit WWW.MFORMATION.COM and see how the MFORMATION SERVICE MANAGER can help you to transform your business.

        [Non-text portions of this message have been removed]
      • Gilles Beauregard
        Allo! ... For the visitor IP: $ENV{ REMOTE_ADDR } If you need to have a listing of all environenet variable do the following: foreach $key (sort keys %ENV)
        Message 3 of 6 , Sep 14, 2007
        • 0 Attachment
          Allo!

          At 04:56 2007-09-14, you wrote:
          >Hi,
          >how can I capture the IP address of a user filling in a HTML form. The
          >backend procesing is using Perl. I dont know what modules are installed
          >by the ISP.

          For the visitor IP:

          $ENV{'REMOTE_ADDR'}

          If you need to have a listing of all environenet variable do the following:

          foreach $key (sort keys %ENV)
          {print "$key: $ENV{$key}\n" ;}

          Not sure about the syntax, I use a different, but must work.

          Good luck

          Gilles B.


          ---
          Webmasters helping webmasters
          http://www.balour.org/
        • zen_e_boy
          Thanks for your replies, I ll give them a go over the weekend. I also found a way of doing it in Javascript that I could quite easily pass back via a hidden
          Message 4 of 6 , Sep 14, 2007
          • 0 Attachment
            Thanks for your replies, I'll give them a go over the weekend.
            I also found a way of doing it in Javascript that I could quite easily
            pass back via a hidden field in the form.
          • merlyn@stonehenge.com
            ... zen Thanks for your replies, I ll give them a go over the weekend. zen I also found a way of doing it in Javascript that I could quite easily zen pass
            Message 5 of 6 , Sep 14, 2007
            • 0 Attachment
              >>>>> "zen" == zen e boy <brett@...> writes:

              zen> Thanks for your replies, I'll give them a go over the weekend.
              zen> I also found a way of doing it in Javascript that I could quite easily
              zen> pass back via a hidden field in the form.

              Actually, to summarize points already made here:

              $ENV{REMOTE_ADDR} is the IP address of the connection to the server
              $ENV{REMOTE_HOST} *may* be the hostname of that connection

              Javascript *may* be used to get the IP address.

              == However ==

              Consider a browser sitting behind a NAT connecting to a server.
              Javascript will report the "local" address (before the NAT), while
              the ENVars will report the "public" address.

              Now, it gets worse.

              Consider a web server sitting behind an inbound proxy, such as a caching proxy
              or a corporate inbound firewall. Unless special work is performed, the ENVars
              will report the address of the *proxy*, not the public address of the client.

              I think the real question is, why do you care what IP is connecting?

              You can't use it for uniqueness (many users may have the same IP, and some
              hits during the same session may come in on separate IPs!). So, it won't work
              for a session management.

              You can't use it for access control (it's trivial to use TOR or other
              proxies to hide).

              So, why do you care what the IP is?

              --
              Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
              <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
              Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
              See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
            • zen_e_boy
              All good and valid points, most of which I never thought of because Im not that strong on IP networking. Thanks for taking the time to reply.
              Message 6 of 6 , Sep 14, 2007
              • 0 Attachment
                All good and valid points, most of which I never thought of because Im
                not that strong on IP networking.
                Thanks for taking the time to reply.
              Your message has been successfully submitted and would be delivered to recipients shortly.