[Perl Tk] MD5 Crack 0.2

Iniciado por BigBear, Junio 16, 2012, 03:23:50 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Junio 16, 2012, 03:23:50 PM Ultima modificación: Junio 16, 2012, 03:47:00 PM por ANTRAX
Version Tk de un programa para crackear un hash MD5

Una imagen



Y el codigo

Código: perl

#!usr/bin/perl
#MD5 Crack 0.2
#Version Tk
#Coded By Doddy H
#Test with
#098f6bcd4621d373cade4e832627b4f6 : test
#cc03e747a6afbbcbf8be7668acfebee5 : test.123
#1943b8b39ca8df2919faff021e0aca98 : testar
#177dac170d586383bcc889602b2bb788 : testar.123

use Tk;
use Tk::Dialog;
use Tk::FileSelect;
use Cwd;
use Digest::MD5 qw(md5_hex);

#if ($^O eq 'MSWin32') {
#use Win32::Console;
#Win32::Console::Free();
#}

my $color_texto = "yellow";
my $color_fondo = "black";

my $kak =
  MainWindow->new( -background => $color_fondo, -foreground => $color_texto );

$kak->title("MD5 Crack T00l 0.2");
$kak->geometry("300x410+50+50");
$kak->resizable( 0, 0 );

$menulax = $kak->Frame(
    -relief     => "sunken",
    -bd         => 1,
    -background => $color_fondo,
    -foreground => $color_texto
);
my $menulnowaxmu = $menulax->Menubutton(
    -text             => "Options",
    -underline        => 1,
    -background       => $color_fondo,
    -foreground       => $color_texto,
    -activebackground => $color_texto
)->pack( -side => "left" );
my $aboutnowaxmu = $menulax->Menubutton(
    -text             => "About",
    -underline        => 1,
    -background       => $color_fondo,
    -foreground       => $color_texto,
    -activebackground => $color_texto
)->pack( -side => "left" );
my $exitnowaxmu = $menulax->Menubutton(
    -text             => "Exit",
    -underline        => 1,
    -background       => $color_fondo,
    -foreground       => $color_texto,
    -activebackground => $color_texto
)->pack( -side => "left" );
$menulax->pack( -side => "top", -fill => "x" );

$menulnowaxmu->command(
    -label      => "Crack Hash",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&crackhash
);
$menulnowaxmu->command(
    -label      => "Crack Wordlist",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&crackhashes
);
$menulnowaxmu->command(
    -label      => "Load hashes",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&bronafar
);
$menulnowaxmu->command(
    -label      => "Load file",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&bronaf
);
$menulnowaxmu->command(
    -label      => "Open Logs",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&openlogska
);

$aboutnowaxmu->command(
    -label      => "About",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&aboutxam
);

$exitnowaxmu->command(
    -label      => "Exit",
    -background => $color_fondo,
    -foreground => $color_texto,
    -command    => \&exitnowm
);

$kak->Label(
    -text       => "Hash : ",
    -font       => "Impact",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 20, -y => 40 );
my $md5 = $kak->Entry(
    -width      => 33,
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 70, -y => 45 );

$kak->Label(
    -text       => "File : ",
    -font       => "Impact",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 22, -y => 70 );
my $word = $kak->Entry(
    -width      => 34,
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 63, -y => 75 );

$kak->Label(
    -text       => "Salt : ",
    -font       => "Impact",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 22, -y => 100 );
my $salt = $kak->Entry(
    -width      => 34,
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 63, -y => 105 );

$kak->Label(
    -text       => "Hashes Found",
    -font       => "Impact",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 90, -y => 150 );
my $ha = $kak->Listbox(
    -width      => 40,
    -height     => 10,
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 25, -y => 190 );

$kak->Label(
    -text       => "Status : ",
    -font       => "Impact",
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 37, -y => 360 );
my $tatus = $kak->Entry(
    -width      => 25,
    -background => $color_fondo,
    -foreground => $color_texto
)->place( -x => 95, -y => 365 );

MainLoop;

sub crackhashes {

    $ha->delete( "0.0", "end" );
    $tatus->configure( -text => " " );

    my $file     = $md5->get;
    my $wordlist = $word->get;
    my $salt     = $salt->get;

    my @hashes = openwordlist($file);

    my $formar;

    for my $md5 (@hashes) {
        chomp $md5;
        my $formar = $md5;

        if ( ver_length($md5) ) {

            my @words = openwordlist($wordlist);

            for my $word (@words) {
                chomp $word;
                $kak->update;
                my $formardos;

                if ( $salt eq "" ) {
                    $formardos = md5_hex($word);
                }
                else {
                    $formardos = md5_hex( $word . $salt );

                }

                if ( $formar eq $formardos ) {
                    $ha->insert( "end", $formar . ":" . $word );
                    $tatus->configure( -text => $word );
                    savefile( "md5-found.txt", $formar . ":" . $word );
                    last;
                }
                else {
                    $tatus->configure( -text => $word );
                }
            }
        }
        else {
            $kak->Dialog(
                -title            => "Error",
                -buttons          => ["OK"],
                -text             => "Hash invalid",
                -background       => $color_fondo,
                -foreground       => $color_texto,
                -activebackground => $color_texto
            )->Show();
            last;
        }
    }
}

sub crackhash {

    $ha->delete( "0.0", "end" );
    $tatus->configure( -text => " " );

    my $md5      = $md5->get;
    my $wordlist = $word->get;
    my $salt     = $salt->get;

    my $formar = $md5;

    if ( ver_length($md5) ) {

        my @words = openwordlist($wordlist);

        for my $word (@words) {
            chomp $word;
            $kak->update;
            my $formardos;

            if ( $salt eq "" ) {
                $formardos = md5_hex($word);
            }
            else {
                $formardos = md5_hex( $word . $salt );
            }

            if ( $formar eq $formardos ) {
                $tatus->configure( -text => $word );
                $ha->insert( "end", $formar . ":" . $word );
                savefile( "md5-found.txt", $formar . ":" . $word );
                last;
            }
            else {
                $tatus->configure( -text => $word );
            }
        }
    }
    else {
        $kak->Dialog(
            -title            => "Error",
            -buttons          => ["OK"],
            -text             => "Hash invalid",
            -background       => $color_fondo,
            -foreground       => $color_texto,
            -activebackground => $color_texto
        )->Show();
    }
}

sub ver_length {
    return true if length( $_[0] ) == 32;
}

sub openwordlist {

    my ( $file, $tipo ) = @_;

    unless ( -f $file ) {
        $kak->Dialog(
            -title            => "Error",
            -buttons          => ["OK"],
            -text             => "File not found",
            -background       => $color_fondo,
            -foreground       => $color_texto,
            -activebackground => $color_texto
        )->Show();
        last;
    }

    open( FILE, $file );
    my @words = <FILE>;
    close FILE;

    return @words;

}

sub bronafar {
    $kak->update;
    $browse = $kak->FileSelect( -directory => getcwd() );
    my $file = $browse->Show;
    $md5->configure( -text => $file );
}

sub bronaf {
    $kak->update;
    $browse = $kak->FileSelect( -directory => getcwd() );
    my $file = $browse->Show;
    $word->configure( -text => $file );
}

sub openlogska {
    my $f = "md5-found.txt";
    if ( -f $f ) {
        system($f);
    }
    else {
        $kak->Dialog(
            -title            => "Error",
            -buttons          => ["OK"],
            -text             => "File Not Found",
            -background       => $color_fondo,
            -foreground       => $color_texto,
            -activebackground => $color_texto
        )->Show();
    }
}

sub aboutxam {
    $kak->Dialog(
        -title            => "About",
        -buttons          => ["OK"],
        -text             => "Coded By Doddy H",
        -background       => $color_fondo,
        -foreground       => $color_texto,
        -activebackground => $color_texto
    )->Show();
}

sub exitnowm {
    exit 1;
}

sub savefile {
    open( SAVE, ">>" . $_[0] );
    print SAVE $_[1] . "\n";
    close SAVE;
}

sub repes {
    my @limpio;
    foreach $test (@_) {
        push @limpio, $test unless $repe{$test}++;
    }
    return @limpio;
}

#The End ?


Ahi te arregle el code. En el foro colocamos GeShi, para que tus codes se vean mejor!
Saludos y esta genial el code! Muchas gracias!
Segui asi Doddy!!!