aboutsummaryrefslogtreecommitdiffstats
path: root/ipchanges.pl
diff options
context:
space:
mode:
authorlookshe <lookshe@lookshe-server.(none)>2014-09-21 00:37:43 +0200
committerlookshe <lookshe@lookshe-server.(none)>2014-09-21 00:37:43 +0200
commit7aa21bd2fd75f8949cd6db69db8ba7a801df37b5 (patch)
treeae89a8e1e4f4788712c72b7dec7690638046fff6 /ipchanges.pl
parentc4d2aba012967a8636069b723c428622680b969b (diff)
perl script for logging external ip address and analysing changes from its logfile
Diffstat (limited to 'ipchanges.pl')
-rw-r--r--ipchanges.pl21
1 files changed, 21 insertions, 0 deletions
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";
+ }
+}