-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremove_metadata.cpp
36 lines (31 loc) · 1.22 KB
/
remove_metadata.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <fstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <random>
#include "utils.h"
int main(){
std::cout << std::hex;
char* full_file_content; size_t size; read_from_file("C:\\Hacking\\mossad\\intel.txt.enc.unxored", &full_file_content, size);
std::mt19937 generator;
generate_state_with_seed(generator._Ax, 0x61774d56);
std::cout << "size: " << size << std::endl;
std::ofstream os("C:\\Hacking\\mossad\\intel.txt.enc.unxored.no_metadata", std::ios::binary);
int block_size = 49;
size_t i;
for(i = 36; i < size; i += (block_size + 4)) {
auto expected_random = generator();
if (i + block_size + 4 == 0x6069) block_size--;
if (*((uint32_t *) &full_file_content[i]) != expected_random) {
std::cout << "wrong random number, i: 0x" << i << ", in file: 0x" << *((uint32_t *) &full_file_content[i])
<< ", expected: 0x" << expected_random << std::endl;
break;
}
std::cout << "i: " << i << std::endl;
os.write(&full_file_content[i + 4], block_size);
}
std::cout << "i: " << i << ", size: " << size << std::endl;
delete[] full_file_content;
os.close();
}