CS计算机代考程序代写 #include

#include
#include
#include

// to permit this type of buffer-overflow attack, on Mac, (and to stick with 32-bit arch) compile with:
// gcc -O2 -m32 -fno-stack-protector -Xlinker -allow_stack_execute

char *x;

void printPrefix (char* str) {
char buf[10];
char *bp = buf;

x = buf;

// copy str up to “.” input buf
while (*str!=’.’)
*(bp++) = *(str++);
*bp = 0;
}

// read string from standard input
void getInput (char* b) {
char* bc = b;
int n;
while ((n=fread(bc,1,1000,stdin))>0)
bc+=n;
}

void run () {
char input[1000];
puts (“Starting.”);
//getInput (input);
input[0] = ‘.’;
printPrefix (input);
puts (“Done.”);
printf (“./make-worm 0x%x 0x%x 26 64 > worm\n”, (int)puts, (int)x);
}

int main (int arc, char** argv) {
asm volatile (“andl $0xfff00000, %esp\n”);
asm volatile (“andl $0xfff00000, %ebp\n”);
run ();
_Exit (0);
}