LevelBlue + SentinelOne: Global Partnership to Deliver AI-Powered Managed Security Operations and Incident Response. Learn More

Monkey Patching the Matrix

For those of you not familiar with monkey patching, it's a mechanism to "extend or modify the run-time code of dynamic languages without altering the original source code". Previously, I demonstrated how monkey patching can modify the logic of a Ruby gem dependency to work around hardcoded configuration settings. As you might imagine, this technique, if used in the movie the Matrix, would have been a great advantage to our favorite "hacker" Neo in his quest to be "The One".

8245_1e45385a-ee6c-4e0a-9ca5-a93059bb657b

In this blog post, I'll be showing some real world Matrix code examples that demonstrate how you (a hacker) can upgrade your guns, learn karate, and avoid being shot by the lady in the red dress.

The choice is yours…


Upgrading Your Guns (Method Override)

11630_c31d9545-ba34-4947-9c19-ab09eb09b1ed

If the Matrix were written in Ruby, the code to define a semi-automatic weapon could look something like this: