How do interpreters do it?

I've seen bots for games that encrypt files then decrypt them at runtime and run what's in them..

Well How? How can I do this in C++? I plan to do this in another language but I decided to ask in C++ section because this is my strongest language and I'd understand anything posted better..


int funct()
	fsdh9hsdg				//Encrypted code.. Decrypted to: SetMousePos(X, Y);
	gdsgdsghshs				//encrypted code.. aka.. If else statement..

int Foo()
	//Run the decrypted function.. aka funct; so the mouse should move to X, Y?

How could decrypting fsdh9hsdg to SetMousePos(X, Y) at runtime help? You don't do anything with the C++ code at runtime. It's too late by then. fsdh9hsdg obviously isn't going to compile. I could see having hard-coded encrypted values in variable assignment code which were decrypted at runtime. I can definitely see having a C++ program running, then reading an encrypted file, decrypting it, then doing something based on the data. I could see having encrypted C++ code which was decrypted during the runtime of ANOTHER C++ program, then compiled and run by that other program. You're looking at a long pause while it's being compiled that you won't get with an interpreted language.

I imagine these bots you are talking about take encrypted shell scripts or Perl or whatever.

But I can't see any circumstances where you'd have anything close to what you're posting.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.