Last active
March 27, 2016 18:13
-
-
Save 10se1ucgo/6320a002af3a8410a3b5 to your computer and use it in GitHub Desktop.
Put in your scripts folder and add to your scripts list. (if you're an idiot)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Please don't use this. | |
Creator: 10se1ucgo | |
""" | |
import sys | |
from StringIO import StringIO | |
from commands import alias, name, admin, add | |
class ExecRedirect(object): | |
def __enter__(self): | |
self.old_stdout = sys.stdout | |
sys.stdout = StringIO() | |
return sys.stdout | |
def __exit__(self, type, value, traceback): | |
sys.stdout = self.old_stdout | |
@alias('py_run') | |
@name('idiot') | |
@admin | |
def exec_command(connection, *args): | |
cmd = ' '.join(args) | |
with ExecRedirect() as redirect: | |
exec(cmd) | |
return redirect.getvalue() | |
add(exec_command) | |
def apply_script(protocol, connection, config): | |
return protocol, connection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment