Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __module_name__ = "PhishDetectionWR"
- __module_version__ = "1.0.10"
- __module_description__ = "Detects phishing links posted to #wikia-runescape and kick-bans users who post them"
- # by A_proofreader (wikia/A-proofreader) of Freenode #wikia-runescape
- import re
- import xchat
- # THE FOLLOWING IS CONFIGURABLE
- phishing_regex = re.compile(r" (http://|www.)[^/ ]*\.runescape\.com\.[a-z0-9]" # unexpected dot after .com
- + "|runescape\.co\.(?!uk)" # runescape.co.tld, excluding runescape.co.uk (legit)
- + "| (http://|www.)[^/ ]*(-runescape|runescape-)[^/ ]*/" # dashes instead of dots at expected places
- , re.IGNORECASE)
- def phishtrigger(word, word_eol, userdata):
- # :Source PRIVMSG Target :Message which may contain spaces
- # ^0 ^1 ^2 ^3 ^4[etc.] or use word_eol[3]
- if word[2].lower() == "#wikia-runescape" and phishing_regex.search(word_eol[3]) is not None:
- # xchat.command("QUOTE MODE %s +b *!*@%s" % (word[2], word[0].partition("@")[2]))
- # MODE channel +b *!*@<what's after the @ in source>
- xchat.command("QUOTE KICK %s %s :%s" % (word[2], word[0].partition("!")[0][1:], "Phishing link detected"))
- # KICK channel <nick, between : and ! excl.> :Phishing link detected
- return xchat.EAT_NONE
- xchat.hook_server("PRIVMSG", phishtrigger)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement