diff --git a/plugins/admin.py b/plugins/admin.py index 695e241..ad6088b 100644 --- a/plugins/admin.py +++ b/plugins/admin.py @@ -6,20 +6,6 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import utils from log import log -def _exec(irc, source, args): - """ - - Admin-only. Executes in the current PyLink instance. - \x02**WARNING: THIS CAN BE DANGEROUS IF USED IMPROPERLY!**\x02""" - utils.checkAuthenticated(irc, source, allowOper=False) - args = ' '.join(args) - if not args.strip(): - utils.msg(irc, source, 'No code entered!') - return - log.info('(%s) Executing %r for %s', irc.name, args, utils.getHostmask(irc, source)) - exec(args, globals(), locals()) -utils.add_cmd(_exec, 'exec') - @utils.add_cmd def spawnclient(irc, source, args): """ diff --git a/plugins/exec.py b/plugins/exec.py new file mode 100755 index 0000000..aa19204 --- /dev/null +++ b/plugins/exec.py @@ -0,0 +1,21 @@ +# exec.py: Provides an 'exec' command to execute raw code +import sys +import os +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + +import utils +from log import log + +def _exec(irc, source, args): + """ + + Admin-only. Executes in the current PyLink instance. + \x02**WARNING: THIS CAN BE DANGEROUS IF USED IMPROPERLY!**\x02""" + utils.checkAuthenticated(irc, source, allowOper=False) + args = ' '.join(args) + if not args.strip(): + utils.msg(irc, source, 'No code entered!') + return + log.info('(%s) Executing %r for %s', irc.name, args, utils.getHostmask(irc, source)) + exec(args, globals(), locals()) +utils.add_cmd(_exec, 'exec')