Added StartFromFile to DBus Interface to call Pwnitter with a PCap file
authorTobias Mueller <tobiasmue@gnome.org>
Wed, 12 Jan 2011 12:56:14 +0000 (13:56 +0100)
committerTobias Mueller <tobiasmue@gnome.org>
Wed, 12 Jan 2011 12:56:14 +0000 (13:56 +0100)
pwnitter.py

index a0860be..6d0defa 100755 (executable)
@@ -38,9 +38,10 @@ class Pwnitter(dbus.service.Object):
     
     @dbus.service.method(NAME,
                          in_signature='', out_signature='')
-    def Start(self):
+    def Start(self, filename=None):
         # FIXME: Prevent double Start()
-        self.setup_monitor(self.device):
+        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.is_running = True
         try:
             self.cap = pcap.pcap(device)
@@ -50,6 +51,12 @@ class Pwnitter(dbus.service.Object):
         self.cap.setfilter('dst port 80')
         cap_fileno = self.cap.fileno()
         self.source_id = gobject.io_add_watch(cap_fileno, gobject.IO_IN, self.cap_readable_callback, device) 
+
+    @dbus.service.method(NAME,
+                         in_signature='s', out_signature='')
+    def StartFromFile(self, filename):
+        return self.Start(filename=filename)
+
     
     def cap_readable_callback(self, source, condition, device):
         return self.pwn(device, self.MessageSent)