PB Decompiler

Just starting out? Need help? Post your questions and find answers here.
Kaisen2100
Enthusiast
Enthusiast
Posts: 121
Joined: Fri May 28, 2004 4:16 pm
Location: Madeira Island, Portugal
Contact:

PB Decompiler

Post by Kaisen2100 »

Does exists any PureBasic Decompiler??

Its easy to decompile a program made with PureBasic? ... i just want to know hard (or easy) is to decompile PB programs (Windows, Linux, Mac, Amiga)

And if it is posible to decompile, how can i do to avoid (or to make it a very hard work) anyone to decompile my program?

Thanks
PureBasic File Relocator [NEW VERSION 1.1] ==> http://pbfilerelocator.atspace.com/
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1285
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post by Paul »

Use a disassembler to veiw the compiled EXE as ASM source.
Every program can be viewed as ASM code regardless of what it is.
Fred
Administrator
Administrator
Posts: 18353
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

you could try to look for PB pattern while decompiling, but it will be really hard to read IMHO (unless you know perfectly assembly).
Kaisen2100
Enthusiast
Enthusiast
Posts: 121
Joined: Fri May 28, 2004 4:16 pm
Location: Madeira Island, Portugal
Contact:

Post by Kaisen2100 »

hehehe ... ok i understand ... its impossible to stop anyone decompliling your programming :( ... but you can make it harder to him :P ... but how??? :(
PureBasic File Relocator [NEW VERSION 1.1] ==> http://pbfilerelocator.atspace.com/
Kaisen2100
Enthusiast
Enthusiast
Posts: 121
Joined: Fri May 28, 2004 4:16 pm
Location: Madeira Island, Portugal
Contact:

Post by Kaisen2100 »

Fred wrote:you could try to look for PB pattern while decompiling, but it will be really hard to read IMHO (unless you know perfectly assembly).
i do not understand this :( ... "PB pattern"? ... what you mean with that? ... my english is bad :( sorry
PureBasic File Relocator [NEW VERSION 1.1] ==> http://pbfilerelocator.atspace.com/
zapman*
Enthusiast
Enthusiast
Posts: 115
Joined: Wed Jun 02, 2004 10:17 pm
Location: New Caledonia (South Pacific)
Contact:

Post by zapman* »

"Patern" is the name that can be given to any sequence of ASM instructions corresponding to one PB instruction.
Because compilation is an automatic process doing anything in the same way when it has to do it, you can find statistical correspondences when you compare an original PB code and its compiled version.
If you have three loops using "for-next" in your PB code, you'll have three similar paterns of ASM instructions in the compiled code.

To come back to your original question, stand on the idea that it is so hard to decompile an ASM compiled program that you can (at this moment) consider this operation as practically "impossible".
It is "theorically" possible (I made an interresting beginning of Microsoft QuickBasic decompiler some years ago) but I promise you that it is a HUGE work probably much harder than creating a complete new compiler.

As far as I know, there is not any efficient decompiler of any high language (Basic, C, C++,...) available on the market. The one that will do it is a King Master :shock: and it would be very more interresting to decompile C++ than PureBasic.

So, I YOUR program is not one of the best softwares of the last 20 years or a master piece of the national security system of your country, they are very few chances that anyone spends enough time to decompile it.
Keep quiet :wink:

Note : because your are not english native, you perhaps thinck that the "IMHO" abbreviation used by Fred was a very complexe programming notion or the name of a secret part of the API... It only means "In My Humble Opinion". Yes, Fred is Humble even if he is probably one of the very few people that would be able to make a decompiler :) .
Last edited by zapman* on Tue May 31, 2005 7:02 am, edited 3 times in total.
Don't try - DO it !
Bonne_den_kule
Addict
Addict
Posts: 841
Joined: Mon Jun 07, 2004 7:10 pm

Post by Bonne_den_kule »

The only good decompiler is the java decompiler.
zapman*
Enthusiast
Enthusiast
Posts: 115
Joined: Wed Jun 02, 2004 10:17 pm
Location: New Caledonia (South Pacific)
Contact:

Post by zapman* »

You can find some Java and Flash decompilers but I don't believe that these languages are "really" compiled (not in ASM).
Don't try - DO it !
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: PB Decompiler

Post by PB »

> Does exists any PureBasic Decompiler?

If you mean like a Visual Basic decompiler, which takes the final exe and then
turns it back into VB source code, then no, nothing like this exists for PureBasic.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

the big problem is that you dont decompile code to crack it. simply no need for that. so you got to have something that maybe encrypts your registration code block [live. Self modifying code, yeah it is possible in pb], some checks to see if the registration block has been modified, and a lot of other checks and stuff. more checks the better!
Tommeh
Enthusiast
Enthusiast
Posts: 149
Joined: Sun Aug 29, 2004 2:25 pm
Location: United Kingdom

Post by Tommeh »

There are all kinds of decompilers, ASM, Java, Flash, VB4 etc

But PureBASIC code is decompilerable, but only to a certen extent.

Here is what you do:

Make a very simple program in PB, something like message requester 'hello world' :) and make PB make the ASM file of it, in that ASM you can see clearly what is going on, all you have to do is extract stuff like that from the final exe by yes, looking for the patterns :)
Kaisen2100
Enthusiast
Enthusiast
Posts: 121
Joined: Fri May 28, 2004 4:16 pm
Location: Madeira Island, Portugal
Contact:

Post by Kaisen2100 »

Thanks people for your help ... but now i have another question :P

thefool wrote:the big problem is that you dont decompile code to crack it. simply no need for that. so you got to have something that maybe encrypts your registration code block [live. Self modifying code, yeah it is possible in pb], some checks to see if the registration block has been modified, and a lot of other checks and stuff. more checks the better!
How can i do "Self modifying code" ?? ... i was read a few times about it ... but i dont know can i do it in my program? ... exist any example of that? ...

By the way ... Decompile a Java program is easy ... i think ... because it is no compiled to ASM (it is compiled to byte code for the Java Virtual Machine)
PureBasic File Relocator [NEW VERSION 1.1] ==> http://pbfilerelocator.atspace.com/
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

viewtopic.php?t=3650&highlight=selfmodi ... odeexample

however you need to remove the encryption that is done at runtime, and then encrypt it directly in the file. Then at runtime it decrypts
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

Without trying to be a know-it-all I'd like to share my 2ct. as well...

Nothing will ever stop anyone from reversing your code, the only
aim of protection methods is to make it harder.

A decompiler decompiles bytecode (VB, Java, Jamagic ;), C#, etc.)
whereas for 'real' applications a disassembler is needed.

Common methods to protect your code from reversing are self-modifying
code, compression and cpu-emulation. Of course all of these methods can
be bypassed as well without even knowing what exactly is going on as the
exe still gets executed at some time, so the wanted code can be obtained
from memory. That's why all 'better' protection-schemes include a check
for commonly used debuggers and disassemblers.

Out of curiosity, do you worry about your app being cracked (bypass
protection) or about secret algorithms being stolen?
Good programmers don't comment their code. It was hard to write, should be hard to read.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

traumatic wrote: Nothing will ever stop anyone from reversing your code, the only
aim of protection methods is to make it harder.
A decompiler decompiles bytecode (VB, Java, Jamagic ;), C#, etc.)
whereas for 'real' applications a disassembler is needed.
true, again :)
Common methods to protect your code from reversing are self-modifying
code, compression and cpu-emulation. Of course all of these methods can
be bypassed as well without even knowing what exactly is going on as the
exe still gets executed at some time, so the wanted code can be obtained
from memory. That's why all 'better' protection-schemes include a check
for commonly used debuggers and disassemblers.
checks, checks, checks and checks!
if you can find something about how to disturb an disassembler from finding out wich api calls you made. A way would be api hooking!

check if the registration routines has been altered, and do more checks! so if 1 check is altered, all the other is too. problem is, when a keygen is done then you cant check for it. also if people give out stolen serials. so have somekind of blacklist so if more people uses that number or you see it on asta****.box.** , or any other places, put it on the blacklist. Alter the position of checks and even how the checks are performed, alter encryption algorithms too for each release you make.
Post Reply