Register
It is currently Thu Feb 22, 2018 12:27 am

iphelp.pl - Perl IP Helper - A Perl/Tk Gui program


All times are UTC


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Mon Jun 13, 2011 10:20 pm   
Site Admin
User avatar

Joined: Thu Apr 17, 2003 3:44 am
Posts: 12300
Location: Iowa
Perl IP Helper - A Perl/Tk Gui program to help me with ipv6 reverse entries ;)
Been coding a bit in perl, thought I'd share.
(This ones coded for windows..but should work on linux.)
2 Dependencies.
Tk and Net::IP
Installation instructions for the windows side given in the script for the 2 dependencies.

Code:
#!/usr/bin/perl
##################################
# FILE: iphelp.pl
#
# By: Crouse
# Last Modified: 06-04-2011
##################################
# What it does: Takes IP and prints out information about it.
use warnings;
use strict;
use Tk;       # ppm install Tk
use Net::IP;  # ppm install Net::IP
use English; 

         BEGIN {
    if ("$OSNAME" eq "MSWin32") {
    require Win32::Console;
    Win32::Console::Free();
    }}

my $number;
 
my $mw = tkinit;
$mw->idletasks;

$mw->title("IP Helper");
 
    my $frame1 = $mw->Frame->pack(-fill => 'x');
   
         $frame1->Label(
        -text => "Enter IP:"
         )->pack(-side => 'left');
        $frame1->Entry(-textvariable => \$number)->pack(-side => 'left');

            my $text = $mw->Text(qw/ -height 13 -width 90 / )->pack();
            tie *STDOUT, ref $text, $text;

###BUTTON START           
        $frame1->Button(
        -text => "ENTER",
        -command =>
            sub {           
  my $ip = new Net::IP ($number) or die (Net::IP::Error());
 
  print ("            Working with $number  This is an IPv".$ip->version()." number.\n");
   print "---------------------------------------------------------------------------------\n";
  print ("     Size: ".$ip->size()."\n");
  print ("  Length : ".$ip->prefixlen()."\n"); 
  print ("  Reverse:  ".$ip->reverse_ip()."\n");
  print ("     Type: ".$ip->iptype()."\n"); 
  print ("  Long IP: ".$ip->ip()."\n");
  print (" Short IP: ".$ip->short()."\n");
  print ("     Mask: ".$ip->mask()."\n");
  print ("      Hex: ".$ip->hexip()."\n");
  print ("      Int: ".$ip->intip()."\n");
  #print ("   Binary: ".$ip->binip()."\n";
    }     
        )->pack();
       
###BUTTON END

MainLoop;

_________________

Zbook (Laptop)- Mint 18 64-bit - I7-4800mq - 32GB ram
Phantom (Desktop)- Mint 64-bit - i7-5770 - 32GB ram
Nas4Free (NAS) - 6X3TB File Server.
Sky (HP BladeCenter) - 16 blades - 536 GB ram-G7/G6/G5 blades.


Top
 Profile WWW  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


Powered by phpBB © 2012 phpBB Group
© 2003 - 2012 USA LINUX USERS GROUP