Skip to content

Instantly share code, notes, and snippets.

@hiromu
Created December 8, 2011 10:33
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 hiromu/1446669 to your computer and use it in GitHub Desktop.
Save hiromu/1446669 to your computer and use it in GitHub Desktop.
Sample of sys_brainfuck()
#include <string.h>
#include <stdio.h>
#include <asm/unistd.h>
#include <sys/syscall.h>
#ifdef __i386__
#define __NR_brainfuck 349
#elif __x86_64__
#define __NR_brainfuck 312
#elif __arm__
#define __NR_brainfuck 378
#endif
#define LEN 3000
int main (void)
{
char source[LEN], input[LEN], output[LEN];
printf("Source: ");
gets(source);
printf("Input: ");
gets(input);
syscall(__NR_brainfuck, source, input, output, strlen(source), strlen(input), LEN);
puts(output);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment