Actually fix 2001/anonymous to run target program
I can now report happily that the program works as it was thought to - both modify the binary and run it. A problem was that it used to call main() infinitely (seemingly) call main() recursively but this was causing a problem. It had to be (as I did some while back) moved to a new function which is not recursive. My guess is that in the past it was okay due to exit() but I don't know if this is true or not. So what could be done? We have to make sure we have BOTH the file descriptor AND the mmap()d memory close()d and munmap()d as otherwise we would get a text file busy error. Then we simply call execv() again. I didn't change it so that the earlier call to execv() is no longer called because I didn't want to break anything even though at that point M is actually empty. The astute programmer would observe that the execv() call is slightly different: don't use M as the path but rather k[1]. Why? Because initially M is empty but after the function is called it ends up being something like '.anonymous.ten134517173' but this file never exists. If you observe even no file is created (or so it seems) as only cpp is used, not cc (I'm not actually clear what the purpose of that is). The mmap() call is important of course as is the open() call as one of the parameters of mmap(). Is this a workaround? Perhaps in a way but it's the only way it'll work that I can think of as munmap() and close() must be called lest we get a text file busy error and only then can we call execv(). Removed cpp.c and cpp make rule.
This commit is contained in:
1 parent
316e83b905
commit
2159caec46
9 files changed
+34
-455
No files matched your search
@@ -1,7 +1,7 @@
|
||||
anonymous
|
||||
anonymous.ten
|
||||
anonymous.ten.32
|
||||
ten.bak.od
|
||||
ten.bak.txt
|
||||
ten.od
|
||||
ten.txt
|
||||
anonymous_tmp
|
||||
@@ -140,7 +140,6 @@ ${PROG}: ${PROG}.c
|
||||
warning='-Dprocessor'; \
|
||||
$$magic $$warning -Dmagic= $$X "-DX=A($$magic \"$$X\")" \
|
||||
$< -o $@ ${LIBS}
|
||||
${CHMOD} -v +x anonymous.sh
|
||||
|
||||
|
||||
${PROG}.ten: ${PROG}.ten.c
|
||||
@@ -157,14 +156,6 @@ ${PROG}.ten: ${PROG}.ten.c
|
||||
@echo
|
||||
${CC} ${CFLAGS} -m32 $< -o $@ ${LIBS}
|
||||
|
||||
cpp: cpp.c
|
||||
magic='${CC} ${CFLAGS}'; \
|
||||
X='-DA(X)=#X'; \
|
||||
warning='-Dprocessor'; \
|
||||
$$magic $$warning -Dmagic= $$X "-DX=A($$magic \"$$X\")" \
|
||||
$< -o $@ ${LIBS}
|
||||
${CHMOD} -v +x anonymous.sh
|
||||
|
||||
|
||||
# alternative executable
|
||||
#
|
||||
|
||||
@@ -16,8 +16,9 @@ make
|
||||
```
|
||||
|
||||
[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed both the
|
||||
supplementary program and the program itself (but for the program itself see
|
||||
[bugs.md](/bugs.md), both of which segfaulted. He managed to do this with linux
|
||||
supplementary program and the program itself (both of which segfaulted and once
|
||||
that was fixed only the binary was modified; it was not run but according to the
|
||||
author's remarks it should be executed). He managed to do this with linux
|
||||
but it will not work with macOS (see [bugs.md](/bugs.md) for why this is); this
|
||||
is not a bug but a feature inherent in what it does.
|
||||
|
||||
@@ -38,6 +39,12 @@ Change `3` in the call to `mmap()` to be `PROT_READ|PROT_WRITE`: just in case
|
||||
`PROT_READ|PROT_WRITE` does not equal 3 (though it seems to be equal in both
|
||||
macOS and linux).
|
||||
|
||||
There was one other thing that had to be done though. Since the program used to
|
||||
recursively call (infinite recursion, seemingly) `main()` and since that cannot
|
||||
be done what had to be done is first call `munmap()` and `close()` (else one
|
||||
would get text file busy error) and then run `execv()` again like the function
|
||||
`pain()` (was in `main()`) did but with a slight change.
|
||||
|
||||
NOTE: there might be educational value to see the progress of this fix; if you
|
||||
wish to see, try:
|
||||
|
||||
@@ -48,13 +55,18 @@ git diff c48629017117379a52b1a512ef8f2593ca9569c8..efdee208a2bc650256637b9357ddf
|
||||
git diff efdee208a2bc650256637b9357ddfd0de82d2f41..e9a3f77ea3b209e63ac3f9c06bb84ad86e5ea706 anonymous.c
|
||||
```
|
||||
|
||||
There's an another important point in [bugs.md](/bugs.md) about this entry,
|
||||
however, in that we're not sure if the entry was supposed to run the program or
|
||||
not as there is some inconsistency in the author's comments which we think might
|
||||
have been intentional.
|
||||
|
||||
Thank you Cody for your assistance!
|
||||
|
||||
### INABIAF - it's not a bug it's a feature! :-)
|
||||
|
||||
If you do not specify a 32-bit binary as the arg of this program it will very
|
||||
likely crash or do something terribly wrong like slaughtering all the elves of
|
||||
Imladris! :-) so please don't do that :-(
|
||||
|
||||
If the program cannot be run (for instance under macOS as it's an ELF file) then
|
||||
the program will touch the file but it won't run it; it'll silently fail to
|
||||
execute it.
|
||||
|
||||
### WARNING on note from the author
|
||||
|
||||
The author suggested that this will somewhat destroy the binaries this touches
|
||||
|
||||
@@ -5,10 +5,13 @@
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <sys/mman.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define l int*
|
||||
#define F char
|
||||
struct stat t;
|
||||
off_t N;
|
||||
#define c return
|
||||
#define I (P+=4,*L(P-4,0))
|
||||
#define G (signed F)E(*L(P++,0))
|
||||
@@ -30,6 +33,7 @@ l an(d, sl){ c \
|
||||
r=V(014 )&63,an##i(d,sl); }
|
||||
#define add(Ev,Gv) Ev(){ i=((a-=16)+C(r,4))/4,(\
|
||||
Gv?Ev() :0) ; } Ev##n(){ a=C(r,5),Ev(); }
|
||||
l f;
|
||||
Tr(L,r, C(r,3)&&C(r,3)<=d?(l)(((int)B)+d+C(r,4)-C(r,3)):(((int)B)^d)>>24&&--\
|
||||
r,(l)d) Tr(Run,a,(ss=strcmp((F*)B+C((V(12)>>16),4)+C(--r,0),A(.strtab))?ss:(F\
|
||||
*)B+C(r ,4),C(r,1)-2),0) add(Sca ,V(-~i)-P+2) add(ru,strcmp(ss+V(i),A(main)))
|
||||
@@ -39,9 +43,9 @@ c L(E(k [(l)V(17)]),0); } V(v){ c E(B[v]); }
|
||||
int
|
||||
pain(char *ck, char **k)
|
||||
{
|
||||
return (z?(stat(M,&t)?P+=a+'{'?0:3:execv(M,k),a=(signed char)E(*L(P++,0)),i=P,y=(signed char)E(*L(P++,0))&255,sprintf(Q,y/'@'-3?"*L(V(%d+%d)+%d,0)":"R[%d]",(y&7),'\r',y/0100-1?0:(signed char)E(*L(P++,0))),(a+127&&a+'}'&&a+1?(a+61&&a+24&&a+025?(P=a+'H'&&a%061<=0?P:i,d+=sprintf( d,a>0?" R[%d]=E(~-E(R[%d])),\0 U R[%d],\0 R[%d] O,\0 U %d,\0R[%d]=0,"+(a&'8')*3:a <- 'c'?" %d, %c%s = R[%d], \0 %d, *R=%c%s==R[%d], \0 R[%d]=(int)%c%s,"-a%'w'%'j'*5:"%d,%d,%s=%d,",a>0?a-'h'?a-49?a&7:(y/010&7):(P+=4,*L(P-4,0)):(y/010&7),a>0?a&7:"& "[a%3%2+1],a+72?Q:"*R",a>0|a<-99?(y/010&7):(P+=4,*L(P-4,0)),0 ),(char* ) P):(P=i,i=a+61?a+21?E((P+=4,*L(P-4,0))):(signed char)E(*L(P++,0)):0,d+=sprintf( d,a%' '+29+"P O,\0 U %d,P=%d,",P,P+i,0,0,0 ),(char* ) P,system((sprintf(d,"A'",k[1]),b)),z)):(n=(y/010&7)-4?(y/010&7)%5-1?a+127?(signed char)E(*L(P++,0)):(P+=4,*L(P-4,0)):0:(Scan(),*( (char*)index(ss+V(i ),0100)?(char*)index(ss+V(i ),0100) :d)=0,(int)(ss+V(i))),(y/010&7)%5<2?d+=sprintf( d,(y/010&7)%5?" %s=E(~-E(%s)), \0 U %s,"+4*(y/010&7):"%s=E(E(%s)%c%d),",Q,Q,"+ - "[(y/010&7)],n,0 ),(char* ) P:(a=(signed char)E(*L(P++,0))-'u'?'!':'=',d+=sprintf( d,(y/010&7)-4?"P=%d%c=%s?%d:%d,":"*R=E(((int(*)(l,l,l))%s)(K(1),K(2),K(3))),P O,",n,a,Q,P,P+(signed char)E(*L(P++,0)) ),(char* ) P,system((sprintf(d,"A'",k[1]),b)),z)))):(Run((z=(char*)&ck,stat(k[1],&t),B=(l)mmap(0,i=t.st_size,PROT_READ|PROT_WRITE,1,open(k[1],2),0))),(((B+13)[4]=E(B+i/4),run(),P=V(-~i),(B+13)[4]=E(V(17)-4),*(int*)V(021))),sprintf(M,".%s%d",k[1],P),d+=sprintf( d,"%s %s '-DX=A(%s)' -o %s '-Dmagic=","cpp -std=gnu99 -Wall -Wextra -pedantic -Winfinite-recursion -Wno-bitwise-conditional-parentheses -Wno-error -Wno-implicit-function-declaration -Wno-implicit-int -Wno-int-to-pointer-cast -Wno-macro-redefined -Wno-pedantic -Wno-pointer-to-int-cast -Wno-return-type -Wno-string-plus-int -Wno-bitwise-op-parentheses -Wno-format -Wno-format-extra-args -Wno-int-conversion -Wno-unused-parameter -Wno-unsequenced -E \"-DA(X)=#X\"","anonymous.c","cpp -std=gnu99 -Wall -Wextra -pedantic -Winfinite-recursion -Wno-bitwise-conditional-parentheses -Wno-error -Wno-implicit-function-declaration -Wno-implicit-int -Wno-int-to-pointer-cast -Wno-macro-redefined -Wno-pedantic -Wno-pointer-to-int-cast -Wno-return-type -Wno-string-plus-int -Wno-bitwise-op-parentheses -Wno-format -Wno-format-extra-args -Wno-int-conversion -Wno-unused-parameter -Wno-unsequenced -E \"-DA(X)=#X\"",M,fflush(0) ),(char* ) P));
|
||||
return (z?(stat(M,&t)?P+=a+'{'?0:3:execv(M,k),a=(signed char)E(*L(P++,0)),i=P,y=(signed char)E(*L(P++,0))&255,sprintf(Q,y/'@'-3?"*L(V(%d+%d)+%d,0)":"R[%d]",(y&7),'\r',y/0100-1?0:(signed char)E(*L(P++,0))),(a+127&&a+'}'&&a+1?(a+61&&a+24&&a+025?(P=a+'H'&&a%061<=0?P:i,d+=sprintf( d,a>0?" R[%d]=E(~-E(R[%d])),\0 U R[%d],\0 R[%d] O,\0 U %d,\0R[%d]=0,"+(a&'8')*3:a <- 'c'?" %d, %c%s = R[%d], \0 %d, *R=%c%s==R[%d], \0 R[%d]=(int)%c%s,"-a%'w'%'j'*5:"%d,%d,%s=%d,",a>0?a-'h'?a-49?a&7:(y/010&7):(P+=4,*L(P-4,0)):(y/010&7),a>0?a&7:"& "[a%3%2+1],a+72?Q:"*R",a>0|a<-99?(y/010&7):(P+=4,*L(P-4,0)),0 ),(char* ) P):(P=i,i=a+61?a+21?E((P+=4,*L(P-4,0))):(signed char)E(*L(P++,0)):0,d+=sprintf( d,a%' '+29+"P O,\0 U %d,P=%d,",P,P+i,0,0,0 ),(char* ) P,system((sprintf(d,"A'",k[1]),b)),z)):(n=(y/010&7)-4?(y/010&7)%5-1?a+127?(signed char)E(*L(P++,0)):(P+=4,*L(P-4,0)):0:(Scan(),*( (char*)index(ss+V(i ),0100)?(char*)index(ss+V(i ),0100) :d)=0,(int)(ss+V(i))),(y/010&7)%5<2?d+=sprintf( d,(y/010&7)%5?" %s=E(~-E(%s)), \0 U %s,"+4*(y/010&7):"%s=E(E(%s)%c%d),",Q,Q,"+ - "[(y/010&7)],n,0 ),(char* ) P:(a=(signed char)E(*L(P++,0))-'u'?'!':'=',d+=sprintf( d,(y/010&7)-4?"P=%d%c=%s?%d:%d,":"*R=E(((int(*)(l,l,l))%s)(K(1),K(2),K(3))),P O,",n,a,Q,P,P+(signed char)E(*L(P++,0)) ),(char* ) P,system((sprintf(d,"A'",k[1]),b)),z)))):(Run((z=(char*)&ck,stat(k[1],&t),B=(l)mmap(0,N=i=t.st_size,PROT_READ|PROT_WRITE,1,f=open(k[1],2),0))),(((B+13)[4]=E(B+i/4),run(),P=V(-~i),(B+13)[4]=E(V(17)-4),*(int*)V(021))),sprintf(M,".%s%d",k[1],P),d+=sprintf( d,"%s %s '-DX=A(%s)' -o %s '-Dmagic=","cpp -std=gnu99 -Wall -Wextra -pedantic -Winfinite-recursion -Wno-bitwise-conditional-parentheses -Wno-error -Wno-implicit-function-declaration -Wno-implicit-int -Wno-int-to-pointer-cast -Wno-macro-redefined -Wno-pedantic -Wno-pointer-to-int-cast -Wno-return-type -Wno-string-plus-int -Wno-bitwise-op-parentheses -Wno-format -Wno-format-extra-args -Wno-int-conversion -Wno-unused-parameter -Wno-unsequenced -E \"-DA(X)=#X\"","anonymous.c","cpp -std=gnu99 -Wall -Wextra -pedantic -Winfinite-recursion -Wno-bitwise-conditional-parentheses -Wno-error -Wno-implicit-function-declaration -Wno-implicit-int -Wno-int-to-pointer-cast -Wno-macro-redefined -Wno-pedantic -Wno-pointer-to-int-cast -Wno-return-type -Wno-string-plus-int -Wno-bitwise-op-parentheses -Wno-format -Wno-format-extra-args -Wno-int-conversion -Wno-unused-parameter -Wno-unsequenced -E \"-DA(X)=#X\"",M,fflush(0) ),(char* ) P));
|
||||
}
|
||||
int
|
||||
main (int cka, char **k) { char *ck = (char *)cka;
|
||||
exit(E((ck?pain((char*)cka,k):system((sprintf(M,"rm -f .%s*",k[1]),M)),z,*(B+13))));
|
||||
(E((ck?pain((char*)cka,k):system((sprintf(M,"rm -f .%s*",k[1]),M)),z,*(B+13))));munmap(B,N);close(f);execv(k[1],k);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "$#" -lt 1 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
make >/dev/null 2>&1
|
||||
|
||||
if [[ -f "$1" ]]; then
|
||||
./anonymous "$1"
|
||||
./"$1"
|
||||
fi
|
||||
|
||||
Binary file not shown.
@@ -1,383 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#define l int*
|
||||
#define F char
|
||||
|
||||
struct stat t;
|
||||
#define c return
|
||||
#define I (P+=4,*L(P-4,0))
|
||||
#define G (signed F)E(*L(P++,0))
|
||||
#define C(O,D) E (D[B+V(010)/4+O*10])
|
||||
#define U R[4]=E(V(17)-4),*(l)V(021)=
|
||||
|
||||
char M [99],Q[99],b[15000],*ss,*d=b, *z;
|
||||
|
||||
#define O =(n=*(l)V(021),R[4]=E(V(17)+4),n)
|
||||
#define p(a,b,c) system((sprintf(a,b,k[1]),c)),z
|
||||
#define g (y/010&7)
|
||||
#define R (B+13)
|
||||
#define x86 (F*)index(ss+V(i ),0100)
|
||||
|
||||
#define D(y,n,a,m,i,c) d += \
|
||||
sprintf(d, \
|
||||
y,n,a,m,i,c ), \
|
||||
(F* ) P
|
||||
|
||||
int *B,i,n,a,r,y,P ;
|
||||
V(v){
|
||||
return E(B[v]) /* end E() */;
|
||||
}
|
||||
|
||||
|
||||
int *Li(d,r)
|
||||
{
|
||||
return E (3[B+
|
||||
V(010) /* end V() */
|
||||
/4+r*10]
|
||||
) &&
|
||||
E (3 [B+
|
||||
V(010) /* end V() in E() */
|
||||
/4+r*10]) /* end E() */
|
||||
|
||||
<=d ?
|
||||
(int*)(((int)B) + d +
|
||||
E(4[B+
|
||||
V (010) /* end V() in E() */
|
||||
/4+r*10]) /* end E() */ -
|
||||
E (3[B +
|
||||
V(010) /* end V() in E() */
|
||||
/4+r*10]) /* end E() */
|
||||
) :
|
||||
(((int)B)^d)>>24&&--r?
|
||||
Li(d,r) /* end Li() */:
|
||||
(int*)d;
|
||||
}
|
||||
|
||||
int *L(d, r){
|
||||
return r =
|
||||
V(014 ) /* end V() */&
|
||||
63,
|
||||
Li(d,r) /* end Li() */
|
||||
;
|
||||
}
|
||||
int *Runi(d,a)
|
||||
{
|
||||
return (ss = strcmp((char*)B+
|
||||
E (4[B+
|
||||
V(010)/* end V() *//4+
|
||||
(V(12) /* end V() */
|
||||
>>16)*10])+
|
||||
E(0[B+
|
||||
V(010) /* end V() */
|
||||
/4+--r*10]), /* end E() */
|
||||
".strtab") /* end strcmp() */ ?
|
||||
ss:(char*)B+
|
||||
E (4[B+
|
||||
V(010) /* end V() in E() */
|
||||
/4+r*10]) /* end E() */ ,
|
||||
E (1[B+
|
||||
V(010) /* end V() in E() */
|
||||
/4+r*10]) /* end E() */ -
|
||||
2) ?
|
||||
Runi(d,r) :
|
||||
0;
|
||||
}
|
||||
|
||||
int *Run(d, a)
|
||||
{
|
||||
return r=
|
||||
V(014 ) /* end V() */
|
||||
&63,
|
||||
Runi(d,a);
|
||||
}
|
||||
|
||||
Sca()
|
||||
{
|
||||
i=((a-=16)+
|
||||
E (4[B +
|
||||
V (010) /* end V() in E() */
|
||||
/4+r*10]) /* end E() */
|
||||
|
||||
)/4,
|
||||
(V(-~i) /* end V() */
|
||||
-P+2 ?
|
||||
Sca() :
|
||||
0
|
||||
);
|
||||
|
||||
}
|
||||
Scan()
|
||||
{
|
||||
a=
|
||||
E(5[B+
|
||||
V(010) /* end V() */
|
||||
/4+r*10]) /* end E() */
|
||||
, Sca();
|
||||
}
|
||||
ru()
|
||||
{
|
||||
i=((a-=16)+
|
||||
E(4[B+
|
||||
V(010) /* end V() */ /
|
||||
4+r*10]) /* end E() */
|
||||
)/4,
|
||||
(strcmp(ss +
|
||||
V(i),
|
||||
"main") /* end strcmp() */ ?
|
||||
ru() :
|
||||
0)
|
||||
;
|
||||
}
|
||||
|
||||
run(){
|
||||
a=
|
||||
E(5[B +
|
||||
V(010) /* end V() in E() */
|
||||
/4+r*10]) /* end E() */,
|
||||
ru();
|
||||
}
|
||||
E(DX)
|
||||
{
|
||||
return *z /* z at this point appeared to be '\002' if I (Cody) recalls correctly */ ?
|
||||
DX : DX <<030 |
|
||||
(DX&65280)<<010 |
|
||||
DX>>8 & 65280 |
|
||||
DX>>24&0377;
|
||||
}
|
||||
|
||||
int* K(k)
|
||||
{
|
||||
return L(
|
||||
E(
|
||||
k [
|
||||
(int*)V(17) /* end V() in E() in L() */
|
||||
]) /* end E() in L() */ ,
|
||||
0) /* end L() */;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
pain(char *ck, char **k)
|
||||
{
|
||||
return (z ?
|
||||
(stat(M,&t) ?
|
||||
P+= a+'{' ?
|
||||
0 : 3
|
||||
: execv(M,k), /* note: M appears to be empty here but this used to be recursive main()
|
||||
so M might have been modified on additional calls */
|
||||
a=(signed char) E(*L(P++,0)),
|
||||
i=P,
|
||||
y=(signed char)E(*L(P++,0))
|
||||
&255,
|
||||
sprintf(Q,
|
||||
y/'@'-3?"*L(V(%d+%d)+%d,0)":"R[%d]",
|
||||
(y&7),'\r',
|
||||
y/0100-1 ?
|
||||
0
|
||||
:
|
||||
(signed char)E(*L(P++,0))
|
||||
), /* ends sprintf() on line 175 */
|
||||
(a+127&&a+'}' &&
|
||||
a+1 ?
|
||||
(a+61 &&
|
||||
a+24 &&
|
||||
a + 025 ?
|
||||
(P = a+'H' &&
|
||||
a%061
|
||||
<=0 ?
|
||||
P
|
||||
:
|
||||
i,
|
||||
d+=
|
||||
sprintf(d,
|
||||
a>0?
|
||||
" R[%d]=E(~-E(R[%d])),\0 U R[%d],\0 R[%d] O,\0 U %d,\0R[%d]=0," +
|
||||
(a&'8')
|
||||
*3
|
||||
:a <- 'c'
|
||||
?
|
||||
" %d, %c%s = R[%d], \0 %d, *R=%c%s==R[%d], \0 R[%d]=(int)%c%s," -
|
||||
a%'w'
|
||||
%'j'
|
||||
*5
|
||||
:
|
||||
"%d,%d,%s=%d,",
|
||||
a>0 ?
|
||||
a-'h'
|
||||
?
|
||||
a-49
|
||||
?a&7
|
||||
:
|
||||
(y/010&7)
|
||||
:
|
||||
(P+=4,
|
||||
*L(P-4,0)
|
||||
)
|
||||
:
|
||||
(y/010&7),
|
||||
a>0 ? a&7
|
||||
:
|
||||
"& "[a%3%2+1],
|
||||
a+72 ?
|
||||
Q:"*R",
|
||||
a>0|a<-99?
|
||||
(y/010&7)
|
||||
:
|
||||
(P+=4,
|
||||
*L (P-4,0)
|
||||
),
|
||||
0 ) /* end sprintf on line 195 */
|
||||
,(char* ) P)
|
||||
:
|
||||
(P=i,i=a+61 ?
|
||||
a+21
|
||||
?E((P+=4,*L(P-4,0)))
|
||||
:
|
||||
(signed char)E(*L(P++,0))
|
||||
:0,
|
||||
d+=sprintf( d,
|
||||
a%' '+
|
||||
29+
|
||||
"P O,\0 U %d,P=%d,",
|
||||
P,
|
||||
P+i,
|
||||
0,
|
||||
0,
|
||||
0 ), /* ends sprintf() on 242 */
|
||||
(char* ) P,
|
||||
system(
|
||||
(sprintf(d,"A'",k[1]),
|
||||
b) /* sprintf IN system() on line 252 (above line) */
|
||||
) /* ends system on 252 */
|
||||
,z)):
|
||||
(n=
|
||||
(y/010&7)
|
||||
-4
|
||||
?
|
||||
(y/010&7)
|
||||
%5-1
|
||||
?
|
||||
a+127
|
||||
? (signed char)E(
|
||||
*L(P++,0)
|
||||
)
|
||||
:(P+=4,
|
||||
*L(P-4,0)
|
||||
) :
|
||||
0
|
||||
:
|
||||
(Scan(),
|
||||
*( (char*)index(ss+
|
||||
V(i ), /* V(i ) in index from line 274 */
|
||||
0100)/*ends index() on line 274 */
|
||||
?(char*)index(ss +
|
||||
V(i ), /* V(i) in index() on line 277 */
|
||||
0100)
|
||||
:
|
||||
d)
|
||||
=0,
|
||||
(int)(ss+
|
||||
V(i)
|
||||
)),
|
||||
(y/010&7) %5
|
||||
<2?
|
||||
d+=sprintf( d,
|
||||
(y/010&7)%5
|
||||
?" %s=E(~-E(%s)), \0 U %s,"
|
||||
+4*(y/010&7)
|
||||
:
|
||||
"%s=E(E(%s)%c%d),",
|
||||
Q,
|
||||
Q,
|
||||
"+ - "[(y/010&7)],
|
||||
n,
|
||||
0 ) /* ends sprintf() on line 288 */
|
||||
,(char* ) P
|
||||
:
|
||||
(a=(signed char) E(
|
||||
*L(P++,0) /* *L() in E() from line 301 */
|
||||
) /* ends E() on line * 301 */
|
||||
-'u'
|
||||
?
|
||||
'!'
|
||||
:'=',
|
||||
d+=sprintf(d,
|
||||
(y/010&7)
|
||||
-4
|
||||
?"P=%d%c=%s?%d:%d,"
|
||||
: "*R=E(((int(*)(l,l,l))%s)(K(1),K(2),K(3))),P O,",
|
||||
n,
|
||||
a,
|
||||
Q,
|
||||
P,
|
||||
P+(signed char)E (
|
||||
*L(P++,0) /* *L() in E() in sprintf() from line 308 */
|
||||
)
|
||||
) /* ends sprintf() on line 308 */
|
||||
|
||||
,(char* ) P,
|
||||
system(
|
||||
(sprintf(d,"A'",k[1]), /* ends sprintf() in system() on line 323 */
|
||||
b)) /* ends system() on line 323 but appears that b is what's system()d */
|
||||
,z)
|
||||
)
|
||||
)
|
||||
)
|
||||
:
|
||||
(Run(
|
||||
(z=(char*)&ck,
|
||||
stat(k[1],&t), /* stat() in Run() on line 331 */
|
||||
B =
|
||||
(l)mmap(0,i=t.st_size,PROT_READ|PROT_WRITE,1,
|
||||
open(k[1],2),0) /* open() in mmap() (line 325) in Run() (line 331 */
|
||||
)
|
||||
), /* ends Run() on line 331 */
|
||||
(((B+13)[4]
|
||||
=
|
||||
E(B+i/4),
|
||||
run(),
|
||||
P = V(-~i),
|
||||
(B+13)[4] =
|
||||
E(
|
||||
V(17)- /* V() in E() on line 345 */
|
||||
4),*(int*)V(021))), /* second V() in E() on line 345 */
|
||||
sprintf(M,
|
||||
".%s%d",k[1],P), /* ends sprintf() on line 348 */
|
||||
d+=sprintf( d,
|
||||
"%s %s '-DX=A(%s)' -o %s '-Dmagic=",
|
||||
"cpp -std=gnu99 -Wall -Wextra -pedantic -Winfinite-recursion -Wno-bitwise-conditional-parentheses -Wno-error -Wno-implicit-function-declaration -Wno-implicit-int -Wno-int-to-pointer-cast -Wno-macro-redefined -Wno-pedantic -Wno-pointer-to-int-cast -Wno-return-type -Wno-string-plus-int -Wno-bitwise-op-parentheses -Wno-format -Wno-format-extra-args -Wno-int-conversion -Wno-unused-parameter -Wno-unsequenced -E \"-DA(X)=#X\"", /* end first string in sprintf() %s from line 350 */
|
||||
|
||||
"anonymous.c", /* second string in sprintf() on line 350.
|
||||
note it appears to run the above cpp on anonymous.c ? */
|
||||
"cpp -std=gnu99 -Wall -Wextra -pedantic -Winfinite-recursion -Wno-bitwise-conditional-parentheses -Wno-error -Wno-implicit-function-declaration -Wno-implicit-int -Wno-int-to-pointer-cast -Wno-macro-redefined -Wno-pedantic -Wno-pointer-to-int-cast -Wno-return-type -Wno-string-plus-int -Wno-bitwise-op-parentheses -Wno-format -Wno-format-extra-args -Wno-int-conversion -Wno-unused-parameter -Wno-unsequenced -E \"-DA(X)=#X\"",
|
||||
/* above line is third string in sprintf() on line 350 */
|
||||
M, /* fourth string in sprintf() on 350, possibly running cpp from above line on M */
|
||||
fflush(0) ), /* end sprintf() on line 350 */
|
||||
(char* ) P) /* ends Run() on line 331 */
|
||||
);
|
||||
|
||||
}
|
||||
int
|
||||
main (int cka, char **k)
|
||||
{
|
||||
char *ck = (char *)cka;
|
||||
|
||||
/* main calls exit() which calls E() which has a call to pain() if
|
||||
ck ((char *)cka - was originally a char * as first arg to main()) with
|
||||
second arg being argv or k. Otherwise it calls system() with a convoluted sprintf() */
|
||||
exit (E(
|
||||
(ck?pain((char*)cka,k): /* if ck ((char *)argc which used to be a char *) run pain() which used to be main() */
|
||||
system( /* otherwise if !ck call system() with ... */
|
||||
(sprintf(M,"rm -f .%s*",k[1]),M) /* sprintf() writing to M a convoluted string including itself (which
|
||||
iirc is undefined but perhaps it's my tiredness: I can't think of what
|
||||
the '*' does in sprintf()) */
|
||||
), /* ends system() from line 374 */
|
||||
z,*(B+13))) /* end E() which calls either pain() or system() (which calls sprintf() on M) from line 372 from exit() on line 372 */
|
||||
|
||||
);
|
||||
|
||||
} /* end main() */
|
||||
@@ -4,18 +4,11 @@ make clobber all >/dev/null 2>&1
|
||||
|
||||
|
||||
TARGET="anonymous.ten"
|
||||
|
||||
if [[ ! -f "$TARGET" ]]; then
|
||||
TARGET="anonymous.ten.32"
|
||||
echo "cannot compile anonymous.ten.c as 32-BIT, trying anonymous.ten.32 as backup"
|
||||
echo "if your system cannot run 32-bit ELF binaries this might fail"
|
||||
fi
|
||||
|
||||
if [[ -f "$TARGET" ]]; then
|
||||
echo "$ cp $TARGET anonymous.ten.bak" 1>&2
|
||||
cp "$TARGET" anonymous.ten.bak
|
||||
echo "$ ./anonymous $TARGET" 1>&2
|
||||
./anonymous.sh "$TARGET"
|
||||
./anonymous "$TARGET"
|
||||
echo "$ ./$TARGET" 1>&2
|
||||
./"$TARGET"
|
||||
echo "$ diff -s $TARGET anonymous.ten.bak" 1>&2
|
||||
@@ -33,6 +26,6 @@ if [[ -f "$TARGET" ]]; then
|
||||
echo "$ diff -s ten.txt ten.bak.txt" 1>&2
|
||||
diff -s ten.txt ten.bak.txt
|
||||
else
|
||||
echo "cannot compile anonymous.ten.c as 32-bit and backup file does not exist, sorry."
|
||||
echo "cannot compile anonymous.ten.c as 32-bit, sorry."
|
||||
exit 1
|
||||
fi
|
||||
Reference in new issue
Block a user