LoginLogin
Might make SBS readonly: thread

SmileBASIC Obfuscator

Root / Submissions / [.]

SimeonCreated:
Download:NKW5E3JD
Version:1.3Size:22.9KB
This application compresses SmileBASIC code, removes comments, newlines, spacing, renames variables, functions, and labels, compresses numbers. It moves strings and numbers into a compact data section, then masks these values to constants that are accessed in array indexing. It provides automatic code editing, line indentation, formatting numbers, string, and spacing properly, or just minify and compact everything. Currently, there are a few options that the user can choose from, but this application is currently undergoing major development to support many more options with a user friendly UI in the future. This current version is stable and provides high quality code automation. The discussion forum can be found at: http://smilebasicsource.com/forum?ftid=1659 Cheers!

Instructions:

Currently, there are eight boolean options that the obfuscator provides:
  • Minify or semi-beautify the code
  • Keep or remove comments
  • Rename labels
  • Rename variables
  • Rename functions
  • Assign variables to non-variable values such as strings and numbers
  • Mask numbers and indexes with constants and hexadecimal representations
  • Search strings for variable names, function names, and labels, which will be renamed as well
By saying "Yes" to every question, the code will become compact and unreadable, yet executable. Future updates will expand the code beautification capabilities and provide a lot more customization than the eight yes/no options that are currently present. The file will be saved as the original name of the program with "OBF_" added to the front. (The obfuscated code can also be found in PRG1) It will then attempt to execute the program.

Enjoy!


If you get an error other than "Out of memory" then you may be trying to obfuscate variables, functions, or labels in a program that uses CHKVAR(), CHKCALL(), or CHKLABEL(). If this is not the case, it would be very nice if you could send the un-obfuscated program to me so that I can find the cause. CHK functions cannot be worked around without completely re-implementing the CHK function code. This uses the same principles of the halting problem, CHK function strings cannot be obfuscated without evaluating the expression, which leads to broader issues...

It might be a good idea not to obfuscate COMMON functions since they'll probably be used in another slot.

Replying to:12Me21
It might be a good idea not to obfuscate COMMON functions since they'll probably be used in another slot.
Well, from my knowledge, then the COMMON functions would completely not work if it uses global variables. I need to do more testing My solution right now is just to combine everything into one file before obfuscation If I find a better solution I will definitely attempt it Maybe automatically combining all the needed files then separate them and save each one

Replying to:12Me21
It might be a good idea not to obfuscate COMMON functions since they'll probably be used in another slot.
Oh, I meant to say specifically the function name.

Interesting. You should probably have a "WHILE BUTTON()!=0:WEND" at the beginning, because pressing A just to start the program causes it to also press A on the first option which is a bit annoying.

Replying to:amihart
Interesting. You should probably have a "WHILE BUTTON()!=0:WEND" at the beginning, because pressing A just to start the program causes it to also press A on the first option which is a bit annoying.
What about using an "on button release" for that? Or is bounce an issue?

Replying to:amihart
Interesting. You should probably have a "WHILE BUTTON()!=0:WEND" at the beginning, because pressing A just to start the program causes it to also press A on the first option which is a bit annoying.
Fixed, thanks!

Why the dislikes?

Replying to:Simeon
Why the dislikes?
the fact an obfuscator exists is a problem in the first place

Replying to:Simeon
Why the dislikes?
How is that a bad thing

Replying to:Simeon
Why the dislikes?
Only Toad would see non-editable and understandable code as a problem since Toad probably wants to view how a program works against an uploader's wishes. I'm guessing it's the quality of the obfuscation that people don't like or we have a Toad army.

Replying to:Simeon
Why the dislikes?
I downvoted this program based on the principles established in the discussion thread. Regardless of its quality, an obfuscator does not deserve widespread use or the same level of prestige as other development tools and libraries. Similarly, I downvoted Amihart's challenge after my solution not because of its quality but in an attempt to discourage mindless clones.

The point of an open-source platform is to allow others to read and eventually understand others' programs.

Replying to:chicken
The point of an open-source platform is to allow others to read and eventually understand others' programs.
commenting on the page increases rank. this debate goes here: https://smilebasicsource.com/forum?ftid=1659

Most of the programs I've made use VAR("THING") and CALL("WHATEVER"), and considering how useful it is, I'd say many of the more complex programs for which your program would be beneficial (like for anti-cheating) would fail. But I get why it's difficult. You COULD do a heuristic to capture the common use cases for VAR and CALL, and if a program STILL doesn't work well then they're doing something crazy. For instance, you could search for all string literals and if they match an existing function or variable name (that you've obfuscated), you can replace the literal. This will fix both CALL("MYFUNC") and CALL(THING$) where THING$ is set to a literal SOMEWHERE.

Replying to:Simeon
Why the dislikes?
Oh okay that makes sense.

Neat! Can't wait to play around with this. Probably won't start obfuscating everything, but I love hiding secrets for only the most determined of players to find.

Replying to:Simeon
Why the dislikes?
Chicken also has a problem with it to quote the higher up comment, "The point of an open-source platform is to allow others to read and eventually understand others' programs."

”Hmm, what would be the best way for people to look at my stuff and say “Hey, what the hell is this?” Oh yeah, change very function to random lengths of _ and scatter random number throughout”.

Replying to:Simeon
Why the dislikes?
People salty over the existence of an obfuscator because they want "free code", when they don't realize that trying to suppress the existence of an obfuscator is antithetical to that very concept.