summaryrefslogtreecommitdiff
path: root/md/writeup/linux_antidebug_2.md
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2021-05-27 09:01:12 +0100
committerFreeArtMan <dos21h@gmail.com>2021-05-27 09:01:12 +0100
commit9b9586b559edb387af804c52d2b593b711ce98be (patch)
treeafff99aea85e450c7824192f38be74bfd9e8f567 /md/writeup/linux_antidebug_2.md
parente8de8442cecce54fc4f372dc2dacecc7abca23ae (diff)
downloadmd-content-9b9586b559edb387af804c52d2b593b711ce98be.tar.gz
md-content-9b9586b559edb387af804c52d2b593b711ce98be.zip
Updated 6 more articles from html to md
Diffstat (limited to 'md/writeup/linux_antidebug_2.md')
-rw-r--r--md/writeup/linux_antidebug_2.md84
1 files changed, 84 insertions, 0 deletions
diff --git a/md/writeup/linux_antidebug_2.md b/md/writeup/linux_antidebug_2.md
new file mode 100644
index 0000000..b4c60e1
--- /dev/null
+++ b/md/writeup/linux_antidebug_2.md
@@ -0,0 +1,84 @@
+title:Linux antidebug 2
+keywords:linux,debug,antidebug
+
+# Linux antidebug 2
+Content: This is dirty solution it checks programms argv[0] name
+with your defined namewhen running debuger such as gdb or ald name is
+chaned to fullpath nameuser defined name from terminal is './main'.
+
+```c
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+
+int main( int argc , char **argv )
+{
+ pid_t pid,ppid;
+ FILE *f;
+ char str[128];
+ char spid[10];
+
+ //openfile and write ppid
+ f = fopen( "pid.txt" , "w" );
+ pid = getpid();
+ fprintf(f,"%d ",pid);
+ fclose( f );
+ f = fopen( "pid.txt" , "r" );
+ fscanf( f , "%s" , spid );
+ fclose( f );
+
+ strcpy( str , "cat /proc/" );
+ strcat( str , &spid[0] );
+ strcat( str , "/cmdline");
+ printf( "[%s]\n", spid );
+ system( str );
+
+ printf("\n");
+}
+```
+
+Dirty function that makes dirty solution at one place
+
+```c
+int badppid( const char *real_name )
+{
+ pid_t pid,ppid;
+ FILE *f;
+ char str[128];
+ char spid[10];
+ f = fopen( "pid.txt" , "w" );
+ pid = getpid();
+ fprintf(f,"%d ",pid);
+ fclose( f );
+
+
+ f = fopen( "pid.txt" , "r" );
+ fscanf( f , "%s" , spid );
+ fclose( f );
+
+
+ strcpy( str , "cat /proc/" );
+ strcat( str , &spid[0] );
+ strcat( str , "/cmdline > name.txt");
+ system( str );
+
+ f = fopen( "name.txt" , "r" );
+ fscanf( f , "%s" , str );
+ fclose( f );
+ if ( strncmp(str,real_name,strlen(real_name)) != 0 )
+ {
+ return -1;
+ }
+
+ return 0;
+}
+```
+
+## Downloads
+
+http://archive.main.lv/files/writeup/linux_antidebug_2/antidebug2.tar.gz
+
+
+
+