Skip to content

Instantly share code, notes, and snippets.

@endofline endofline/
Created Feb 15, 2017

What would you like to do?
subverting imported libraries
# in the bot, this represents the new hangups library
this_is_a_constant = 'ABCD'
def print_constant():
# in the bot, this represents the plugin
import test_a
# in the bot, this file is the plugin loader
import test_b # plugin is loaded
import test_d # we replace the test_a module inside the plugin with this in EXAMPLE 2
# EXAMPLE 1: replace constant
# setattr(test_b.test_a, 'this_is_a_constant', 'no longer constant');
# EXAMPLE 2: replace module
# setattr(test_b, 'test_a', test_d) # replaces module with another one
# in example 1, this prints 'no longer constant'
# in example 2, this prints '3.142'
# in the bot, this replaces new hangups ( with the compatibility layer
def print_constant():
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.