summaryrefslogtreecommitdiff
path: root/md/writeup/linux_antidebug_1.md
blob: 2f17195e7c7fcd8ed096848707acba79cde06bc7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
title:Linux antidebug 1
keywords:linux,debug,antidebug

# Linux antidebug 1



Content: When ptrace is used for programm debugin then only
one ptrace can be attached to programmwhen we trying run ptrace
with PTRACE_TRACEME then we get  -1. I tested with gdb,ald.
Also this method should work with IDApro

```c
#include <stdlib.h>
#include <stdio.h>
#include <sys/ptrace.h>
 
long int ptraced()
{
    return (ptrace(PTRACE_TRACEME, 0, 0, 0) == -1);
}
 
int main()
{
    if ( ptraced() )
    {
        printf("Ptraced!\n");
    }
    return 0;
}
```

## Downloads 
http://archive.main.lv/files/writeup/linux_antidebug_1/antidebug1.tar.gz