Una imagen
El codigo
Código
#!usr/bin/perl #Codificator 0.2 #Version Tk #Coded By Doddy H use Tk; use Tk::Dialog; use Digest::MD5; use Digest::SHA1; use MIME::Base64; use URI::Escape; if ( $^O eq 'MSWin32' ) { use Win32::Console; Win32::Console::Free(); } $header = "This tool encode text in : Hex SHA1 MD5 Base64 ASCII URL "; my $color_fondo = "black", my $color_texto = "white"; $window = MainWindow->new( -background => "black", -foreground => "white" ); $window->geometry("380x370+80+80"); $window->title("Codificator 0.2 || Coded By Doddy H"); $window->resizable( 0, 0 ); $menula = $window->Frame( -relief => "sunken", -bd => 1, -background => $color_fondo, -foreground => $color_texto ); my $menulnowaxm = $menula->Menubutton( -text => "Options", -underline => 1, -background => $color_fondo, -foreground => $color_texto, -activebackground => $color_texto )->pack( -side => "left" ); my $aboutnowaxm = $menula->Menubutton( -text => "About", -underline => 1, -background => $color_fondo, -foreground => $color_texto, -activebackground => $color_texto )->pack( -side => "left" ); my $exitnowaxm = $menula->Menubutton( -text => "Exit", -underline => 1, -background => $color_fondo, -foreground => $color_texto, -activebackground => $color_texto )->pack( -side => "left" ); $menula->pack( -side => "top", -fill => "x" ); $menulnowaxm->command( -label => "Encode", -background => $color_fondo, -foreground => $color_texto, -command => \&encode ); $menulnowaxm->command( -label => "Decode", -background => $color_fondo, -foreground => $color_texto, -command => \&decode ); $menulnowaxm->command( -label => "Clean", -background => $color_fondo, -foreground => $color_texto, -command => \&clear ); $aboutnowaxm->command( -label => "About", -background => $color_fondo, -foreground => $color_texto, -command => \&about ); $exitnowaxm->command( -label => "Exit", -background => $color_fondo, -foreground => $color_texto, -command => \&exitnow ); $window->Label( -font => "Impact", -background => $color_fondo, -foreground => $color_texto, -text => "Options : " $window->Optionmenu( -background => $color_fondo, -foreground => $color_texto, -activebackground => $color_texto, -options => [ [ HEX => HEX ], [ ASCII => ASCII ], [ BASE64 => BASE64 ], [ MD5 => MD5 ], [ SHA1 => SHA1 ], [ URL => URL ] ], -variable => \$var, -textvariable => \$codificacion my $rot = $window->Text( -background => $color_fondo, -foreground => $color_texto, -width => 45, -height => 15 $rot->insert( 'end', $header ); MainLoop; sub about { $window->Dialog( -title => "About", -buttons => ["OK"], -text => "Coded By Doddy H", -background => $color_fondo, -foreground => $color_texto, -activebackground => $color_texto )->Show(); } sub exitnow { } sub clear { $rot->delete( '0.1', 'end' ); } sub encode { $text = $rot->get( "1.0", "end" ); &clear; if ( $codificacion eq "HEX" ) { $result = hexar($text); $rot->insert( 'end', $result ); } elsif ( $codificacion eq "SHA1" ) { $sha1 = Digest::SHA1->new->add($text); my $digest = $sha1->digest; $rot->insert( 'end', $digest ); } elsif ( $codificacion eq "BASE64" ) { $result = encode_base64($text); $rot->insert( 'end', $result ); } elsif ( $codificacion eq "URL" ) { my $codec = Badger::Codec::URL->new(); my $ya = $codec->encode($text); $rot->insert( 'end', $ya ); } elsif ( $codificacion eq "ASCII" ) { $result = ascii($text); $rot->insert( 'end', $result ); } elsif ( $codificacion eq "MD5" ) { $digest = Digest::MD5->md5_hex($text); $rot->insert( 'end', $digest ); } else { $window->messageBox( -message => "What?!\n" ); } } sub decode { $text = $rot->get( "1.0", "end" ); &clear; if ( $codificacion eq "HEX" ) { $result = decodera($text); $rot->insert( 'end', $result ); } elsif ( $codificacion eq "SHA1" ) { $window->messageBox( -message => "What?! , it's not possible with a function decoded\n" ); } elsif ( $codificacion eq "BASE64" ) { $result = decode_base64($text); $rot->insert( 'end', $result ); } elsif ( $codificacion eq "URL" ) { my $codec = Badger::Codec::URL->new(); my $ya = $codec->decode($text); $rot->insert( 'end', $ya ); } elsif ( $codificacion eq "ASCII" ) { $result = ascii_de($text); $rot->insert( 'end', $result ); } elsif ( $codificacion eq "MD5" ) { $window->messageBox( -message => "What?! , it's not possible with a function decoded\n" ); } else { $window->messageBox( -message => "What?!\n" ); } } sub hexar { my $string = $_[0]; $hex = '0x'; } } sub ascii { } sub decodera { $_[0] =~ s/^0x//; } sub ascii_de { } # The End ?