| CrackMe with password |
[Click to reveal]#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
// Decryption key mask table from FUN_140001070
static const unsigned char xor_keys[14] = {
0xBB, 0x85, 0x83, 0xC9, 0xCB, 0x8D, 0x93,
0x86, 0xA4, 0x8A, 0x6C, 0x16, 0x14, 0x12
};
// Expected cipher stream from FUN_1400013F0
static const unsigned char cipher_target[14] = {
0xC9, 0xEA, 0xEE, 0xF0, 0xE3, 0xC9, 0xAC,
0xDE, 0xBD, 0xD7, 0xF9, 0x25, 0x27, 0x25
};
// Decrypt internal validation pattern
bool verify_password(const char* input) {
size_t len = strlen(input);
// Length check: Must be exactly 14 characters
if (len != 14) {
return false;
}
// Byte-by-byte decryption and verification loop
for (size_t i = 0; i < 14; i++) {
unsigned char decrypted_byte = cipher_target[i] ^ xor_keys[i];
if ((unsigned char)input[i] != decrypted_byte) {
return false;
}
}
return true;
}
int main(int argc, char** argv) {
char input_buffer[256] = {0};
// Junk delay loop simulation (from FUN_140001780)
volatile unsigned int dummy_state = 0xDEADBEEF;
for (int i = 0; i < 0x3567E0; i++) {
dummy_state = ((dummy_state >> 5) << 3) + 0x1337;
}
printf("Enter Password: ");
if (fgets(input_buffer, sizeof(input_buffer), stdin) == NULL) {
printf("\nNo input. Exiting.\n");
return 0;
}
// Strip trailing newlines
size_t input_len = strlen(input_buffer);
while (input_len > 0 && (input_buffer[input_len - 1] == '\n' || input_buffer[input_len - 1] == '\r')) {
input_buffer[--input_len] = '\0';
}
if (input_len == 0) {
printf("\nNo input. Exiting.\n");
return 0;
}
// Verify key
if (verify_password(input_buffer)) {
printf("Access granted.\n");
} else {
printf("Access denied.\n");
}
printf("\nPress Enter to exit...");
getchar();
return 0;
}
|
2026-08-30 12:48 |