Jump to content

PHP Script Help!


maxcell

Recommended Posts

I have an encrypted password i'm trying to decrypt, and I have a php script to do so..

 

I use a program called crunch that comes with the linux backtrack live CD to generate a dictionary file... however this process takes too long, I was wondering how can i build that into this script to automatically generate either 7 or 8 character long strings from a character set?

 

 

 

<?php

if ( $argc != 4 )

{

    printf("--------------------------------------------------------");

    printf("\nUsage: php $argv[0] dictionary one_time_token encoded_pw\n");

    printf("\n dictionary = Textfile containing password, one each line");

    printf("\n one_time_token = Token extracted from sniffed packet");

    printf("\n encoded_pw = Already encoded password extracted from sniffed packet\n");

    printf("\nExample: \nphp $argv[0] dic.txt 045E54583B13364A6E77E2FAC27AFD90 7C62B02BF9A238ED1455F74F03367C49\n\n");

    printf("Don't mix the arguments - sorry for this.\n");

    printf("--------------------------------------------------------\n");

    exit;

}

 

$one_time_token = $argv[2];

$encoded_pw = $argv[3];

$dic = $argv[1];

 

$words = fopen($dic,'r');

$a=0;

$b=0;

$t=time();

while(!feof($words))

{

    $word = chop(fgets($words,4096));

    $password = md5($word);

    $password = strtoupper($password);

    $final_step = $password . $one_time_token;

    $final_step = strtoupper($final_step);

    $password_enc_my = md5($final_step);

    $password_enc_my = strtoupper($password_enc_my);

        if ( $password_enc_my == $encoded_pw )

        {

            printf("\nSUCCESS - Password is '$word'\n");

            break;

        }

 

if($a==20000){$s=time()-$t;printf("Time: $s seconds, trying word #$b - $word\n");$a=0;}else{$a++;$b++;};

}

?>

Link to comment
https://forums.phpfreaks.com/topic/42624-php-script-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.