cherriesandmochi / gdmaim

GDMaim is a GDScript obfuscation plugin for the Godot Engine.
MIT License
85 stars 7 forks source link

feat: Adds regex-based filtering capabilities to obfuscation #3

Closed graydoubt closed 5 months ago

graydoubt commented 5 months ago

This change adds the ability to filter lines based on a regular expression during export:

image

During development, some of my scripts allow for debug output that I'm using for tracing the more complex interactions and logic flow:

@export var DEBUG: bool = false

Methods then have print statements that give away the original method name after obfuscation:

func _cl_opened(actor_path, context_id, nonce):
    if DEBUG: print_debug("%s::_cl_opened(%s, %s, %s)" % [self, actor_path, context_id, nonce])

This is also useful for stripping assert()s that might give away details.

By specifying var DEBUG: bool|if DEBUG:|assert\( as regex, those lines will be stripped from the maimed code:

image

cherriesandmochi commented 5 months ago

Wow this looks very useful! I'm sorry you had to try figuring out my code! At some point, I definitely want to refactor the code into smaller files and make it more cohesive.

cherriesandmochi commented 5 months ago

Thank you very much!

graydoubt commented 5 months ago

Thanks for accepting. Apologies for the faux pas of just yoloing a PR without an accompanying issue.

cherriesandmochi commented 5 months ago

Oh all good, I don't mind at all!