import dbus.mainloop.glib
import getopt, sys, pcap, dpkt, re, httplib, urllib
import logging
+import logging.config
import socket
import time
import gobject
def Start(self, filename=None):
# FIXME: Prevent double Start()
if filename is None: # Then we do *not* want to read from a PCap file but rather a monitor device
- self.setup_monitor(self.device)
+ self.setup_monitor(device)
+ device = self.device
+ else: # We have given a filename, so let's make PCap read from the file
+ device = filename
self.is_running = True
try:
self.cap = pcap.pcap(device)
return self.status
- def tear_down_monitor(device='mon0'):
+ def tear_down_monitor(self, device='mon0'):
cmd = '/sbin/ifconfig mon0 down'.split()
subprocess.call(cmd)
cmd = '/usr/sbin/iw dev mon0 del'.split()
'warn': logging.WARN, 'error': logging.ERROR,
'critical': logging.CRITICAL}.get(options.loglevel, "warn")
logging.basicConfig(level=loglevel)
+ #logging.config.fileConfig('logging.conf') #FIXME: Have file configured logging
log = logging.getLogger("Main")
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
#object.Start()
loop = gobject.MainLoop()
- print "Running example signal emitter service."
+ log.info("Running example signal emitter service.")
# FIXME: This is debug code
#gobject.idle_add(pwnitter.MessageSent)