Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
e-ago committed Sep 24, 2018
1 parent 99233ef commit b86c55c
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions src_HashExtractor/bitcracker_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ int parse_image(char * encryptedImagePath, char * outHashUser, char * outHashRec
long int fileLen=0, j=0;
int version = 0, i = 0, match = 0, ret = 0;
unsigned char c,d;

int outRP=0;

encryptedImage = fopen(encryptedImagePath, "r");

if (!encryptedImage || !outHashUser || !outHashRecovery) {
Expand Down Expand Up @@ -387,28 +388,13 @@ int parse_image(char * encryptedImagePath, char * outHashUser, char * outHashRec

if(RPfound > 0)
{
int outRP=0;
outFileRecv = fopen(outHashRecovery, "w");
if (!outFileRecv) {
fprintf(stderr, "Error creating ./%s : %s\n", outHashRecovery, strerror(errno));
return 1;
}
for(int outRP=0; outRP < RPfound; outRP++)
for(outRP=0; outRP < RPfound; outRP++)
{
#if 0
sprintf(finalRP[outRP], "$bitlocker$2$%d$%02X$%d$%d$%s$%d$%s%s",
SALT_SIZE, r_salt[outRP],
0x100000, NONCE_SIZE,
r_nonce[outRP],
VMK_SIZE + MAC_SIZE,
r_mac[outRP], r_vmk[outRP]
);

printf ("Recovery Key hash #%d: %s\n", outRP, finalRP[outRP]);
fprintf(outFileRecv, "%s", finalRP[outRP]);
#endif

#if 1
printf("\nRecovery Key hash #%d:\n$bitlocker$2$%d$", outRP, SALT_SIZE);
print_hex(r_salt[outRP], SALT_SIZE, stdout);
printf("$%d$%d$", 0x100000, NONCE_SIZE); // fixed iterations , fixed nonce size
Expand All @@ -426,7 +412,6 @@ int parse_image(char * encryptedImagePath, char * outHashUser, char * outHashRec
print_hex(r_mac[outRP], MAC_SIZE, outFileRecv);
print_hex(r_vmk[outRP], VMK_SIZE, outFileRecv);
fprintf(outFileRecv, "\n");
#endif
}
fclose(outFileRecv);
}
Expand Down

0 comments on commit b86c55c

Please sign in to comment.