fixup: make pcap read from the file
[pwnitter] / simpledaemon.py
1 #!/usr/bin/env python
2
3 import dbus
4 import dbus.service
5 import dbus.mainloop.glib
6 import gobject
7
8 class SomeObject(dbus.service.Object):
9     @dbus.service.method("de.cryptobitch.muelli.Pwnitter",
10                          in_signature='s', out_signature='as')
11     def HelloWorld(self, hello_message="default"):
12         print (str(hello_message))
13         return ["Hello", " from example-service.py", "with unique name",
14                 session_bus.get_unique_name()]
15     @dbus.service.method("de.cryptobitch.muelli.Pwnitter",
16                          in_signature='', out_signature='')
17     def EmitSignal(self):
18         self.MessageSent('foo')
19     
20     @dbus.service.signal("de.cryptobitch.muelli.Pwnitter")                
21     def MessageSent(self,who):
22         print 'emitting'
23     
24     def emit_and_true(self):
25         self.MessageSent('always')
26         return True
27 if __name__ == '__main__':
28     dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
29
30     session_bus = dbus.SystemBus()
31     name = dbus.service.BusName("de.cryptobitch.muelli.Pwnitter", session_bus)
32     object = SomeObject(session_bus, '/Pwnitter')
33
34     mainloop = gobject.MainLoop()
35     gobject.timeout_add(5 * 1000, object.emit_and_true)
36     print "Running example service."
37     mainloop.run()