7 int main(int argc, char **argv)
11 u_int32_t len, pos, sig;
12 unsigned long end_code=0x48945489;
16 printf("Usage: modify <file>.\n");
19 fd = open(argv[1], O_RDWR);
22 printf("Modifying the header...\n");
23 printf("Signature position is at %d from the start address.\n", len-4);
24 lseek(fd, 8, SEEK_SET);
26 write(fd, &len, sizeof(u_int32_t));
28 printf("Checking the header...\n");
30 lseek(fd, 8, SEEK_SET);
31 read(fd, &pos, sizeof(u_int32_t));
34 lseek(fd, pos, SEEK_SET);
35 read(fd, &sig, sizeof(u_int32_t));
37 printf("Bad target image!\n");
39 printf("Correct target image!\n");