Skip to content

Instantly share code, notes, and snippets.

@iagox86
Created October 4, 2014 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iagox86/ca1b3c0b9e427f1cd104 to your computer and use it in GitHub Desktop.
Save iagox86/ca1b3c0b9e427f1cd104 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void spawn_shell()
{
system("/bin/sh");
exit(0);
}
int main(int argc, char *argv[])
{
int i = 0;
char str[16];
int j = 0;
printf("spawn_shell is at 0x%p\n", spawn_shell);
printf("i = %d\x", i);
printf("j = %d\x", j);
printf("Please enter a string: ");
gets(str);
printf("\n");
printf("i = %d\x", i);
printf("j = %d\x", j);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment