UPWORK/ODESK guru: Tips and Tricks for clients

skype: upwork.link , email: info@upwork.link

CSF: IP tracking of DNS name – perl tool

without comments

Simple code on perl for tracking of list of IP of DNS name:

#!/bin/env perl

use strict;
use Socket;
my $hostname = 'bitbucket.org';
my %ips;

  my @addresses = gethostbyname($hostname) or die "Can't resolve $hostname: $!\n";
  @addresses = map { inet_ntoa($_) } @addresses[4 .. $#addresses];
  #print join(", ", @addresses);
  foreach my $item (@addresses){
     $ips{$item} = $ips{$item}+1;
  print "\033[2J";    #clear the screen
  print "\033[0;0H"; #jump to 0,0
  print "\t$hostname\n"; 
  while( my( $key, $val ) = each %ips) {
        print "\t$key\t=>$val\n";
  sleep 30;

Written by spectre

July 21st, 2015 at 4:13 pm

Posted in Tips and Tricks

Leave a Reply