#if 0 shc Version 3.9.6, Generic Shell Script Compiler GNU GPL Version 3 Md Jahidul Hamid shc -f sender-d.sh #endif static char data [] = #define chk1_z 22 #define chk1 ((&data[5])) "\250\277\114\224\251\153\106\010\262\300\062\112\153\256\366\036" "\106\002\145\140\125\310\174\373\152\251\071\211\003" #define opts_z 1 #define opts ((&data[29])) "\207" #define text_z 1976 #define text ((&data[168])) "\255\305\314\313\244\163\366\103\251\145\024\020\016\143\035\240" "\140\167\110\037\304\334\311\115\340\210\347\130\122\057\302\000" "\364\216\314\231\002\302\335\254\050\361\275\066\124\332\326\265" "\121\037\324\026\374\236\143\334\047\113\065\172\173\367\172\157" "\206\106\011\211\011\346\065\061\327\362\147\054\315\076\341\036" "\135\266\065\131\124\231\066\173\344\153\365\137\143\160\317\351" "\267\330\163\300\277\250\362\226\233\132\302\150\230\243\207\366" "\132\274\117\256\125\206\052\072\362\040\232\126\220\152\100\107" "\103\263\010\002\134\372\231\367\124\133\315\150\163\215\252\312" "\233\275\011\023\315\117\350\323\224\073\252\215\223\362\271\173" "\022\335\241\117\356\214\176\107\050\116\011\237\072\375\065\301" "\226\134\050\061\242\226\337\312\204\223\345\135\161\370\041\162" "\345\331\355\073\260\040\227\303\065\264\036\254\326\211\162\135" "\277\270\325\243\136\252\235\042\242\323\311\057\372\324\252\270" "\026\017\115\067\311\277\277\050\010\210\071\230\035\227\066\244" "\073\047\165\266\347\220\237\114\215\136\115\131\103\262\225\242" "\103\007\105\014\240\212\216\256\252\372\302\267\134\205\313\220" "\045\300\113\166\143\072\255\277\377\056\136\140\131\273\162\177" "\303\320\343\040\223\323\302\115\377\122\231\045\132\240\304\332" "\350\116\271\364\275\002\336\310\324\271\044\131\372\262\217\211" "\062\122\177\071\160\301\114\356\234\253\356\274\307\363\140\072" "\316\136\310\175\100\267\361\016\056\376\332\155\207\104\354\034" "\235\170\340\214\027\141\365\077\302\237\333\341\301\003\070\360" "\052\361\310\107\261\140\255\043\001\363\026\021\027\323\367\117" "\251\176\021\030\257\332\344\220\156\117\036\301\003\077\176\375" "\231\046\060\121\111\223\227\031\231\270\140\132\315\135\157\120" "\325\326\244\326\163\044\251\127\103\233\352\060\063\034\012\336" "\365\033\026\277\143\227\037\104\312\122\334\322\133\226\004\255" "\270\271\130\177\045\253\054\343\265\074\177\173\033\351\025\026" "\141\131\334\277\311\054\252\105\321\333\351\351\023\171\053\213" "\112\260\211\010\304\055\246\110\310\355\067\304\014\143\303\076" "\235\047\344\324\027\071\127\014\232\050\167\152\317\005\206\305" "\013\022\101\231\376\371\216\104\134\241\045\216\314\144\357\202" "\261\074\017\321\170\211\026\371\324\110\033\267\216\365\205\271" "\264\055\367\312\223\013\044\330\255\071\332\154\375\173\233\322" "\355\362\165\151\232\035\164\063\324\135\357\071\231\210\045\100" "\052\373\030\240\051\270\044\055\337\202\224\140\064\171\153\066" "\354\000\374\221\144\336\052\147\250\244\164\075\041\241\130\250" "\274\325\135\255\345\100\362\241\131\017\237\002\325\225\334\366" "\366\336\231\202\073\126\240\155\026\203\375\166\350\317\072\172" "\052\153\062\036\370\143\236\367\173\073\357\244\214\112\300\073" "\272\322\022\332\350\111\372\071\322\371\325\072\055\152\015\120" "\162\015\065\217\316\234\240\213\021\255\374\102\200\216\360\142" "\320\221\044\146\041\113\022\131\033\337\361\007\347\054\101\205" "\156\061\345\027\325\163\223\320\133\043\256\264\351\166\173\203" "\111\104\056\107\040\302\335\244\232\241\067\122\150\353\125\361" "\046\176\303\312\063\264\045\073\165\133\346\150\335\326\145\161" "\205\041\056\011\070\132\265\325\070\130\173\020\353\260\346\320" "\121\364\275\070\270\361\372\007\234\177\135\211\000\303\316\004" "\235\056\254\244\146\300\160\260\003\264\062\350\227\144\013\176" "\274\051\107\050\222\203\145\154\310\071\205\035\170\337\174\203" "\255\022\062\334\104\025\152\164\175\216\004\356\004\072\054\124" "\247\345\035\026\364\200\003\254\172\011\202\226\364\327\360\204" "\274\002\036\152\127\171\235\150\056\115\316\265\274\364\053\343" "\021\025\122\026\255\326\127\154\212\235\244\247\234\212\304\321" "\000\222\262\000\113\146\047\140\027\255\207\360\136\350\200\017" "\062\262\250\345\276\323\314\313\204\221\333\024\157\277\010\074" "\107\266\370\002\143\354\073\326\261\244\027\202\165\127\042\012" "\170\065\262\152\012\157\262\020\246\063\342\163\014\322\254\053" "\013\054\156\073\236\264\134\260\261\075\215\005\361\071\260\372" "\276\372\111\233\100\304\116\053\203\107\124\167\051\316\351\045" "\165\101\144\144\126\363\215\021\310\044\133\302\227\112\254\356" "\103\004\367\271\335\317\277\333\070\013\035\035\116\256\055\275" "\324\006\356\357\020\144\013\200\261\137\170\005\060\007\333\025" "\261\356\271\024\205\202\033\110\106\377\305\201\353\135\161\007" "\125\360\345\055\005\244\272\172\016\053\273\101\120\234\336\334" "\163\002\216\163\110\306\104\007\037\204\260\063\370\146\271\002" "\366\275\161\371\203\050\241\374\333\133\254\224\320\005\160\246" "\147\100\254\013\314\215\072\003\373\361\144\236\265\114\365\103" "\031\044\120\010\320\370\231\263\071\264\073\073\131\100\165\351" "\202\277\357\372\142\322\113\274\260\336\127\024\133\223\375\345" "\007\323\116\017\322\021\072\162\034\102\214\161\321\346\200\154" "\356\044\225\233\023\370\057\001\076\073\167\046\376\332\326\215" "\156\373\064\176\376\202\125\112\000\022\346\167\352\034\076\221" "\071\105\300\223\101\151\170\120\033\357\210\117\136\377\070\257" "\056\075\174\203\360\052\140\370\326\317\260\134\116\355\322\014" "\045\204\171\067\217\377\304\127\146\244\263\262\167\334\140\174" "\154\057\141\157\340\327\006\162\214\244\102\111\002\074\326\127" "\325\201\270\260\263\046\240\235\203\202\263\315\072\120\136\307" "\167\102\275\074\003\267\200\170\110\312\352\354\115\124\166\055" "\240\051\047\304\117\224\215\163\126\022\224\374\140\246\065\264" "\155\215\153\036\246\176\032\334\040\331\012\174\011\212\363\255" "\063\066\032\204\264\376\337\030\113\001\325\135\226\156\176\056" "\334\214\320\210\356\370\377\242\355\341\071\327\034\252\224\170" "\030\201\367\062\100\030\307\133\173\160\133\233\020\114\050\344" "\300\134\242\352\162\061\251\132\372\251\100\034\061\122\201\261" "\322\364\031\174\132\026\036\073\311\061\302\335\114\121\375\270" "\236\107\357\174\323\237\362\055\145\223\233\075\111\161\321\226" "\302\256\265\150\261\246\175\162\276\124\021\246\041\237\064\074" "\234\103\376\124\156\246\121\151\141\360\221\176\356\377\134\272" "\137\242\236\365\240\163\143\261\357\210\263\001\356\213\310\204" "\355\325\214\305\042\041\322\130\314\062\017\106\244\235\034\237" "\051\072\117\043\164\250\233\151\262\123\037\113\247\302\052\267" "\360\375\376\102\327\002\236\026\311\275\242\170\064\252\013\303" "\271\122\112\113\145\201\154\277\172\137\333\026\122\224\144\371" "\232\233\067\126\237\230\011\303\177\374\165\242\010\066\301\371" "\171\012\273\216\366\156\304\221\031\326\351\061\004\343\350\155" "\107\306\012\074\374\370\323\115\016\043\343\276\157\257\304\070" "\242\221\342\206\324\125\325\230\016\117\143\161\205\016\172\056" "\174\247\144\343\333\031\250\351\137\215\263\102\112\330\314\322" "\070\050\013\202\022\272\171\351\022\330\324\311\274\201\173\131" "\352\375\116\300\373\362\245\222\033\037\232\015\244\311\260\314" "\035\030\064\356\023\320\026\315\361\141\175\062\276\053\057\007" "\222\212\130\000\233\302\313\162\316\054\301\223\352\321\056\065" "\064\251\057\342\072\171\142\036\314\217\121\303\240\035\311\247" "\066\173\176\100\031\171\276\215\272\206\026\351\102\355\177\376" "\006\004\217\030\111\137\220\344\153\210\157\173\100\234\035\340" "\225\331\265\257\061\324\036\133\276\013\176\162\144\314\305\342" "\066\115\016\222\332\102\342\366\126\361\255\375\031\324\050\152" "\065\120\355\351\336\312\301\302\231\047\123\253\155\044\123\306" "\226\222\347\315\272\032\025\302\174\031\302\305\102\373\131\372" "\040\176\201\357\172\161\233\007\362\373\174\106\247\272\115\166" "\011\104\331\233\331\011\105\342\054\014\071\173\142\321\326\262" "\023\342\036\171\077\310\310\337\157\277\326\100\215\141\053\110" "\307\063\146\140\055\107\374\116\337\142\130\226\336\232\311\246" "\241\314\147\077\166\277\332\106\066\367\315\143\024\076\061\061" "\261\326\221\342\254\224\207\046\102\211\230\253\060\030\132\273" "\313\366\313\071\133\140\245\125\013\052\217\063\376\061\262\175" "\125\112\222\147\016\276\002\316\061\205\052\157\166\360\163\145" "\333\325\335\100\117\041\114\107\370\257\104\364\144\224\102\124" "\247\050\041\260\240\015\370\206\140\255\072\202\267\004\133\010" "\001\103\275\010\104\202\103\122\270\267\360\074\261\054\301\043" "\352\105\237\340\155\143\311\224\144\242\360\134\071\324\162\172" "\353\220\006\374\005\064\250\172\143\027\275\266\002\354\327\164" "\322\020\267\340\352\135\112\115\114\241\077\231\367\306\115\117" "\251\071\172\066\347\377\016\203\110\233\314\205\341\321\322\076" "\314\236\336\341\033\305\214\015\067\123\357\325\016\334\175\251" "\074\376\062\331\370\332\277\017\072\257\045\116\044\037\320\271" "\126\270\162\125\137\144\126\135\045\242\126\131\175\060\363\235" "\364\007\306\175\274\324\065\241\213\377\016\170\350\223\037\114" "\051\273\100\365\310\362\244\207\201\140\365\350\305\356\316\362" "\122\016\242\304\332\073\312\174\373\042\343\117\266\073\200\043" "\116\244\140\355\377\350\343\132\244\063\010\372\271\063\065\254" "\123\317\002\344\071\102\054\175\365\064\177\121\057\030\111\204" "\164\252\161\164\222\124\316\066\210\327\061\101\012\146\356\136" "\065\360\102\157\062\156\354\050\243\154\172\323\204\304\127\371" "\156\311\156\000\036\075\067\246\025\150\350\037\316\326\176\004" "\306\300\164\371\057\141\042\323\315\235\246\122\141\376\114\317" "\307\272\317\345\367\006\213\014\157\164\054\076\112\253\103\021" "\154\267\012\233\030\055\157\346\312\025\070\053\024\204\373\333" "\076\312\301\066\321\115\103\101\301\160\177\013\033\302\034\207" "\171\047\043\222\125\222\170\037\250\260\113\274\065\106\230\164" "\021\131\252\343\246\356\044\147\136\243\163\171\146\220\001\340" "\270\044\163\015\267\353\054\137\234\170\033\321\277\263\105\320" "\015\360\264\264\336\330\033\075\174\217\266\343\037\270\303" #define tst2_z 19 #define tst2 ((&data[2353])) "\345\223\042\022\357\241\112\354\260\222\102\167\252\056\120\014" "\076\214\307\026\157\130\244\363" #define chk2_z 19 #define chk2 ((&data[2375])) "\220\111\122\133\224\270\135\156\155\316\001\121\000\005\210\301" "\344\112\207\200\252" #define pswd_z 256 #define pswd ((&data[2448])) "\320\307\316\204\246\247\240\343\044\060\232\007\117\122\312\047" "\056\001\014\302\043\036\265\342\251\304\163\362\207\111\015\130" "\021\333\334\267\203\175\232\247\255\064\256\375\206\171\045\265" "\172\062\170\235\121\055\146\272\255\036\204\154\131\010\212\014" "\021\104\302\357\201\202\015\133\347\257\236\056\376\011\324\351" "\150\047\105\305\016\254\200\274\313\005\050\044\015\263\061\037" "\367\363\016\171\165\033\324\135\313\163\214\312\174\141\263\345" "\211\371\252\227\246\053\124\161\061\174\226\077\060\307\136\047" "\273\154\241\061\210\165\217\124\351\034\036\146\175\322\113\006" "\313\366\236\161\042\362\343\123\157\171\222\237\100\360\306\374" "\135\147\055\346\335\274\072\307\331\131\055\126\053\170\134\367" "\157\373\150\221\355\114\344\134\305\166\373\006\146\302\002\304" "\052\060\252\010\355\345\317\306\076\374\034\151\165\171\140\344" "\164\311\165\142\025\131\276\333\317\272\341\066\175\344\372\247" "\025\245\257\002\212\177\310\310\173\345\062\360\137\223\324\324" "\134\111\066\162\243\365\115\162\260\057\251\055\023\244\324\050" "\111\204\053\324\003\364\235\177\331\317\157\071\142\104\015\277" "\216\104\061\061\071\176\244\351\256\116\026\301\362\353\352\074" "\157\025\020\163\012\255\362\344\175\142\035\337\247\053\236\065" "\157\320\147\250\117\014\177\372\362\363\355\172" #define shll_z 10 #define shll ((&data[2712])) "\116\326\177\257\317\335\162\123\050\324\344\244\257\005" #define xecc_z 15 #define xecc ((&data[2724])) "\312\105\336\014\160\351\140\311\301\063\375\121\331\242\037\000" "\331" #define msg1_z 65 #define msg1 ((&data[2752])) "\134\050\374\022\242\056\212\100\177\270\300\246\373\100\315\245" "\164\205\022\167\263\367\065\001\253\244\304\177\247\306\023\242" "\210\302\371\325\060\023\104\341\145\324\350\321\153\167\015\367" "\052\260\264\020\041\120\320\077\164\240\162\015\216\162\162\060" "\262\165\235\351\005\042\055\331\327\317\061\134\171\252\263\147" "\044\360\141\367\077\070\246\105\222\323" #define date_z 1 #define date ((&data[2831])) "\337" #define rlax_z 1 #define rlax ((&data[2832])) "\117" #define inlo_z 3 #define inlo ((&data[2833])) "\356\063\363" #define lsto_z 1 #define lsto ((&data[2836])) "\307" #define tst1_z 22 #define tst1 ((&data[2838])) "\154\343\141\256\045\147\355\072\031\127\273\063\274\063\151\005" "\245\312\202\350\203\025\003\017" #define msg2_z 19 #define msg2 ((&data[2861])) "\125\166\060\370\333\360\072\122\317\063\176\252\305\345\310\253" "\031\367\354\017\073\264"/* End of data[] */; #define hide_z 4096 #define DEBUGEXEC 0 /* Define as 1 to debug execvp calls */ #define TRACEABLE 1 /* Define as 1 to enable ptrace the executable */ #define BUSYBOXON 0 /* Define as 1 to enable work with busybox */ /* rtc.c */ #include #include #include #include #include #include #include #include /* 'Alleged RC4' */ static unsigned char stte[256], indx, jndx, kndx; /* * Reset arc4 stte. */ void stte_0(void) { indx = jndx = kndx = 0; do { stte[indx] = indx; } while (++indx); } /* * Set key. Can be used more than once. */ void key(void * str, int len) { unsigned char tmp, * ptr = (unsigned char *)str; while (len > 0) { do { tmp = stte[indx]; kndx += tmp; kndx += ptr[(int)indx % len]; stte[indx] = stte[kndx]; stte[kndx] = tmp; } while (++indx); ptr += 256; len -= 256; } } /* * Crypt data. */ void arc4(void * str, int len) { unsigned char tmp, * ptr = (unsigned char *)str; while (len > 0) { indx++; tmp = stte[indx]; jndx += tmp; stte[indx] = stte[jndx]; stte[jndx] = tmp; tmp += stte[indx]; *ptr ^= stte[tmp]; ptr++; len--; } } /* End of ARC4 */ /* * Key with file invariants. */ int key_with_file(char * file) { struct stat statf[1]; struct stat control[1]; if (stat(file, statf) < 0) return -1; /* Turn on stable fields */ memset(control, 0, sizeof(control)); control->st_ino = statf->st_ino; control->st_dev = statf->st_dev; control->st_rdev = statf->st_rdev; control->st_uid = statf->st_uid; control->st_gid = statf->st_gid; control->st_size = statf->st_size; control->st_mtime = statf->st_mtime; control->st_ctime = statf->st_ctime; key(control, sizeof(control)); return 0; } #if DEBUGEXEC void debugexec(char * sh11, int argc, char ** argv) { int i; fprintf(stderr, "shll=%s\n", sh11 ? sh11 : ""); fprintf(stderr, "argc=%d\n", argc); if (!argv) { fprintf(stderr, "argv=\n"); } else { for (i = 0; i <= argc ; i++) fprintf(stderr, "argv[%d]=%.60s\n", i, argv[i] ? argv[i] : ""); } } #endif /* DEBUGEXEC */ void rmarg(char ** argv, char * arg) { for (; argv && *argv && *argv != arg; argv++); for (; argv && *argv; argv++) *argv = argv[1]; } void chkenv_end(void); int chkenv(int argc) { char buff[512]; unsigned long mask, m; int l, a, c; char * string; extern char ** environ; mask = (unsigned long)getpid(); stte_0(); key(&chkenv, (void*)&chkenv_end - (void*)&chkenv); key(&data, sizeof(data)); key(&mask, sizeof(mask)); arc4(&mask, sizeof(mask)); sprintf(buff, "x%lx", mask); string = getenv(buff); #if DEBUGEXEC fprintf(stderr, "getenv(%s)=%s\n", buff, string ? string : ""); #endif l = strlen(buff); if (!string) { /* 1st */ sprintf(&buff[l], "=%lu %d", mask, argc); putenv(strdup(buff)); return 0; } c = sscanf(string, "%lu %d%c", &m, &a, buff); if (c == 2 && m == mask) { /* 3rd */ rmarg(environ, &string[-l - 1]); return 1 + (argc - a); } return -1; } void chkenv_end(void){} #if !TRACEABLE #define _LINUX_SOURCE_COMPAT #include #include #include #include #include #include #include #if !defined(PTRACE_ATTACH) && defined(PT_ATTACH) # define PTRACE_ATTACH PT_ATTACH #endif void untraceable(char * argv0) { char proc[80]; int pid, mine; switch(pid = fork()) { case 0: pid = getppid(); /* For problematic SunOS ptrace */ #if defined(__FreeBSD__) sprintf(proc, "/proc/%d/mem", (int)pid); #else sprintf(proc, "/proc/%d/as", (int)pid); #endif close(0); mine = !open(proc, O_RDWR|O_EXCL); if (!mine && errno != EBUSY) mine = !ptrace(PTRACE_ATTACH, pid, 0, 0); if (mine) { kill(pid, SIGCONT); } else { perror(argv0); kill(pid, SIGKILL); } _exit(mine); case -1: break; default: if (pid == waitpid(pid, 0, 0)) return; } perror(argv0); _exit(1); } #endif /* !TRACEABLE */ char * xsh(int argc, char ** argv) { char * scrpt; int ret, i, j; char ** varg; char * me = argv[0]; if (me == NULL) { me = getenv("_"); } if (me == 0) { fprintf(stderr, "E: neither argv[0] nor $_ works."); exit(1); } ret = chkenv(argc); stte_0(); key(pswd, pswd_z); arc4(msg1, msg1_z); arc4(date, date_z); if (date[0] && (atoll(date) 1) ? ret : 0; /* Args numbering correction */ while (i < argc) varg[j++] = argv[i++]; /* Main run-time arguments */ varg[j] = 0; /* NULL terminated array */ #if DEBUGEXEC debugexec(shll, j, varg); #endif execvp(shll, varg); return shll; } int main(int argc, char ** argv) { #if DEBUGEXEC debugexec("main", argc, argv); #endif #if !TRACEABLE untraceable(argv[0]); #endif argv[1] = xsh(argc, argv); fprintf(stderr, "%s%s%s: %s\n", argv[0], errno ? ": " : "", errno ? strerror(errno) : "", argv[1] ? argv[1] : "" ); return 1; }