YARV bytecode & method names?

Hi,

I’m writing a Ruby code obfuscator which translates source code into
YARV’s bytecode, strips all comments and partially mangles identifiers.

So far it can reliably mangle global variables, local variables and
constant/class/module names, unless wild metaprogramming constructs are
used.
The issue is with method names, as InstructionSequence for :send only
refers to method name with :mid key in Hash argument so it can be quite
ambiguous.
I know Ruby solves bindings at the runtime, only did expected there
would be some flag in bytecode which would refer to a source file where
is defined. I’ve also searched for some YARV compiler flag which can
help with static bytecode resolution, but failed.

I’m starting to think it is not possible to solve ambiguousness at
method calls and what I did is `good enough’ to protect before straight
copy&paste of algorithms. Still looking for ideas how it could be
solved, even in a quite different but technical way then I’d
imagine.

Also looking for corner-case examples to test variable/constant
identifiers mangling. Before I’d throw my code into public.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs