blob: 30be341814fd5c8d07df6ff929ad5e8fcab2e1e2 (
plain)
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
|
#include <stdio.h>
#include <stdlib.h>
#include "fileutils.h"
#define THRESHOLD 20480
int main(int argc, char ** argv) {
unsigned int p = strtol(argv[1], 0, 0);
char * fn = argv[2];
FILE * f = fopen(fn, "r+");
if (!f) {
printf("Bleeh.\n");
exit(-1);
}
int l = filesize(f), i;
char * b = (char *) malloc(l);
fread(b, 1, l, f);
for (i = 0; i < l - 3; i++) {
unsigned int r = *((unsigned int *) &(b[i]));
if (r == p) {
printf("Found 0x%08x at %i = 0x%08x in %s\n", p, i, i, fn);
}
}
fclose(f);
}
|