Since you probably would like to have both positive and negative feedback, for me personally I have no need for it!
It is however, an intriguing project, but my only interest in it would be one of curiosity of wanting to look "under the hood".
Since you probably would like to have both positive and negative feedback, for me personally I have no need for it!
It is however, an intriguing project, but my only interest in it would be one of curiosity of wanting to look "under the hood".
Of course. It makes only sense for those who are obliged to provide source codes from time to time and who do not want to provide all parts of their work. By the way, could make sense to feed the MetaQuotes support, when they ask for source codes.
Regarding "under the hood" ... you mean, how the processing is done or how to decrypt? I think, decryption is almost impossible, at least it would take that long that its getting kinda senseless, also because the function names change with every further output/update.
If your interest is about the process, actually its not that complicated.
1. Of course you have to have a preprocessor which is capable of handling all the statements for conditional compiling, including/finding all the source files and build a kind of a basic code, without any #ifdef- or #include-stuff.
2. Based on that, a parser tracks down the code and looks for definitions, such as classes, functions, variables, enums etc. It does not need to know any predefined commands of the MQL language, as long as every integrated function uses the "::" operator as a prefix. It just must be able to "understand" how the syntax of such definitions works. This parser creates a list of all such expressions/definitions.
3. Due to some switches which can disable encryption partially, some expressions need to be filtered out. These expressions are collected in another list
4. All the filtered expressions are removed from the encryption list
5. The parser parsed the code again and replaces those expression which remain in the encryption list
Done. The whole procedure takes less than 10 seconds for >100.000 lines of code and <>8.000 expressions.
I´ve been reading some documentation upfront about parsers and processes of obfuscation. My method is held kind of easy and is not perfect, but its at least an very much acceptable solution for my purposes. I would not have it done if I´d were able to find any existing software for that purpose - but there is no such.
Yes, I meant how it all works! What original parser and/or preprocessor did you base it on?
Yes, I meant how it all works! What original parser and/or preprocessor did you base it on?
I developed my own parser, took just a few hours and is less than 200 lines of code. It just need to distinguish between operators, expressions and different types of constants. The preprocessor is also my own code, but I had this already because of an "intelligent" search & replace tool I created some earlier for MQL.
![](https://c.mql5.com/3/356/5836145231429__1.png)
I created an obfuscator for MQL (encryption of source code) for my own purposes and would like to know, if there is any kind of a general/common interest.
The obfuscator works so far without problems, but surely has some restrictions which would become visible with other code than mine. I could obfuscate object oriented code with <>120.000 lines, lots of #ifdef / #else / #endif statements which are processed by the integrated preprocessor, round about 8.000 different expressions whereby almost all were obfuscated. The software also supports some obfuscation commands within the code, which allow for different obfuscation levels, different outputs depending of who shall receive and see the final code. This allows for keeping some functions, enums, classes etc. in clear text, while the rest is encrypted.
Before I spend any further energy or even think about transforming it into a commercial product or whatever, I would like to figure out if there is some interest for such a product or not.
Here is a sample with a conditionally obfuscated code.
1. Main file contains the switches and includes the topmost-file
2. Part of the original code:
3. The output, consisting of mixed code, encrypted and clear
Hi Doerk,
Thank you for this interesting post. I believe this is of great benefit for the community. Is there any possibility to share your obfuscator? even if not in a final form, it would make a great seed project for others to collaborate and improve.
Interesting project - certainly more complex that things I work on...
But I thought such a tool already exists [link redacted by moderator]
Am I mistaken?
Discussions, recommendations or suggestions for 3rd party products and services is not allowed on the forum.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I created an obfuscator for MQL (encryption of source code) for my own purposes and would like to know, if there is any kind of a general/common interest.
The obfuscator works so far without problems, but surely has some restrictions which would become visible with other code than mine. I could obfuscate object oriented code with <>120.000 lines, lots of #ifdef / #else / #endif statements which are processed by the integrated preprocessor, round about 8.000 different expressions whereby almost all were obfuscated. The software also supports some obfuscation commands within the code, which allow for different obfuscation levels, different outputs depending of who shall receive and see the final code. This allows for keeping some functions, enums, classes etc. in clear text, while the rest is encrypted.
Before I spend any further energy or even think about transforming it into a commercial product or whatever, I would like to figure out if there is some interest for such a product or not.
Here is a sample with a conditionally obfuscated code.
1. Main file contains the switches and includes the topmost-file
2. Part of the original code:
3. The output, consisting of mixed code, encrypted and clear