You can run this with gcc compiler. This is an example for all teams on this site. What this program does is just display text "Example C!". This program uses C, ASM, and Hexadecimals. I'm not going to explain how this works, if you really want to know go study some C and ASM. The purpose of showing you this code is to try to get all of you to learn some C and ASM. Also I was bored af since there was no interesting anime xd.
main.c:
To compile the code run, modify if needed:
gcc main.c -o main
Results:
Example C!
main.c:
Code:
#include <sys/mman.h>
#include <string.h>
int main ()
{
char code[] = {
0x48, 0xc7, 0xc7, 0x01, 0x00, 0x00,
0x00, 0xe8, 0x0b, 0x00, 0x00, 0x00,
0x45, 0x78, 0x61, 0x6D, 0x70, 0x6C,
0x65, 0x20, 0x43, 0x21, 0x0a, 0x5e,
0x48, 0xc7, 0xc2, 0x0b, 0x00, 0x00,
0x00, 0xb8, 0x01, 0x00, 0x00, 0x00,
0x0f, 0x05, 0xbf, 0x0b, 0x00, 0x00,
0x00, 0xb8, 0x3c, 0x00, 0x00, 0x00,
0x0f, 0x05
};
void *buf;
buf = mmap (0,sizeof(code),PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_ANON,-1,0);
memcpy (buf, code, sizeof(code));
((void (*) (void))buf)();
}
To compile the code run, modify if needed:
gcc main.c -o main
Results:
Example C!