diff --git a/plugins/exec.py b/plugins/exec.py index 55e277c..5f75fce 100644 --- a/plugins/exec.py +++ b/plugins/exec.py @@ -4,6 +4,7 @@ exec.py: Provides commands for executing raw code and debugging PyLink. from pylinkirc import utils, world from pylinkirc.log import log +from pylinkirc.coremods import permissions # These imports are not strictly necessary, but make the following modules # easier to access through eval and exec. @@ -17,8 +18,9 @@ def _exec(irc, source, args): """ Admin-only. Executes in the current PyLink instance. This command performs backslash escaping of characters, so things like \\n and \\ will work. + \x02**WARNING: THIS CAN BE DANGEROUS IF USED IMPROPERLY!**\x02""" - irc.checkAuthenticated(source, allowOper=False) + permissions.checkPermissions(irc, source, ['exec.exec']) # Allow using \n in the code, while escaping backslashes correctly otherwise. args = bytes(' '.join(args), 'utf-8').decode("unicode_escape") @@ -36,8 +38,9 @@ def _eval(irc, source, args): """ Admin-only. Evaluates the given Python expression and returns the result. + \x02**WARNING: THIS CAN BE DANGEROUS IF USED IMPROPERLY!**\x02""" - irc.checkAuthenticated(source, allowOper=False) + permissions.checkPermissions(irc, source, ['exec.eval']) args = ' '.join(args) if not args.strip(): @@ -55,7 +58,7 @@ def raw(irc, source, args): Admin-only. Sends raw text to the uplink IRC server. \x02**WARNING: THIS CAN BREAK YOUR NETWORK IF USED IMPROPERLY!**\x02""" - irc.checkAuthenticated(source, allowOper=False) + permissions.checkPermissions(irc, source, ['exec.raw']) args = ' '.join(args) if not args.strip(): @@ -74,7 +77,7 @@ def inject(irc, source, args): Admin-only. Injects raw text into the running PyLink protocol module, replying with the hook data returned. \x02**WARNING: THIS CAN BREAK YOUR NETWORK IF USED IMPROPERLY!**\x02""" - irc.checkAuthenticated(source, allowOper=False) + permissions.checkPermissions(irc, source, ['exec.inject']) args = ' '.join(args) if not args.strip():