Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting your external ip with perl
#1
You can get your external ip with perl by running this script...however, you have to install the LWP::Simple first. If you are on mac or linux you can simply go to the command line and type:
sudo cpan
You may have to set up cpan, for the most part you use all defaults, and choose servers near you.
then run
install LWP::Simple
cpan may ask you some more questions, just agree.

Then you can run this:

PHP Code:
#!/usr/bin/perl
use LWP::Simple;
$whyip qr/(Your IP address is \d+\.\d+\.\d+.\d+)/;
$content get("http://whatismyipaddress.com");
if(
$content =~ $whyip){
 print $&;


If you don't know your path to perl(#!/usr/bin/perl) then run it by typing
perl nameofscript.pl
Reply
#2
It's simple, thanks anyway. Smile
Reply
#3
Nice. I can use this for my bot Smile.
But won't you need to backslash those dots and "d's"?
Edit: I've noticed this is not working, because of the useragent. It says: "it appears to be an automated script".
Reply
#4
Simple and nice Smile thanks for sharing this code...
Reply
#5
Thank's for the share man Oui
[Image: logo.png]
xSexy.org | The New Sexy Forum ! [Erotic Pics & Videos]
Reply
#6
Simple but useful, thanks.
Reply
#7
and if you find a better website to get your IP address from then you can change the url in there (obviously) lol. I've noticed a few of these IP getting perl codes interpretted by others. It seems to be a popular area in this perl forum.
Reply
#8
Thanks alot for sharing this with us man.
Reply
#9
(09-26-2010, 12:29 AM)Infinity Wrote: and if you find a better website to get your IP address from then you can change the url in there (obviously) lol. I've noticed a few of these IP getting perl codes interpretted by others. It seems to be a popular area in this perl forum.

Should you change the URI you would need to adjust the RegEx pattern to match. The pattern Bsdpunk created is specific to the site he has set by default.
Ho, ho, ho! Well, if it isn't fat stinking billy goat Billy Boy in poison!
How art thou, thou globby bottle of cheap, stinking chip oil?
Come and get one in the yarbles, if ya have any yarbles, you eunuch jelly thou!
Reply
#10
good work thanks for sharing
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Compile Error in Perl liveproject101 0 1,149 04-12-2013, 03:08 AM
Last Post: liveproject101
  [Perl] IRC Bot wchar_t 26 12,802 08-20-2012, 01:40 PM
Last Post: Trump
  Perl Ebook ven0m 2 1,615 05-04-2012, 08:14 AM
Last Post: ven0m
  Help with a program written in perl Rodman42866 1 1,518 03-09-2012, 03:16 AM
Last Post: AceInfinity
  HTML perl script AceInfinity 5 2,390 12-03-2011, 11:35 PM
Last Post: Closed Account

Forum Jump:


Users browsing this thread: 1 Guest(s)