Attempt 01
Signed-off-by: Georg <georg@lysergic.dev>
This commit is contained in:
parent
2ca02da5e9
commit
9adb74ab6c
@ -37,17 +37,17 @@ import supybot
|
|||||||
from supybot import world
|
from supybot import world
|
||||||
|
|
||||||
# Use this for the version of this plugin.
|
# Use this for the version of this plugin.
|
||||||
__version__ = ""
|
__version__ = "v0.1"
|
||||||
|
|
||||||
# XXX Replace this with an appropriate author or supybot.Author instance.
|
# XXX Replace this with an appropriate author or supybot.Author instance.
|
||||||
__author__ = supybot.authors.unknown
|
__author__ = supybot.Author
|
||||||
|
|
||||||
# This is a dictionary mapping supybot.Author instances to lists of
|
# This is a dictionary mapping supybot.Author instances to lists of
|
||||||
# contributions.
|
# contributions.
|
||||||
__contributors__ = {}
|
__contributors__ = {}
|
||||||
|
|
||||||
# This is a url where the most recent plugin package can be downloaded.
|
# This is a url where the most recent plugin package can be downloaded.
|
||||||
__url__ = ''
|
__url__ = 'https://git.com.de/georg/limnoria-system'
|
||||||
|
|
||||||
from . import config
|
from . import config
|
||||||
from . import plugin
|
from . import plugin
|
||||||
|
BIN
__pycache__/__init__.cpython-38.pyc
Normal file
BIN
__pycache__/__init__.cpython-38.pyc
Normal file
Binary file not shown.
BIN
__pycache__/config.cpython-38.pyc
Normal file
BIN
__pycache__/config.cpython-38.pyc
Normal file
Binary file not shown.
BIN
__pycache__/plugin.cpython-38.pyc
Normal file
BIN
__pycache__/plugin.cpython-38.pyc
Normal file
Binary file not shown.
14
config.py
14
config.py
@ -52,5 +52,17 @@ System = conf.registerPlugin('System')
|
|||||||
# conf.registerGlobalValue(System, 'someConfigVariableName',
|
# conf.registerGlobalValue(System, 'someConfigVariableName',
|
||||||
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
# registry.Boolean(False, _("""Help for someConfigVariableName.""")))
|
||||||
|
|
||||||
|
conf.registerGroup(System, 'access')
|
||||||
|
conf.registerGlobalValue(System.access, 'read',
|
||||||
|
registry.CommaSeparatedListOfStrings('',
|
||||||
|
"""
|
||||||
|
RO access
|
||||||
|
"""
|
||||||
|
))
|
||||||
|
conf.registerGlobalValue(System.access, 'write',
|
||||||
|
registry.CommaSeparatedListOfStringsStrings('',
|
||||||
|
"""
|
||||||
|
RW access
|
||||||
|
"""
|
||||||
|
))
|
||||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||||
|
42
plugin.py
42
plugin.py
@ -28,20 +28,56 @@
|
|||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
from supybot import utils, plugins, ircutils, callbacks
|
import os
|
||||||
|
from supybot import utils, plugins, ircutils, callbacks, ircdb, ircmsgs
|
||||||
from supybot.commands import *
|
from supybot.commands import *
|
||||||
|
from supybot.ircmsgs import nick
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from supybot.i18n import PluginInternationalization
|
from supybot.i18n import PluginInternationalization
|
||||||
_ = PluginInternationalization('System')
|
_ = PluginInternationalization('System')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# Placeholder that allows to run the plugin on a bot
|
# Placeholder that allows to run the plugin on a bot
|
||||||
# without the i18n module
|
# without the i18n module
|
||||||
_ = lambda x: x
|
"_ = lambda x: x"
|
||||||
|
|
||||||
|
|
||||||
class System(callbacks.Plugin):
|
class System(callbacks.Plugin):
|
||||||
"""Internal Use"""
|
"""Internal Use"""
|
||||||
threaded = True
|
threaded = True
|
||||||
|
pass
|
||||||
|
|
||||||
|
def system(self, irc, msg, args, option1, option2):
|
||||||
|
"""<option> <option>
|
||||||
|
If you're supposed to use this you know how."""
|
||||||
|
|
||||||
|
nick = msg.nick
|
||||||
|
hostmask = irc.state.nickToHostmask(msg.nick)
|
||||||
|
|
||||||
|
if 'get' in 'option1':
|
||||||
|
if 'all' in 'option2':
|
||||||
|
if hostmask in read or hostmask in write:
|
||||||
|
command = "/home/georg/botproc.pl"
|
||||||
|
command_output = os.popen(command)
|
||||||
|
for line in command_output:
|
||||||
|
irc.reply(line.rstrip())
|
||||||
|
else:
|
||||||
|
irc.reply("Fuck off.")
|
||||||
|
print("Intrustion attempt: " + hostmask)
|
||||||
|
else:
|
||||||
|
irc.reply("Your arguments smell bad.")
|
||||||
|
elif 'noget' in 'option1':
|
||||||
|
if 'all' in 'option2':
|
||||||
|
if hostmask in read or hostmask in write:
|
||||||
|
irc.reply("Implement this.")
|
||||||
|
else:
|
||||||
|
irc.reply("Go home.")
|
||||||
|
print("Intrusion attempt: " + hostmask)
|
||||||
|
else:
|
||||||
|
irc.reply("Ew, stinky arguments.")
|
||||||
|
else:
|
||||||
|
irc.reply("What.")
|
||||||
|
|
||||||
|
system = wrap(system, ['anything', 'anything'])
|
||||||
|
|
||||||
|
|
||||||
Class = System
|
Class = System
|
||||||
|
Reference in New Issue
Block a user