- Code: Select all
#!/usr/bin/perl -w
use strict;
use IO::Socket;
use Tk;
sub usage() {
print "[-] Protoxy says: \n";
print "[-] Usage: perl <ip.pl> -t or -tk \n";
exit;
}
sub tk_address() {
my $window = MainWindow->new( -background => "#000000" );
$window->title("IP Address");
$window->minsize( 200, 30 );
$window->maxsize( 200, 30 );
$window->Label(
-text => "IP Address: $1",
-background => "#000000",
-foreground => "#E4E4E4",
-font => "verdana 8",
)->pack( -anchor => "n" );
MainLoop;
}
my $socket = new IO::Socket::INET(
PeerAddr => "who.is",
PeerPort => "80",
Proto => "tcp",
Timeout => "0",
) or die "Unable to connect\n";
my $request = "GET /\n\n";
my $argv = shift or &usage;
print $socket $request;
while ( my $ip = <$socket> ) {
if ( $ip =~ /([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/ ) {
if ( $argv eq "-t" ) {
print "[~] IP Address: $1\n";
}
if ( $argv eq "-tk" ) {
&tk_address;
}
}
}
# Protoxy


