Friday, February 16, 2018

Anti GDB ( debugger ) Program


Anti GDB ( debugger ) Program 

GDB use ptrace system call to attach to running program , this little trick below can
terminate the process as soon as it detects the program is ran using GDB.
Since Debugger can only one PTRACE another instance will fail.
#include
#include
void anti_debug(void)
{
        if(ptrace(PTRACE_TRACEME,0,0,0))
        {
                printf("Attached to debugger with terminate\n");
                kill(getpid());
                exit(0);
        }
}
main()
{
anti_debug();
printf("Anti GDB Code\n");
}


root@embsys-VirtualBox:~/github/intx/usrc/antigdb# ./a.out
Anti GDB Code

root@embsys-VirtualBox:~/github/intx/usrc/antigdb# gdb a.out
..
Reading symbols from a.out...(no debugging symbols found)...done.
(gdb) r
Starting program: /home/embsys/github/intx/usrc/antigdb/a.out
Attached to debugger with terminate-----------------------------------> Exit from the Program
[Inferior 1 (process 12902) exited normally]

Good Read:
https://majantali.net/2016/10/how-breakpoints-are-set/

Wednesday, February 7, 2018

sample screenrc file for Multitab Screen in Linux

sample screenrc file for Multitab Screen in Linux


# Screen Configuration file for Rails!
# Skip the startup message
startup_message off
defscrollback 50000

#scroll
termcapinfo xterm* ti@:te@
# Display a caption string below, appearing like tabs and
# displaying the window number and application name (by default).
caption always
#caption string "%{kw}%-w%{wr}%n %t%{-}%+w"
caption string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%m/%d %{W}%C%A%{g}]'
# j to move down a window, k to move up. Like teh VIM!
bind j focus down
bind k focus up
screen -t source1 1
screen -t build1  2
screen -t source2 3
screen -t build2 4
screen -t commit 5
screen -t temp   6
screen -t switch1 7
screen -t switch2 8
# MAP screen/window 1 to F1, 2 to F2 .......
bindkey -k k1 select 1
bindkey -k k2 select 2
bindkey -k k3 select 3
bindkey -k k4 select 4
bindkey -k k5 select 5
bindkey -k k6 select 6
bindkey -k k7 select 7
bindkey -k k8 select 8
bindkey -k k9 select 9
# Select first screen
select 1

Featured Post

XDP - Getting Started with XDP (Linux)