Created
October 19, 2015 20:03
-
-
Save blaquee/5f5d3b1f356fae2173fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <sys/ptrace.h> | |
| void pre_check(int argc, char **argv, char **envp) | |
| { | |
| printf("Inside pre_check!\n"); | |
| if(ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) | |
| { | |
| printf("Aliens found!\n"); | |
| exit(0); | |
| } | |
| } | |
| __attribute__((section(".preinit_array"))) typeof(pre_check) *_preinit = pre_check; | |
| void __attribute__ ((constructor)) anti_trace(void); | |
| void anti_trace(void) | |
| { | |
| printf("Inside constructor!\n"); | |
| } | |
| void message() | |
| { | |
| printf("Last place, called from main() :(\n"); | |
| } | |
| int main(int argc, char **argv) | |
| { | |
| message(); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment