Skip to content
Snippets Groups Projects
Commit c48fe901 authored by aneesh's avatar aneesh
Browse files

crack fixwd
parent 7cf648c4
No related branches found
No related tags found
No related merge requests found
Pipeline #2866 canceled
......@@ -9,6 +9,7 @@
#include <stdbool.h>
int exist[30];
BYTE old[6];
int count=0;
void printRandomString(int hashes[30][32])
{ bool cracked = true;
......@@ -16,8 +17,12 @@ SHA256_CTX ctx;
BYTE buffer[SHA256_BLOCK_SIZE];
int count = 0;
for (int i = 0; i < 100000000000000000; ++i) {
if (count=30)
{
break;
}
BYTE res[6];
for (int j = 0; j < 6; j++)
res[j] = (rand()% 26)+97;;
......@@ -39,6 +44,7 @@ SHA256_CTX ctx;
if( cracked==true && exist[k+1]!=1 ){
ctx.data[6] = '\0';
exist[k+1]=1;
++count;
printf("%s %d\n", ctx.data, k+1);
}
}
......@@ -52,11 +58,15 @@ void variations(char *word_list_file, int hashes[30][32])
BYTE buffer[SHA256_BLOCK_SIZE];
BYTE password[6];
bool cracked = true;
int count = 0;
FILE *word_list;
word_list=fopen(word_list_file, "rb");
while ( fgets(password, 7, word_list) != '\0'){
if (count==30)
{
break;
}
for (int c = 0; c < 6; ++c)
{ BYTE password1[6];
......@@ -101,6 +111,7 @@ void variations(char *word_list_file, int hashes[30][32])
if( cracked==true && exist[j+1]!=1){
ctx.data[6] = '\0';
exist[j+1]=1;
count++;
printf("%s %d\n", ctx.data, j+1);
}
}
......@@ -116,11 +127,11 @@ void variations(char *word_list_file, int hashes[30][32])
}
void printRandomString1(int k)
{
int count = 0;
for (int i = 0; i < k; ++i) {
for (int i = 0; i < k-1; ++i) {
BYTE res[6];
for (int j = 0; j < 6; j++)
res[j] = (rand()% 26)+97;;
res[j] = (rand()% 59)+65;;
res[6]='\0';
printf("%s\n",res );
}
......@@ -132,7 +143,7 @@ void bruteforce(int hashes[30][32]){
BYTE buffer[SHA256_BLOCK_SIZE];
BYTE password[4];
bool cracked = true;
int count = 0;
for(int c1=32; c1<127; c1++){
password[0] = c1;
......@@ -192,7 +203,7 @@ void permute(char *a, int l, int r,int hashes[30][32],int status)
{ SHA256_CTX ctx;
BYTE buffer[SHA256_BLOCK_SIZE];
bool cracked = true;
int count = 0;
int count1 = 0;
char word[30];
int i;
......@@ -226,19 +237,19 @@ if (l == r)
}
}
}else{BYTE n[6];
int count=0;
int count1=0;
for (int k = 0; k < 6; ++k)
{
n[k]=a[k];
if (old[k]==n[k])
{
++count;
++count1;
}
}
n[6]='\0';
if(count<6)
if(count1<6)
{
printf("%s\n",n );
for (int k = 0; k < 7; ++k)
......@@ -267,7 +278,7 @@ void permutations1(char *word_list_file, int hashes[30][32],int status)
BYTE buffer[SHA256_BLOCK_SIZE];
BYTE password[12];
bool cracked = true;
int count = 0;
char word[30];
......@@ -304,7 +315,7 @@ void crack6(char *word_list_file, int hashes[30][32])
BYTE buffer[SHA256_BLOCK_SIZE];
BYTE password[6];
bool cracked = true;
int count = 0;
char word[30];
......@@ -330,6 +341,7 @@ void crack6(char *word_list_file, int hashes[30][32])
if( cracked==true && exist[j+1]!=1 ){
ctx.data[6] = '\0';
exist[j+1]=1;
++count;
printf("%s %d\n", ctx.data, j+1);
}
}
......@@ -362,7 +374,7 @@ void crack6(char *word_list_file, int hashes[30][32])
b++;
}
bruteforce(hashes);
unsigned char buff6[640];
file_6=fopen("pwd6sha256","rb");
fread(buff6, sizeof(buff6),1, file_6);
......@@ -374,7 +386,7 @@ void crack6(char *word_list_file, int hashes[30][32])
printf("\n");
}
hashes[a][b]=buff6[i];
printf("%x", hashes[a][b]);
b++;
}
......@@ -406,7 +418,7 @@ if (argc==3)
int i,a=0,b=0;
fseek(password_file, 0L, SEEK_END);
int sz = ftell(password_file);
printf("%d\n", sz );
rewind(password_file);
int hashes[sz/32][32];
unsigned char buff[sz];
......@@ -419,7 +431,7 @@ if (argc==3)
}
hashes[a][b]=buff[i];
printf("%x",hashes[a][b]);
b++;
}
......@@ -430,6 +442,3 @@ if (argc==3)
return 0;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment