#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
#include <wait.h>
#include <signal.h>
struct itimerval t={{0x00000000,0x00000000},
{0x00000000,0x0001A000}};
unsigned char c[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc3};
void stopper(int unused)
{
exit(0);
}
void main()
{
int i;
unsigned long *punch0, *punch1;
void(*f)() = (void *) c;
punch0 = (unsigned long *) c;
punch1 = (unsigned long *) &c[4];
for(;;)
{
*punch0 += (unsigned long) rand();
*punch1 += (unsigned long) rand();
switch(fork())
{
case 0:
fprintf(stdout, "Trying %02X %02X %02X %02X %02X %02X %02X %02X %02X\n",
c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8]);
fflush (stdout);
/*
* This stops any "forever" loops that may happen.
*/
(void)signal(SIGALRM, stopper);
(void)setitimer(ITIMER_REAL, &t, &t);
(*f)();
exit(0);
case -1:
fprintf(stderr, "Fork failed\n");
break;
default:
wait(&i);
}
}
}
Cheers,
Dick Johnson
Richard B. Johnson
Project Engineer
Analogic Corporation
Penguin : Linux version 2.1.63 on an i586 machine (66.15 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.