blob: f67b39f28054f00f637b1d64d801ca8e2f1f44e6 (
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
|
#include <stdio.h>
#include <stdlib.h>
#include "fileutils.h"
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);
}
|