Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 months ago.
Improve this question
I need help please about this obfuscated code, what does this do?, What methods or programs should I use to get conclusion?
If you can give me examples of obfuscating methods that were used by the author of the programs code, I would appreciate it.
It is really difficult to know what this code dose but I can say maybe for data security. Any one can help me with this code please.
#include <stdio.h>
#include <math.h>
#define E return
#define S for
char*J="LJFFF%7544x^H^XXHZZXHZ]]2#( ###DA#(.##%(0CAaIqDCI$IDEH%P#T#qL%PEaIpBJCA\
I%KBPBEP%CBPEaIqBAI%CAaIqBqDAI%U#PE%AAaIqBcDAI%ACaIaCqDCI%(aHCcIpBBH%E#aIqBAI%A\
AaIqB%AAaIqBEH%AAPBaIqB%PCDHxL%H#hIcBBI%E#qJBH#C##D%aIBI#D%E#QB2P#E#'C#qJBHqJBH\
%C#qJBH%AAaIqBAI%C#cJ%" "cJ" "CH%C#qJ%aIqB1I%PCDI`I%BAaICH%KH+#'JH+#KP*#%S#\
3P%H#ABhIaBBI%P#S#PC#", *j ,*e;typedef float x;x U(x a){E a<0?0:a>1?1:a; }
typedef struct{x c,a,t; } y;y W={1,1,1},Z={0,0,0},B[99],P,C,M,N,K,p,s,d,h
;y G(x t,x a,x c){K.c=t ; K.t=c; K.a=a;E K;}int T=-1,b=0,r,F=-111,(*m)(i\
nt)=putchar,X=40,z=5,o, a, c,t=0 ,n,R;y A(y a,y b,x c){E G(a.c+b.c*c,a.a
+c*b.a,b.t*c+a.t);}x H= .5,Y =.66 ,I,l=0,q,w,u,i,g;x O(y a,y b){E q=a.t*
b.t+b.c*a.c+a.a*b.a;}x Q(){E A(P,M,T ),O(K,K)<I?C=M,I=q:0;}y V(y a){E A(Z,
a,pow(O(a,a),-H));}x D(y p){S(I=X,P =p,b=T; M=B[++b],p=B[M.c+=8.8-l*.45,
++b],b<=r;Q())M=p.t?q =M_PI*H,w=atan2( P.a-M.a,P.c-M.c) /q,o=p.c-2,a=p.a+1,t=
o+a,w=q*(w>t+H*a?o: w>t?t:w<o-H*a?t :w<o?o:w),A( M,G(cos(w),sin(w),0),
1):A(M,p,U(O(A(P,M,T) ,p)/O(p,p))); M=P;M.a=- .9;o=P.c/8+8;o^=a=P.t
/8+8; M=Q ()?o&1 ?G(Y,0,0):W :G(Y,Y,1);E sqrt (I)-.45;}
int main( int L,char **k){ S(e =L>1?1[z= 0, k]:J ;*e &&l<24 ;
++e)S(o=a =0,j =J+9;(c= *++j)&& !(o&&c< X&&(q=l+=w) );o ?o=*j++/
32,b++[B] =G(q +=*j/8&3,* j&7,0 ),B[r =b++]=G((c/8& 3)*( o<2?
T:1), (c& 7)+ 1e-4,o>2),1: (o =(a =(c-=X)<0?w=c+6 ,t= a+1:c?(t
?0:m(c),a ):*++j)==((*e|32 ) ^z)&&1[j]-X));S(z =3*( L<3);++
F<110;)S(L=-301;p=Z,++L<300;m( p.c),m(p.a),m(p.t))S(c=T;++c<=z;)S(h
=G(-4,4.6,29),d=V(A(A(A(Z,V(G(5,0 ,2)),L+L+c/2),V(G(2,-73,0)),F+F+c%2),G
(30.75,-6,-75),20)),g=R=255-(n=z)*64; R*n+R;g*=H){S(u=i=R=0;!R&&94>(u+=i=D(h=
A(h,d,i)));R=i<.01);S(N=V(A(P,C, T)),q=d.t*d.t,s=M,u=1;++i<6*R;u-=
U(i/3-D(A(h,N,i/3)))/pow( 2,i));s=R?i=pow(U(O(N,V(A(
M=V(G(T,1,2)),d,T)))) ,X),p=A(p,W,g*i),u*=U(
O(N,M))*H*Y+Y,g*= n--?Y-Y*i:1-i,s:G(
q,q,1); p=A(p,s ,g*u);h=A(h,N,.1
);d=A(d,N,-2*O (d,N));}E 0;}
This is an obfuscated, miniature Raytracing program.
It is described on site https://mzucker.github.io/2016/08/03/miniray.html
I found it by taking part of the mystery string "LJFFF%7544x^H^XXHZZXHZ", and googling for it.
If you run the compiled program and capture the output, you get a raytraced picture in .PPM format:
a.out > output.ppm
When I tried to run the program using a Visual Studio / Microsoft toolchain, this is what I got:
When I ran the same program on Linux/GCC, I got this image:
A bit more work, and I got this out of it:
.\a.out abelenky > abelenky.ppm
One of pictures I posted above came via a Visual Studio / Microsoft toolchain, and has obvious corruption in the bottom third of the image, as well as the checkerboard being green (it is supposed to be red).
I ran the same code via GCC on Linux, and the images came out perfectly.
I'm not sure where the difference comes from, but this helps illustrate how obfuscated code like this can highlight differences between Toolchains, Compilers, Operating Systems, etc, and proves why code like this has value.
I'm really disappointed that "user129..." thinks this is of no use in programming. It is one of the most advanced, award winning, obfuscated programs ever written. The techniques used to both develop the program and to obfuscate it are discussed in some detail on the github page and linked resources. It stretches C and graphics algorithms to the limits in some amazing ways.
This should be preserved and studied. Not mocked and closed.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Using Vim as an editor, I wrote the following simple code in C and saved it as helloworld.c :
#include <stdio.h>
int main(void)
{
printf("Hello world!\n");
}
In command prompt, I wrote:
start chrome helloworld.c
This caused my browser to open up the file, but it did not print Hello World. Instead, it just displayed the code I had written. Did I not save it as a C file?
Also, I was wondering how to display the result of my C program inline on command prompt, as I am fairly new to it. While searching the internet, I could not find any answers. Am I supposed to do so from Vim? I learned that you are supposed to do ./ in the gedit command box to display the result inline, but this does not work for the one that comes with Windows.
Please help and thank you for taking the time to read and answer.
As #Ernest Friedman-Hill has already said, you normally have to compile the program. However, there are alternatives.
One alternative is the Tiny C Compiler, from http://bellard.org/tcc/. TCC does allow you to run the program without compiling it.
tcc -run helloworld.c
Does exactly what you want.
The Tiny C Compiler is not the only way to run C code from source without compiling it first. There are a few other alternatives.
CSL: http://csl.sourceforge.net/csl.html
Ch: https://www.softintegration.com/
PicoC: https://code.google.com/p/picoc/
CINT: http://root.cern.ch/drupal/content/cint
I hope this helps.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I am trying to check if file that i want to create is executable.
The check will be by given file path, for example:
c:\good.txt
I want to check if file is executable before I will create it.
I think to use this function:
with the SHGFI_USEFILEATTRIBUTES flag, but I can't use this flag with the SHGFI_EXETYPE flag.
It means that I can't use the SHGFI_EXETYPE flag on a non exiting file.
Is there any another way to check if file is executable before I create the file?
A file that does not exist cannot be ether executable or non-executable. The executability of a file (or otherwise) is stored within its metadata, be that a filename, permission bits, attributes or whatever. A file that does not exist has none of those, and hence you cannot check for its executability.
You'll notice that the SHGetFileInfo function to which you refer is document thus:
Retrieves information about an object in the file system, such as a file, folder, directory, or drive root.
Note the bit about it retrieving information about an object in the file system (not 'an object not in the file system).
A file which doesn't exist is not executable. You're asking a question which doesn't make sense. 'How hot is the water in this empty glass?' - how can something which doesn't exist have a property?
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
This code uses: TArchiveEntry;
So, I really doubt this is not from Zlib Unit? because TArchiveEntry can be used without declaring the Zlib Unit.
var AE : TArchiveEntry;
AE.EntryType := aeFile;
AE.FileNameLen := Length(sr.Name);
AE.FileLength := sr.Size;
OutStream.Write(AE, SizeOf(AE));
OutStream.Write(sr.Name[1], Length(sr.Name));
// Write the file itself
TmpStream := TFileStream.Create(ADir + sr.Name, fmOpenRead or fmShareDenyWrite);
OutStream.CopyFrom(TmpStream, TmpStream.Size);
TmpStream.Free;
This is from Zlib Unit, without doubt.
var compr : TZCompressionStream;
for i := 0 to zFiles.Count-1 do
begin
compr := TZCompressionStream.Create(mStream, zcDefault);
compr.CopyFrom(infile,c);
compr.Free;
end;
I wonder why, what there differences? I can't figure it out, there almost have the same performance.
There is no TArchiveEntry type in the System.ZLib unit (or the System.Zip unit, for that matter). The first code snippet you show is a direct copy/paste of code from an old newsgroup posting that defines its own TArchiveEntry type above the snippet you copied:
Re: How to use ZLib to zip up a folder in Delphi 2005???
This question appears to be:
How do I determine which unit a symbol is defined in?
Once you have compiled the project, hover the cursor over the symbol and the IDE will display a hint which names the unit where the symbol is defined.
Or, use CTRL+click to open the unit that declares the symbol in the editor.