// Telia Sucks! #include <stdio.h> #include <stdlib.h> #include <string.h> #include <openssl/aes.h> int decrypt_aes_ecb(const unsigned char *key, const char *input_filename, const char *output_filename, long offset) { AES_KEY aes_key; if (AES_set_decrypt_key(key, 256, &aes_key) != 0) { fprintf(stderr, "Failed to set decryption key\n"); return -1; } FILE *input_file = fopen(input_filename, "rb"); if (input_file == NULL) { fprintf(stderr, "Failed to open input file: %s\n", input_filename); return -1; } FILE *output_file = fopen(output_filename, "wb"); if (output_file == NULL) { fprintf(stderr, "Failed to open output file: %s\n", output_filename); fclose(input_file); return -1; } fseek(input_file, offset, SEEK_SET); unsigned char in[16], out[16]; size_t read_bytes; while ((read_bytes = fread(in, 1, sizeof(in), input_file)) > 0) { AES_decrypt(in, out, &aes_key); fwrite(out, 1, read_bytes, output_file); } fclose(input_file); fclose(output_file); return 0; } int main(int argc, char *argv[]) { if (argc < 4) { printf("Usage: %s <input file> <output file> <offset>\n", argv[0]); return -1; } const unsigned char key[] = {0x35, 0x24, 0x79, 0xec, 0xce, 0xf2, 0xf1, 0xe8, 0x58, 0x8e, 0x93, 0x5c, 0x26, 0xc3, 0xa1, 0x15, 0x2b, 0x43, 0x3f, 0x86, 0xbd, 0x1e, 0xd3, 0x15, 0xcc, 0x1c, 0xed, 0x16, 0xc4, 0x67, 0x5c, 0xa2}; const char *input_filename = argv[1]; const char *output_filename = argv[2]; long offset = strtol(argv[3], NULL, 0); if (decrypt_aes_ecb(key, input_filename, output_filename, offset) != 0) { fprintf(stderr, "Decryption failed\n"); return -1; } printf("Decryption completed successfully.\n"); return 0; }
Du måste vara medlem för att kunna kommentera
Flashback finansieras genom donationer från våra medlemmar och besökare. Det är med hjälp av dig vi kan fortsätta erbjuda en fri samhällsdebatt. Tack för ditt stöd!
Swish: 123 536 99 96 Bankgiro: 211-4106