Saltar al contenido
Underc0de /foro

[Perl] MD5 Crack 0.2

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

Tema anterior - Siguiente tema

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

Avatar de BigBear
Junio 16, 2012, 03:23:40 PM Ultima modificación: Junio 16, 2012, 03:46:09 PM por ANTRAX

Simple script para crackear un hash MD5 mediante un diccionario.


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

use Digest::MD5 qw(md5_hex);

head();
while (1) {
    print qq(

[++] Options

[+] 1 : Crack hash
[+] 2 : Crack hashes

);
    print "\n[+] Option : ";
    chomp( my $op = <stdin> );

    if ( $op eq "1" ) {
        print "\n[+] MD5 : ";
        chomp( my $md5 = <stdin> );
        print "\n[+] Salt : ";
        chomp( my $salt = <stdin> );
        print "\n[+] Wordlist : ";
        chomp( my $wordlist = <stdin> );
        crackhash( $md5, $salt, $wordlist );
    }
    elsif ( $op eq "2" ) {
        print "\n[+] File : ";
        chomp( my $md5 = <stdin> );
        print "\n[+] Salt : ";
        chomp( my $salt = <stdin> );
        print "\n[+] Wordlist : ";
        chomp( my $wordlist = <stdin> );
        crackhashes( $md5, $salt, $wordlist );
    }
    else {
        print "\n\n[-] Bad option\n";
    }

}
copyright();

sub crackhashes {

    my ( $file, $salt, $wordlist ) = @_;
    my @hashes = openwordlist($file);

    my $formar;

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

        if ( ver_length($md5) ) {

            my @words = openwordlist($wordlist);

            print "[+] Cracking ....\n\n";

            for my $word (@words) {
                chomp $word;

                my $formardos;

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

                }

                if ( $formar eq $formardos ) {
                    print "\n\a[+] Cracked : " . $formar . ":" . $word . "\n";
                    savefile( "md5-found.txt", $formar . ":" . $word );
                    last;
                }
                else {
                    print $formar. " =! " . $formardos . "\n";
                }
            }
        }
        else {
            print "\n[-] Hash invalid";
            last;
        }
    }
}

sub crackhash {

    my ( $md5, $salt, $wordlist ) = @_;
    my $formar = $md5;

    if ( ver_length($md5) ) {

        my @words = openwordlist($wordlist);

        print "[+] Cracking ....\n\n";

        for my $word (@words) {
            chomp $word;

            my $formardos;

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

            if ( $formar eq $formardos ) {
                print "\n\a[+] Cracked : " . $formar . ":" . $word . "\n";
                savefile( "md5-found.txt", $formar . ":" . $word );
                copyright();
            }
            else {
                print $formar. " =! " . $formardos . "\n";
            }
        }

    }
    else {
        print "\n[-] Hash invalid";
    }

}

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

sub openwordlist {

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

    print "\n[+] Opening file\n\n";

    unless ( -f $file ) {
        print "\n[-] File not found\n";
        copyright();
    }

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

    print "[+] Words Found : " . int(@words) . "\n\n";

    return @words;

}

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

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

sub head {
    print qq(


@     @  @@@@    @@@@@     @@@@  @@@@@     @     @@@@  @   @
@     @  @   @   @        @    @ @    @    @    @    @ @  @ 
@@   @@  @    @  @        @      @    @   @ @   @      @ @   
@@   @@  @    @  @@@@     @      @    @   @ @   @      @@   
@ @ @ @  @    @  @   @    @      @@@@@   @   @  @      @@   
@ @ @ @  @    @      @    @      @    @  @   @  @      @ @   
@  @  @  @    @      @    @      @    @  @@@@@  @      @  @ 
@  @  @  @   @   @   @    @    @ @    @ @     @ @    @ @   @
@     @  @@@@     @@@      @@@@  @    @ @     @  @@@@  @    @



);
}

sub copyright {
    print "\n\n-- == (C) Doddy Hackman 2012\n\n";
    <stdin>;
    exit(1);
}

#The End ?
WhatsApp Telegram

4 respuestas

Avatar de ANTRAX
Que bien man! Genial aporte!
El archivo con las passwords debe llamarse wordlist?


Avatar de BigBear
el wordlist puede llamarse con cualquier nombre.

Avatar de ANTRAX
Pero segun tu script, debe llamarse wordlist?


Avatar de BigBear
no , $wordlist es el nombre de una variable.

🔗 Temas relacionados

¿Te quedó una duda sobre Perl?

Preguntala y te responde la comunidad (y el asistente Underc0de IA si nadie llega antes). Es gratis y tarda un minuto.

Ya tengo cuenta
Guardamos tu pregunta en este navegador: después de entrar la publicás con un clic.
Grupo de WhatsApp