Archived
1
0
Fork 0
This commit is contained in:
nihonium 2022-04-17 14:07:30 +03:00
parent 00a1019ddc
commit bcf24631d4
Signed by: nihonium
GPG key ID: 0924047F4136012C

22
duck/object.c Normal file
View file

@ -0,0 +1,22 @@
#include <stdio.h>
#include <stdlib.h>
#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;
}