Example #1
0
	def __init__(self):
		Ether2Any.__init__(self, tap=Conf.get('tunnelEthernet', True))
		
		handlerConf = Conf.get('handler', {'allowFrom': None, 'allowTo': None})
		self.mailHandler = NetMailHandler(self.dev, **handlerConf)
		self.mailTo = Conf.get('mailTo', None)
		self.mailFrom = Conf.get('mailFrom', None)
		
		self.smtpConf = Conf.get('smtp')
		smtpd = Conf.get("smtpd", {'enabled': False})
		if smtpd['enabled']:
			self.smtpd = SMTPServerThread(smtpd['listen'], self.mailHandler)
		else:
			self.smtpd = None
		
		imapConf = Conf.get("imap", {'enabled': False})
		if imapConf['enabled']:
			self.imap = SimpleIMAPClient(imapConf, self.mailTo, self.mailHandler)
		else:
			self.imap = None
		
		self.generator = SpamGenerator()
		
		network = Conf.get('network', {'mtu': 1400})
		self.dev.ifconfig(**network)
Example #2
0
	def __init__(self):
		Ether2Any.__init__(self, tap=True)
		self.irclog = self.setupLogging("IrcVPN")
		self.irclog.setLevel(logging.WARN)
		
		# === Load config values ===
		network = Conf.get("network", {'mtu': 1500})
		self.ircmsglen = Conf.get("ircmsglen", 400)
		self.ircserver = Conf.get("ircserver")
		self.broadcastchan = Conf.get("broadcastchan")
		self.nickPrefix = Conf.get("nickPrefix", "VPN")
		self.postConnectCmd = Conf.get("postConnectCmd", None)
		self.voiceWord = Conf.get("voicebot", None)
		if self.voiceWord:
			self.voiceWord = self.voiceWord.get("voiceword", None)
		self.mode = Conf.get("mode", "HUB")
		self.ignoreNonMacUser = Conf.get("ignoreNonMacUser", True)
		self.acceptNonMatchingMac = Conf.get("acceptNonMatchingMac", True)
		self.strictSwichedNetwork = Conf.get("strictSwichedNetwork", False)
		
		if self.mode not in ("HUB", "SWITCH"):
			raise ValueError("mode needs to be either HUB or SWITCH")
		self.irclog.info("Starting the IRC Public Network")
		self.packets = {}
		self._setupIrc()
		self.nickre = re.compile("^%s[a-fA-F0-9]{12}$" % (self.nickPrefix,))
		self.dev.ifconfig(**network)
		self.dev.up()
Example #3
0
	def __init__(self):
		Ether2Any.__init__(self, tap=False)
		
		network = Conf.get("network", {'mtu': 1500})
		
		self.dev.ifconfig(**network)
		self.dev.up()
		
		self.reader = UdevReader(self.dev)
		self.reader.start()
Example #4
0
    def __init__(self):
        Ether2Any.__init__(self, tap=False)

        network = Conf.get("network", {'mtu': 1500})

        self.dev.ifconfig(**network)
        self.dev.up()

        self.reader = UdevReader(self.dev)
        self.reader.start()
Example #5
0
	def run(self):
		# start threads / connections
		self.connectSMTP()
		
		if self.imap:
			self.imap.start()

		if self.smtpd:
			self.smtpd.start()
		
		# call super method
		Ether2Any.run(self)
Example #6
0
	def __init__(self):
		Ether2Any.__init__(self, tap=False)
		
		network = Conf.get("network", {'mtu': 1400})
		self.dev.ifconfig(**network)
		self.dev.up()
		
		self.networkQueue = Queue.Queue()
		self.writeLock = threading.Lock()
		self.writeLock.acquire()
		
		self.usb = USBWriter(self.dev, self.networkQueue, self.writeLock)
		self.usb.start()
		
		self.udev = UdevHandler(self.dev, self.usb, self.writeLock)
		self.udev.start()
Example #7
0
    def __init__(self):
        Ether2Any.__init__(self, tap=False)

        network = Conf.get("network", {'mtu': 1400})
        self.dev.ifconfig(**network)
        self.dev.up()

        self.networkQueue = Queue.Queue()
        self.writeLock = threading.Lock()
        self.writeLock.acquire()

        self.usb = USBWriter(self.dev, self.networkQueue, self.writeLock)
        self.usb.start()

        self.udev = UdevHandler(self.dev, self.usb, self.writeLock)
        self.udev.start()
Example #8
0
	def __init__(self, debug=False):
		Ether2Any.__init__(self, tap=False)
		
		self.debug = debug
		network = Conf.get("network", {'mtu': 1400})
		self.coder = Conf.get("coder", None)
		self.twitterConf = Conf.get("twitter", None)
		self.endpoint = self.twitterConf['endpoint']
		if not self.endpoint:
			print "No endpoint in configuration, please add one."
			sys.exit(1)
		self.dev.ifconfig(**network)
		self.dev.up()

		self._setupTwitter()
		self.downstream = DownstreamThread(dev=self.dev, coder=self.coder, auth=self.auth, endpoint=self.endpoint, debug=self.debug)
		self.downstream.start()
Example #9
0
	def __init__(self):
		# device
		Ether2Any.__init__(self, tap=True)
		self.qrlog = self.setupLogging("QrNet")
		self.mqueue = Queue.Queue()
		self.squeue = Queue.Queue()
		self.setTimeout(1)
		
		network = Conf.get("network", {'mtu': 400})
		self.packetDrop = Conf.get("packetDrop", 20)
		
		self.dev.ifconfig(**network)
		self.dev.up()
		
		# thread starting...
		gtk.gdk.threads_init()
		
		self.cam = CamThread(self.dev, self.squeue, self.setupLogging("CamThread"))
		self.cam.start()
		self.display = DisplayThread(self.dev, self.mqueue, self.squeue, self.setupLogging("DisplayThread"))
		self.display.start()
Example #10
0
    def __init__(self, debug=False):
        Ether2Any.__init__(self, tap=False)

        self.debug = debug
        network = Conf.get("network", {'mtu': 1400})
        self.coder = Conf.get("coder", None)
        self.twitterConf = Conf.get("twitter", None)
        self.endpoint = self.twitterConf['endpoint']
        if not self.endpoint:
            print "No endpoint in configuration, please add one."
            sys.exit(1)
        self.dev.ifconfig(**network)
        self.dev.up()

        self._setupTwitter()
        self.downstream = DownstreamThread(dev=self.dev,
                                           coder=self.coder,
                                           auth=self.auth,
                                           endpoint=self.endpoint,
                                           debug=self.debug)
        self.downstream.start()