mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-18 22:51:01 +01:00
Fixed a bug in the regexp; removed a latent security bug that was just waiting for that regexp bug to be fixed.
This commit is contained in:
parent
088047aea8
commit
2d6f22ae76
@ -37,12 +37,13 @@ to access the bot.
|
|||||||
from baseplugin import *
|
from baseplugin import *
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import random
|
||||||
|
|
||||||
import irclib
|
import irclib
|
||||||
import ircmsgs
|
import ircmsgs
|
||||||
|
|
||||||
class FixRelayBot(irclib.IrcCallback):
|
class FixRelayBot(irclib.IrcCallback):
|
||||||
_re = re.compile('<([^@]+)@([^>])+>\s+(.*)')
|
_re = re.compile(r'<([^@]+)@[^>]+>\s+(.*)')
|
||||||
def inFilter(self, irc, msg):
|
def inFilter(self, irc, msg):
|
||||||
if msg.command == 'PRIVMSG':
|
if msg.command == 'PRIVMSG':
|
||||||
#debug.printf('Message command was PRIVMSG')
|
#debug.printf('Message command was PRIVMSG')
|
||||||
@ -51,7 +52,8 @@ class FixRelayBot(irclib.IrcCallback):
|
|||||||
#debug.printf('Regexp matched: %r, %r, %r' % m.groups())
|
#debug.printf('Regexp matched: %r, %r, %r' % m.groups())
|
||||||
nick = m.group(1)
|
nick = m.group(1)
|
||||||
network = m.group(2)
|
network = m.group(2)
|
||||||
newprefix = '%s!%s@%s' % (nick, nick, network)
|
host = random.random()*100
|
||||||
|
newprefix = ircutils.joinHostmask(nick, nick, host)
|
||||||
msg = ircmsgs.IrcMsg(command='PRIVMSG', prefix=newprefix,
|
msg = ircmsgs.IrcMsg(command='PRIVMSG', prefix=newprefix,
|
||||||
args=(msg.args[0], m.group(3)))
|
args=(msg.args[0], m.group(3)))
|
||||||
return msg
|
return msg
|
||||||
|
Loading…
x
Reference in New Issue
Block a user