#if 0 shc Version 3.8.7, Generic Script Compiler Copyright (c) 1994-2009 Francisco Rosales ./shc -vvv -e 08/07/2022 -f match #endif static char data [] = #define inlo_z 3 #define inlo ((&data[0])) "\204\244\053" #define lsto_z 1 #define lsto ((&data[3])) "\010" #define chk1_z 22 #define chk1 ((&data[7])) "\034\037\130\163\013\311\014\254\236\017\375\240\160\127\257\275" "\163\276\327\256\340\236\177\121\322" #define msg2_z 19 #define msg2 ((&data[32])) "\204\223\033\211\277\212\326\317\124\030\226\076\166\210\035\146" "\177\354\205\004\204\033\151\242\240\072" #define date_z 11 #define date ((&data[55])) "\232\310\145\375\271\031\127\162\331\010\070" #define pswd_z 256 #define pswd ((&data[101])) "\156\170\321\263\172\113\042\070\362\267\304\376\324\343\126\136" "\232\057\343\055\112\114\320\353\207\365\044\254\002\261\071\160" "\052\012\044\020\202\343\110\110\055\353\236\042\236\366\006\034" "\235\067\365\055\126\321\057\130\205\207\030\335\052\332\026\300" "\345\332\320\147\275\030\260\353\003\116\015\242\105\024\277\342" "\113\265\017\241\206\077\371\013\306\022\351\361\354\000\261\322" "\332\201\072\227\231\352\202\235\071\220\077\176\244\376\141\360" "\264\161\222\072\260\213\106\167\235\057\150\212\060\032\135\012" "\233\227\242\065\202\045\322\274\266\022\073\133\021\234\113\305" "\015\335\377\276\151\106\066\007\165\237\221\245\271\357\260\125" "\206\123\212\011\170\135\305\056\157\001\212\201\235\325\106\252" "\263\106\151\034\214\237\043\002\076\265\250\367\244\131\114\053" "\254\327\065\045\064\373\123\244\374\336\045\231\263\154\104\147" "\262\255\203\077\115\247\102\213\135\352\203\001\103\320\055\360" "\247\143\025\333\136\151\200\133\107\245\364\373\021\071\142\304" "\347\345\004\064\215\106\300\352\060\103\354\164\023\031\144\273" "\175\171\226\333\343\026\066\052\274\053\045\316\145\207\222\114" "\155\227\201\372\335\101\344\016\205\320\203\231\352\347\124\150" "\141\352\103\244\126\107\334\111\376\241\107\323\205\235\061\037" "\315\024\115\030\141\035\003\351\022\047\225\025\331\317\205\004" "\331\252\250\060\361\205" #define tst1_z 22 #define tst1 ((&data[397])) "\300\302\254\136\364\221\304\051\143\116\173\142\121\053\035\173" "\051\274\373\144\002\372\070\356\332\121\110" #define opts_z 1 #define opts ((&data[419])) "\173" #define msg1_z 42 #define msg1 ((&data[422])) "\067\107\176\215\116\041\072\325\302\066\333\315\157\325\254\121" "\046\265\063\134\321\171\201\161\040\377\076\322\266\005\107\146" "\076\040\073\107\066\346\170\133\164\236\137\254\124\112\157\351" #define xecc_z 15 #define xecc ((&data[469])) "\345\044\075\101\201\076\043\121\057\275\122\256\331\275\174\261" "\115\222" #define rlax_z 1 #define rlax ((&data[486])) "\172" #define text_z 337 #define text ((&data[528])) "\160\243\376\063\117\134\050\034\210\061\065\315\235\155\024\361" "\267\204\333\027\316\224\374\034\047\214\022\352\015\216\050\176" "\062\046\261\202\203\331\236\013\013\046\301\336\213\102\127\001" "\030\042\060\043\117\130\214\044\353\324\366\322\037\166\110\170" "\356\234\333\333\167\015\175\042\304\372\067\207\170\347\172\204" "\030\132\110\237\007\160\020\035\124\353\251\037\035\140\131\172" "\102\200\024\175\307\076\376\124\362\106\047\214\151\205\330\106" "\050\224\002\305\272\235\374\017\036\041\026\237\015\150\004\123" "\360\233\027\321\133\312\107\337\163\260\123\066\212\021\016\347" "\330\323\033\334\333\127\072\074\155\343\153\106\257\324\001\115" "\060\103\213\032\011\127\202\201\176\317\211\262\172\356\247\025" "\314\356\160\010\104\205\026\360\260\213\020\207\112\250\004\301" "\251\271\164\034\264\327\173\127\323\037\200\330\363\306\070\235" "\337\170\335\144\066\070\206\203\112\366\374\022\141\303\331\325" "\111\056\245\271\016\231\343\163\262\214\317\127\131\040\117\270" "\367\212\353\055\005\153\064\370\253\377\305\274\374\363\262\334" "\155\173\303\263\036\070\336\042\125\365\012\075\361\155\150\353" "\254\073\004\001\141\171\231\017\134\171\370\253\353\127\037\101" "\007\077\150\054\174\263\176\321\101\257\124\043\005\317\010\174" "\241\320\046\174\207\177\350\150\076\021\212\374\267\101\100\366" "\264\130\162\105\252\126\354\172\373\216\154\133\361\054\200\340" "\010\175\053\274\302\255\305\335\362\072\244\213\064\271\232\137" "\356\027\067\147\171\037\024\276\322\214\075\350\056\173\316\272" "\265\163\311\142\231\343\146\072\243\333\324\331\250\101\355\232" "\371\162\165\020\100\011\015\135\061\231\157\034\247\376" #define shll_z 8 #define shll ((&data[885])) "\262\061\043\040\006\025\266\112" #define tst2_z 19 #define tst2 ((&data[897])) "\355\260\121\371\175\120\152\357\204\052\130\361\000\227\000\057" "\326\120\032\016\331\332\316\274\046\322" #define chk2_z 19 #define chk2 ((&data[921])) "\377\141\276\077\066\065\104\211\011\122\126\232\072\206\214\317" "\311\270\130\117\372\062\164\162"/* End of data[] */; #define hide_z 4096 #define DEBUGEXEC 0 /* Define as 1 to debug execvp calls */ #define TRACEABLE 0 /* Define as 1 to enable ptrace the executable */ /* 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]; } int chkenv(int argc) { char buff[512]; unsigned long mask, m; int l, a, c; char * string; extern char ** environ; mask = (unsigned long)&chkenv; mask ^= (unsigned long)getpid() * ~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; } #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; 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; }