Beispiel #1
0
from tl.lib.persistconfig import PersistConfig
from tl.lib.callbacks import first_callbacks

## basic imports

import socket
import re
import time
import queue
import logging

# defines

udplistener = None

cfg = PersistConfig()
cfg.define('udp', 0) # set to 0 to disnable
cfg.define('udpparty', 0)
cfg.define('udpipv6', 0)
cfg.define('udpmasks', ['192.168*', ])
cfg.define('udphost', "localhost")
cfg.define('udpport', 5500)
cfg.define('udpallow', ["127.0.0.1", ])
cfg.define('udpallowednicks', ["#dunkbots", "#tl", "dunk_"])
cfg.define('udppassword', "mekker", exposed=False)
cfg.define('udpseed', "blablablablablaz", exposed=False) # needs to be 16 chars wide
cfg.define('udpstrip', 1) # strip all chars < char(32)
cfg.define('udpsleep', 0) # sleep in sendloop .. can be used to delay pack
cfg.define('udpdblog', 0)
cfg.define('udpbots', [cfg['udpbot'] or 'default-irc', ])
Beispiel #2
0
from tl.utils.generic import getwho
from tl.lib.commands import cmnds
from tl.lib.examples import examples
from tl.lib.callbacks import callbacks
from tl.lib.users import getusers
from tl.lib.persistconfig import PersistConfig

## basic imports

import time
import logging

## defines

cfg = PersistConfig()
cfg.define('oponsplit', 0)

## onjoincb callback

def opjoincb(bot, ievent):
    """ see if we should op a user on join """
    # don't try to op the bot
    if ievent.nick == bot.nick: return
    #if bot.state.has_key('no-op') and chan in bot.state['no-op']: return
    import time
    time.sleep(1)
    if (ievent.user and 'OPER' in ievent.user.data.perms) or (ievent.chan and ievent.userhost in ievent.chan.data.ops): bot.doop(ievent.channel.lower(), ievent.nick)
    try: bot.splitted.remove(ievent.nick.lower())
    except (ValueError, AttributeError): pass
Beispiel #3
0
json = getjson()

## basic imports

import os
import logging
import uuid
import time
import io
import gzip
import urllib.request, urllib.parse, urllib.error

## defines

cfg = PersistConfig()
cfg.define("enable", 0)
cfg.define("sleep", 5)

state = PlugState()
state.define("ids", {})
state.define("seen", [])
state.define("names", {})
state.define("watch", [])

teller = 0
dostop = False

## plugin init

def init_threaded():
Beispiel #4
0
import logging
import pickle

## check for pycrypto dependancy
got = False

try:
    import Crypto.Cipher.Blowfish
    import Crypto.Cipher.AES
    got = True
except ImportError: 
    raise RequireError("PyCrypto is required for FiSH. Please install this library if you want to use this plug")

## defines

cfg = PersistConfig()
cfg.define("enable", 0)

users = getusers()

## KeyStore class

class KeyStore(Persist):
  def __init__(self, keyname):
    Persist.__init__(self, getdatadir() + os.sep + 'keys' + os.sep + 'fish' + os.sep + stripname(keyname))

## make sure we get loaded

def dummycb(bot, event): pass

callbacks.add("START", dummycb)
Beispiel #5
0
from tl.lib.persistconfig import PersistConfig
from tl.lib.plugins import plugs as plugins

## basic imports

import urllib.request, urllib.parse, urllib.error
import urllib.request, urllib.error, urllib.parse
import urllib.parse
import copy
import re
import socket

## defines

cfg           = PlugPersist('snarf.cfg')
pcfg          = PersistConfig()
pcfg.define('allow', ['text/plain', 'text/html', 'application/xml'])

re_html_title = re.compile('<title>(.*?)</title>', re.I | re.M | re.S)

re_url_match  = re.compile('((?:http|https)://\S+)')

re_html_valid = {
    'result':   re.compile('(Failed validation, \d+ errors?|Passed validation)', re.I | re.M),
    'modified': re.compile('<th>Modified:</th><td colspan="2">([^<]+)</td>', re.I | re.M),
    'server':   re.compile('<th>Server:</th><td colspan="2">([^<]+)</td>', re.I | re.M),
    'size':     re.compile('<th>Size:</th><td colspan="2">([^<]+)</td>', re.I | re.M),
    'content':  re.compile('<th>Content-Type:</th><td colspan="2">([^<]+)</td>', re.I | re.M),
    'encoding': re.compile('<td>([^<]+)</td><td><select name="charset" id="charset">', re.I | re.M),
    'doctype':  re.compile('<td>([^<]+)</td><td><select id="doctype" name="doctype">', re.I | re.M)
    }
Beispiel #6
0
from tl.lib.datadir import getdatadir
from tl.lib.examples import examples
from tl.lib.fleet import fleet
from tl.utils.pdod import Pdod
from tl.lib.persistconfig import PersistConfig
from tl.lib.threads import start_new_thread

## basic imports

import os
import socket
import time

## defines

cfg = PersistConfig()
cfg.define('server-host', '127.0.0.1')
cfg.define('server-port', 6600)
cfg.define('server-pass', '')
cfg.define('socket-timeout', 15)
cfg.define('watcher-interval', 10)
cfg.define('watcher-enabled', 0)
cfg.define('song-status', 'now playing: %(artist)s - %(title)s on "%(album)s" (duration: %(time)s)')

## classes

class MPDError(Exception):
    """ exception to raise. """
    pass

class MPDDict(dict):
Beispiel #7
0
import time
import os
import logging
import _thread
from os import path
from datetime import datetime

## locks

outlock = _thread.allocate_lock()
outlocked = lockdec(outlock)

## defines

cfg = PersistConfig()
cfg.define('channels', [])
cfg.define('format', 'log')
cfg.define('basepath', getdatadir())
cfg.define('nologprefix', '[nolog]')
cfg.define('nologmsg', '-= THIS MESSAGE NOT LOGGED =-')
cfg.define('backend', 'log')

logfiles = {}
backends = {}
stopped = False
db = None
eventstolog = ["OUTPUT", "PRIVMSG", "CONSOLE", "PART", "JOIN", "QUIT", "PRESENCE", "MESSAGE", "NOTICE", "MODE", "TOPIC", "KICK", "CONVORE", "TORNADO"]

## logging part
Beispiel #8
0
from tl.lib.persist import PlugPersist
from tl.lib.fleet import getfleet
from tl.lib.commands import cmnds
from tl.lib.examples import examples
from tl.lib.callbacks import callbacks
from tl.lib.persistconfig import PersistConfig
from tl.utils.generic import fromenc, toenc

## basic imports

import logging
import time

## plugin configuration

cfg = PersistConfig()
cfg.define("botnames", ["default-sxmpp","default-irc"])
cfg.define("host", "localhost")
cfg.define("port", "54321")
cfg.define("aliases", {})
cfg.define("enable", False)

## SocketServer imports

import socketserver
from socketserver import ThreadingMixIn, StreamRequestHandler

## defines

shared_data = {}
Beispiel #9
0
from tl.utils.lazydict import LazyDict

## basic imports

import copy
import os
import re
import urllib.request, urllib.parse, urllib.error, urllib.request, urllib.error, urllib.parse
import xml.dom.minidom

## defines

feedparser = getfeedparser()  
json = getjson()

cfg = PersistConfig()
cfg.define('sep', '..')

## Error classes

class BugTrackerNotFound(Exception):
    pass

class BugTrackerNotImplemented(Exception):
    pass

class BugTrackerNotSupported(Exception):
    pass


## BugTracker class
Beispiel #10
0
__author__ = "Wijnand 'tehmaze' Modderman - http://tehmaze.com"
__license__ = 'BSD'

## tl imports

from tl.lib.commands import cmnds
from tl.utils.url import striphtml, useragent
from tl.lib.examples import examples
from tl.utils.exception import handle_exception
from tl.lib.persistconfig import PersistConfig
from tl.lib.cache import get, set

## plug config

plugcfg = PersistConfig()
plugcfg.define("url", 'http://tinyurl.com/create.php')

## simpljejson

from tl.imports import getjson
json = getjson()

## basic imports

import urllib.request, urllib.parse, urllib.error
import urllib.request, urllib.error, urllib.parse
import urllib.parse
import re
import logging
Beispiel #11
0
## basic imports

import urllib
import time
import re
import random
import types
import logging
import os

from tl.lib.persistconfig import PersistConfig

## config stuff

cfg = PersistConfig()
cfg.define("enable", [])
cfg.define("command", 0)
cfg.define("onjoin", [])
cfg.define("loud", 0)
cfg.define("target", "tl")

## enabled function


def enabled(botname, channel):
    if jsonstring([botname, channel]) in cfg["enable"]:
        return True


## Markers (is Marker the correct name for this?)
Beispiel #12
0
from tl.lib.callbacks import callbacks
from tl.lib.commands import cmnds
from tl.lib.datadir import getdatadir
from tl.utils.pdod import Pdod
from tl.lib.persistconfig import PersistConfig
from tl.lib.examples import examples

## basic imports

import os
import time

## defines

cfg = PersistConfig()
cfg.define("tz", "+0100")

## Seen-class


class Seen(Pdod):

    """ maintain last seen information. """

    def __init__(self):
        self.datadir = os.path.join(getdatadir(), "plugs", "tl.plugs.extra.seen")
        Pdod.__init__(self, os.path.join(self.datadir, "seen.data"))

    def privmsgcb(self, bot, ievent):
        self.data[ievent.nick.lower()] = {