Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Top Posters

Who's Online (4)

Powered by Vanilla. Made with Bootstrap.
blocking of signal code try and see the output
  • Hey guys here is a simple code to block your linux signal :D:D.. plz don't try this ;):D:D

    #include<stdio.h>
    #include<unistd.h>
    #include<sys/types.h>
    #include<signal.h>
    void sighandler(int signum)
    {
    switch( signum )
    {
    case SIGTERM:
    printf(\"SIGTERM received\n\");
    break;
    case SIGINT:
    printf(\"SIGINT Received\n\");
    break;
    case SIGCONT:
    printf(\"SIGCONT Received\n\");
    break;
    }
    }
    int main()
    {
    char buffer[ 80 ]=\"\0\";
    sigset_t block;
    signal( SIGTERM,sighandler );
    signal( SIGINT,sighandler );
    signal( SIGCONT,sighandler);
    sigemptyset(&block);
    sigaddset( &block,SIGTERM);
    sigaddset( &block,SIGINT);
    sigprocmask( SIG_BLOCK,&block,NULL);
    while ( strcmp(buffer,\"n\")!=0)
    {
    printf(\"enter a string:\");
    gets(buffer);
    puts(buffer);
    }
    sigprocmask(SIG_UNBLOCK,&block,NULL);
    while(1)
    printf(\"\rProgram running\");
    }

    Run this code into your linux and try to send the signal by pressing the keys ctrl+c and after that try to kill the process and then see what happen :D:D.. Enjoy!!!!
  • Null Set
    Posts: 112
    Interesting thing to use for viruses. :)
  • i was too thinking like that, :D:D thats why wrote :D
  • Deque
    Posts: 78
    But you can not catch SIGKILL. kill -9 will do it. That program is only suitable to annoy idiots.