aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--externalIp.pl6
-rw-r--r--ipchanges.pl21
2 files changed, 27 insertions, 0 deletions
diff --git a/externalIp.pl b/externalIp.pl
new file mode 100644
index 0000000..2220d9d
--- /dev/null
+++ b/externalIp.pl
@@ -0,0 +1,6 @@
+#!/usr/bin/perl
+
+($ip=`wget -q -O - http://checkip.dyndns.org`)=~s/\n$//;
+$ip=~s/.*[^\d](\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})[^\d].*/$1/;
+($date=`date`)=~s/\n$//;
+print "$date\n$ip\n";
diff --git a/ipchanges.pl b/ipchanges.pl
new file mode 100644
index 0000000..5b3211a
--- /dev/null
+++ b/ipchanges.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+
+my $file = "/home/lookshe/myips.txt";
+
+open(FILE, $file) || die("unable to open $file!");
+my @lines = <FILE>;
+close(FILE);
+
+for ($i = 1; $i <= $#lines-2; $i+=2)
+{
+ my $ip = $lines[$i];
+ chomp($ip);
+ my $nextip = $lines[$i+2];
+ chomp($nextip);
+ if ($ip !~ m/^$nextip$/)
+ {
+ my $time = $lines[$i+1];
+ chomp($time);
+ print "$time: $ip -> $nextip\n";
+ }
+}