diff --git a/duck/object.c b/duck/object.c new file mode 100644 index 0000000..fe85415 --- /dev/null +++ b/duck/object.c @@ -0,0 +1,22 @@ +#include +#include + +#define N 75000 + +int main() { + unsigned char *buf = (unsigned char *)malloc(N * sizeof(char)); + unsigned char check[4] = {0xd9, 0x45, 0x08, 0xd9}; + size_t n = fread(buf, sizeof(char), N, stdin); + for(size_t i = 0; i < n - 3; i++){ + if(buf[i] == check[0] && buf[i + 1] == check[1] && buf[i + 2] == check[2] && buf[i + 3] == check[3]) { + buf[i + 4] = 0xeb; + buf[i + 5] = 0x90; + buf[i + 6] = 0xd8; + buf[i + 7] = 0xc9; + break; + } + } + fwrite(buf, sizeof(char), n, stdout); + free(buf); + return 0; +}