mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-23 11:35:19 +01:00
Delete
This commit is contained in:
parent
9e7d0c3e4b
commit
86e0e73366
@ -1,451 +0,0 @@
|
||||
#if 0
|
||||
CloverConfigPlistValidator, Credit: Jief_Machak
|
||||
ConfigValidator, Credit: chris1111
|
||||
shc Version 3.8.9b, Copyright (c) 1994-2015 Francisco Rosales
|
||||
|
||||
#endif
|
||||
|
||||
static char data [] =
|
||||
#define msg2_z 19
|
||||
#define msg2 ((&data[0]))
|
||||
"\073\057\031\325\140\002\027\264\142\242\317\153\205\200\012\374"
|
||||
"\200\102\313\260\252\035\025"
|
||||
#define date_z 1
|
||||
#define date ((&data[23]))
|
||||
"\025"
|
||||
#define tst1_z 22
|
||||
#define tst1 ((&data[29]))
|
||||
"\332\322\333\016\217\341\062\141\246\137\012\376\060\323\125\266"
|
||||
"\200\200\252\212\076\013\316\240\376\200\241"
|
||||
#define rlax_z 1
|
||||
#define rlax ((&data[51]))
|
||||
"\373"
|
||||
#define msg1_z 42
|
||||
#define msg1 ((&data[62]))
|
||||
"\012\140\274\102\361\237\127\310\172\114\152\132\057\012\147\254"
|
||||
"\265\031\350\333\267\210\167\146\336\334\105\061\354\106\032\172"
|
||||
"\102\154\122\157\302\212\023\075\053\370\217\064\156\253\103\113"
|
||||
"\002\367\124\075\032\213\351\145\265\155"
|
||||
#define chk1_z 22
|
||||
#define chk1 ((&data[112]))
|
||||
"\144\112\000\347\101\050\266\262\246\042\352\107\007\261\312\166"
|
||||
"\213\070\312\056\361\205\270\121\037\032\243\216"
|
||||
#define tst2_z 19
|
||||
#define tst2 ((&data[140]))
|
||||
"\354\136\321\236\224\340\222\141\061\041\216\000\103\164\377\207"
|
||||
"\010\031\123\111\147\144\307"
|
||||
#define shll_z 8
|
||||
#define shll ((&data[163]))
|
||||
"\377\344\012\332\034\152\240\354\112\154"
|
||||
#define opts_z 1
|
||||
#define opts ((&data[171]))
|
||||
"\367"
|
||||
#define xecc_z 15
|
||||
#define xecc ((&data[175]))
|
||||
"\065\050\062\273\057\367\363\125\374\322\373\224\343\275\230\112"
|
||||
"\001\044\304\047"
|
||||
#define chk2_z 19
|
||||
#define chk2 ((&data[192]))
|
||||
"\257\000\077\207\001\217\251\035\351\267\312\100\063\265\026\076"
|
||||
"\000\205\373\165\114\067\160"
|
||||
#define inlo_z 3
|
||||
#define inlo ((&data[215]))
|
||||
"\321\141\005"
|
||||
#define text_z 903
|
||||
#define text ((&data[359]))
|
||||
"\260\163\253\150\344\124\111\145\057\122\016\331\256\167\011\243"
|
||||
"\176\156\307\070\161\341\355\010\066\141\132\024\165\327\362\375"
|
||||
"\224\272\114\050\000\051\204\361\312\362\127\234\323\066\230\224"
|
||||
"\353\005\037\103\021\365\144\200\111\023\152\121\241\140\126\363"
|
||||
"\316\300\176\213\026\361\345\277\004\352\106\222\324\256\074\006"
|
||||
"\225\147\036\362\106\267\037\016\343\355\256\126\160\002\223\372"
|
||||
"\223\236\065\140\127\105\264\273\071\363\061\052\167\313\145\260"
|
||||
"\343\163\174\117\331\351\156\160\360\173\036\232\041\170\032\325"
|
||||
"\017\145\336\052\166\177\115\300\332\060\165\360\376\352\270\343"
|
||||
"\272\021\343\233\211\355\343\167\266\171\041\171\264\103\277\212"
|
||||
"\261\066\314\335\102\170\232\236\332\332\374\305\356\057\377\002"
|
||||
"\262\134\336\010\371\000\132\371\254\211\215\204\043\273\311\224"
|
||||
"\067\315\277\157\252\341\375\361\071\004\255\172\073\355\072\115"
|
||||
"\304\233\144\012\027\225\147\145\217\005\141\104\166\234\241\345"
|
||||
"\311\317\274\017\162\202\310\224\034\212\144\226\140\005\007\202"
|
||||
"\131\265\170\305\337\242\214\367\072\104\105\243\026\273\330\056"
|
||||
"\236\200\364\002\001\163\112\336\106\173\306\353\303\330\374\357"
|
||||
"\231\265\025\074\154\210\346\066\272\024\046\256\327\017\137\316"
|
||||
"\307\241\020\057\051\121\037\222\341\270\036\113\325\350\011\011"
|
||||
"\023\123\234\173\137\117\143\075\141\357\021\125\334\315\371\007"
|
||||
"\206\037\234\174\312\167\157\104\233\366\045\277\357\023\141\077"
|
||||
"\244\076\032\122\307\123\131\300\052\237\266\221\231\205\336\171"
|
||||
"\365\162\015\374\161\254\162\337\201\073\215\026\136\243\074\252"
|
||||
"\155\134\035\270\314\006\074\135\132\372\024\236\063\010\174\066"
|
||||
"\175\122\360\015\032\310\206\136\321\260\226\132\102\304\302\073"
|
||||
"\256\221\240\002\165\127\070\023\247\012\335\162\203\152\230\015"
|
||||
"\347\165\171\232\260\172\033\070\233\044\276\030\034\374\222\342"
|
||||
"\012\247\261\130\111\213\265\000\055\063\161\313\130\003\350\360"
|
||||
"\065\163\127\143\235\042\032\044\261\334\116\016\115\124\120\357"
|
||||
"\064\201\073\040\266\123\014\116\366\366\242\310\234\004\332\066"
|
||||
"\142\041\003\131\207\336\275\025\360\055\305\154\066\132\253\275"
|
||||
"\300\064\360\363\360\342\373\263\375\105\256\172\175\067\217\252"
|
||||
"\110\254\173\207\210\324\025\043\225\155\301\053\140\014\017\041"
|
||||
"\010\223\124\316\023\277\016\153\307\314\223\313\206\173\050\042"
|
||||
"\213\230\366\166\047\345\302\156\142\132\260\342\203\371\063\023"
|
||||
"\044\170\233\313\363\003\135\325\062\241\300\365\361\343\067\141"
|
||||
"\342\075\154\234\330\015\033\105\061\345\332\012\050\341\351\151"
|
||||
"\375\134\252\262\251\252\205\173\242\203\166\141\160\270\322\221"
|
||||
"\154\270\176\230\374\101\237\115\223\037\302\073\206\137\316\241"
|
||||
"\051\214\206\237\220\202\114\252\060\256\032\340\040\123\376\256"
|
||||
"\243\354\120\132\374\164\017\262\366\342\274\240\175\340\355\343"
|
||||
"\030\260\065\131\161\132\010\062\002\322\115\035\271\204\004\301"
|
||||
"\260\073\362\176\372\140\245\146\100\157\020\101\005\277\254\227"
|
||||
"\241\215\220\144\102\262\226\252\027\337\166\073\146\255\051\217"
|
||||
"\265\011\012\204\054\102\005\057\021\155\133\215\306\125\265\227"
|
||||
"\323\032\270\020\162\160\330\363\146\254\171\244\340\302\246\375"
|
||||
"\024\354\373\336\067\204\016\001\360\003\042\033\153\372\007\052"
|
||||
"\252\163\272\363\331\215\354\303\131\210\077\327\144\245\302\030"
|
||||
"\166\003\240\254\251\343\233\003\177\211\306\311\056\344\144\016"
|
||||
"\356\123\375\172\006\000\252\121\272\100\145\145\331\313\023\222"
|
||||
"\040\205\216\035\051\004\057\145\142\332\370\311\376\235\114\124"
|
||||
"\161\363\211\074\345\127\324\032\377\141\107\322\332\346\075\360"
|
||||
"\161\102\345\077\212\225\265\305\117\344\233\023\360\345\026\066"
|
||||
"\054\000\301\207\067\131\214\072\077\277\202\045\321\031\112\372"
|
||||
"\012\041\112\225\347\112\306\043\061\022\057\305\231\171\347\110"
|
||||
"\051\376\355\353\340\134\255\375\354\015\145\275\004\127\370\146"
|
||||
"\202\141\066\276\316\010\140\123\234\344\107\056\122\326\274\106"
|
||||
"\262\153\341\105\277\336\342\311\246\231\307\243\263\325\374\235"
|
||||
"\162\157\152\346\371\220\273\272\225\145\365\217\044\342\374\204"
|
||||
"\314\300\157\247\360\063\323\376\227\370\272\105\271\260\362\275"
|
||||
"\060\073\105\175\055\243\275\112\055\055\001\027\155\216\011\366"
|
||||
"\326\226\353\014\321\162\225\313\021\202\154\130\116\047\071\343"
|
||||
"\016\007\137\103\244\315\146\056\065\027\201\333\143\174\006\174"
|
||||
"\352\017\174\266\062\276\176\231\220\105\171\155\137\156\134\015"
|
||||
"\077\352\165\253\372\211\333\314\072\070\035\222\070\272\347\140"
|
||||
"\007\333\002\022\042\073\253\064\221\270\255\110\101\140\303\205"
|
||||
"\005\276\051\351\372\334\277\220\316\272\210\351\130\352\350\110"
|
||||
"\377\060\325\154\341\042\011\100\221\057\234\344\207\222\056\016"
|
||||
"\113\146\333\113\224\262\221\034\343\160\013\116\163\173\024\360"
|
||||
"\177\307\050\116\046\230\024\367\340\221\001\103\036\236\201\154"
|
||||
"\231\242\370\177\133\207\240\302\043\351\053\060\230\376\017\360"
|
||||
"\330\030\311\347\123\136\261\243\240\344\123\026\016\366\123\045"
|
||||
"\147\243\032\220\015\114\225\103\344\362\357\076\150\337\265\346"
|
||||
"\172\016\034\257\360\222\022\140\365\332\162\016\317\230\074\260"
|
||||
"\371\064\227\224\124\027\004\343\012\252\347\003\170\016\001\260"
|
||||
"\032\363\000\336\162\051\131\370\150\104\074\013\073\110\111\341"
|
||||
"\260\071\177\044\041\027\314\312\221\315\325\154\172\201\175\203"
|
||||
"\067\143\105\151\005\121\126\107\031\262\065\126\103\356\227\302"
|
||||
"\141\366\246\267"
|
||||
#define lsto_z 1
|
||||
#define lsto ((&data[1470]))
|
||||
"\171"
|
||||
#define pswd_z 256
|
||||
#define pswd ((&data[1516]))
|
||||
"\217\117\231\075\362\367\141\076\056\125\215\177\102\163\326\351"
|
||||
"\142\250\147\342\347\132\322\257\104\166\020\337\027\330\317\165"
|
||||
"\016\330\230\176\023\236\321\312\253\261\106\205\133\064\224\370"
|
||||
"\277\154\050\130\167\137\031\154\231\336\220\174\317\046\061\046"
|
||||
"\014\213\375\150\143\145\242\124\053\041\242\037\006\314\050\321"
|
||||
"\205\327\016\234\212\270\326\231\277\211\164\355\236\211\375\101"
|
||||
"\255\026\046\375\115\164\325\334\071\112\307\045\313\043\073\012"
|
||||
"\363\171\141\335\217\244\343\307\352\326\310\374\310\275\232\315"
|
||||
"\006\200\325\125\224\345\327\223\111\065\211\236\335\164\045\244"
|
||||
"\024\264\121\345\240\352\177\303\377\357\333\135\175\110\110\055"
|
||||
"\025\154\227\070\051\015\226\343\150\163\327\151\143\266\136\264"
|
||||
"\164\045\113\251\152\313\142\306\224\231\377\002\175\305\354\326"
|
||||
"\352\176\337\315\033\255\347\075\215\007\237\166\215\243\236\027"
|
||||
"\346\325\346\003\244\070\213\337\000\373\360\226\272\141\054\240"
|
||||
"\227\310\272\073\302\170\141\166\004\040\157\357\144\315\151\332"
|
||||
"\361\362\324\363\231\035\025\360\031\160\165\040\121\240\260\372"
|
||||
"\242\053\325\123\043\061\134\214\153\311\346\270\016\370\162\133"
|
||||
"\300\312\370\072\046\060\235\150\027\132\160\070\244\222\024\014"
|
||||
"\073\301\307\263\160\275\362\113\276\377\107\274\366\326\237\127"
|
||||
"\114\051\330\303\326\221\104\231\153\304\247\144\317\132\152\102"
|
||||
"\365\360\246\042\101\003\101\130\305\013\020\365\060"/* 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 */
|
||||
|
||||
/* rtc.c */
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* '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 : "<null>");
|
||||
fprintf(stderr, "argc=%d\n", argc);
|
||||
if (!argv) {
|
||||
fprintf(stderr, "argv=<null>\n");
|
||||
} else {
|
||||
for (i = 0; i <= argc ; i++)
|
||||
fprintf(stderr, "argv[%d]=%.60s\n", i, argv[i] ? argv[i] : "<null>");
|
||||
}
|
||||
}
|
||||
#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 : "<null>");
|
||||
#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 <sys/ptrace.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#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];
|
||||
|
||||
stte_0();
|
||||
key(pswd, pswd_z);
|
||||
arc4(msg1, msg1_z);
|
||||
arc4(date, date_z);
|
||||
if (date[0] && (atoll(date)<time(NULL)))
|
||||
return msg1;
|
||||
arc4(shll, shll_z);
|
||||
arc4(inlo, inlo_z);
|
||||
arc4(xecc, xecc_z);
|
||||
arc4(lsto, lsto_z);
|
||||
arc4(tst1, tst1_z);
|
||||
key(tst1, tst1_z);
|
||||
arc4(chk1, chk1_z);
|
||||
if ((chk1_z != tst1_z) || memcmp(tst1, chk1, tst1_z))
|
||||
return tst1;
|
||||
ret = chkenv(argc);
|
||||
arc4(msg2, msg2_z);
|
||||
if (ret < 0)
|
||||
return msg2;
|
||||
varg = (char **)calloc(argc + 10, sizeof(char *));
|
||||
if (!varg)
|
||||
return 0;
|
||||
if (ret) {
|
||||
arc4(rlax, rlax_z);
|
||||
if (!rlax[0] && key_with_file(shll))
|
||||
return shll;
|
||||
arc4(opts, opts_z);
|
||||
arc4(text, text_z);
|
||||
arc4(tst2, tst2_z);
|
||||
key(tst2, tst2_z);
|
||||
arc4(chk2, chk2_z);
|
||||
if ((chk2_z != tst2_z) || memcmp(tst2, chk2, tst2_z))
|
||||
return tst2;
|
||||
/* Prepend hide_z spaces to script text to hide it. */
|
||||
scrpt = malloc(hide_z + text_z);
|
||||
if (!scrpt)
|
||||
return 0;
|
||||
memset(scrpt, (int) ' ', hide_z);
|
||||
memcpy(&scrpt[hide_z], text, text_z);
|
||||
} else { /* Reexecute */
|
||||
if (*xecc) {
|
||||
scrpt = malloc(512);
|
||||
if (!scrpt)
|
||||
return 0;
|
||||
sprintf(scrpt, xecc, me);
|
||||
} else {
|
||||
scrpt = me;
|
||||
}
|
||||
}
|
||||
j = 0;
|
||||
varg[j++] = argv[0]; /* My own name at execution */
|
||||
if (ret && *opts)
|
||||
varg[j++] = opts; /* Options on 1st line of code */
|
||||
if (*inlo)
|
||||
varg[j++] = inlo; /* Option introducing inline code */
|
||||
varg[j++] = scrpt; /* The script itself */
|
||||
if (*lsto)
|
||||
varg[j++] = lsto; /* Option meaning last option */
|
||||
i = (ret > 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] : "<null>"
|
||||
);
|
||||
return 1;
|
||||
}
|
Loading…
Reference in New Issue
Block a user