Skip to content

Instantly share code, notes, and snippets.

@ilyakurdyukov
Created December 5, 2020 05:47
Show Gist options
  • Save ilyakurdyukov/0737c075f4d1553be012f9b942743607 to your computer and use it in GitHub Desktop.
Save ilyakurdyukov/0737c075f4d1553be012f9b942743607 to your computer and use it in GitHub Desktop.
A bottle of perfume with the fragrance of the x86/x86_64 instruction set.
char main
[/*x86*/]
__attribute__
((section(".text"))
)="WTYH)9Zj8_j7H)9]R"
"H)9^\350\0\0\0\0H)1^R"
"H))Z8<2u\366j<)9Xj9"
")9j9VY)<$[S_H\xbd^["
"H$@\xcd\200-XP\xf"
"\5XP_j<W\xeb\xe2]"
"Hello World!\n";
/*Linux_Only!*/
@ilyakurdyukov
Copy link
Author

Here's what this code does (but using syscalls, not stdlib):

  const char *m = "Hello World!\n";
  fwrite(m, 1, strlen(m), stdout);
  exit(0);

So you can change the message at the end of the "main" string and it will be printed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment