tcpbot/plugins/RawCmd.rb
oz modic c8d0c13c1c added several new plugins
ACL: modify ACL perms
Barf: silly test plug
BotTools: join and part
Circumstantial:  excuses, success messages...
Pastebin: paste module code to pastebin
RawCmd: raw unix command line, and eval ruby code. requires super privilege
Reminder: reminders reminders!
URLInfo: output url info when url is detected
Unixfun: figlet, cowsay, fortune. make sure u have them installed
Voteage: user++, user--, :score user
2016-03-19 04:09:28 -06:00

37 lines
869 B
Ruby

require 'cinch'
require 'open-uri'
require_relative '../classes/Util.rb'
class RawCmd
include Cinch::Plugin
include Hooks::ACLHook
include Util::PluginHelper
set :prefix, /^:/
@clist = %w{raw eval}
@@commands["raw"] = ":raw <cmd> - run <cmd> through terminal untouched (requires SUPER ADMIN OVER 9000 PRIVILEGES)";
@@commands["eval"] = ":eval <rcode> - evaluate <rcode> as ruby code (requires SUPER ADMIN OVER 9000 PRIVILEGES)";
@@levelRequired = 9001
match /raw (.+)/, method: :raw;
match /eval (.+)/, method: :reval;
def raw(m, cmd)
aclcheck(m)
if(!aclcheck(m))
m.reply("#{m.user.nick}: quit trynna hax nga")
return
end
IO.popen(cmd).readlines.each { |line|
m.reply line
}
end
def reval(m, code)
aclcheck(m)
if(!aclcheck(m))
m.reply("#{m.user.nick}: quit trynna hax nga")
return
end
m.reply(eval(code));
end
end