projects
/
pwnitter
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d466bef
)
Added capability of sending one message only
author
Tobias Mueller
<tobiasmue@gnome.org>
Thu, 13 Jan 2011 18:23:13 +0000
(19:23 +0100)
committer
Tobias Mueller
<tobiasmue@gnome.org>
Thu, 13 Jan 2011 18:23:13 +0000
(19:23 +0100)
for debugging purposes.
pwnitter.py
patch
|
blob
|
history
diff --git
a/pwnitter.py
b/pwnitter.py
index
5a06ed2
..
c363a23
100755
(executable)
--- a/
pwnitter.py
+++ b/
pwnitter.py
@@
-25,12
+25,13
@@
def usage():
NAME = 'de.cryptobitch.muelli.Pwnitter'
class Pwnitter(dbus.service.Object):
NAME = 'de.cryptobitch.muelli.Pwnitter'
class Pwnitter(dbus.service.Object):
- def __init__(self, bus, object_name, device='mon0'):
+ def __init__(self, bus, object_name, device='mon0', run_once_only=False):
super(Pwnitter, self).__init__(bus, object_name)
self.device = device
self.status = status
self.is_running = False
super(Pwnitter, self).__init__(bus, object_name)
self.device = device
self.status = status
self.is_running = False
+ self.run_once_only = run_once_only
def setup_monitor(device='mon0'):
# FIXME: Replace hardcoded interface
def setup_monitor(device='mon0'):
# FIXME: Replace hardcoded interface
@@
-174,6
+175,8
@@
class Pwnitter(dbus.service.Object):
log.debug('Issueing connection')
log.debug('Issueing connection')
+ if self.run_once_only: # If we wanted to run once only, we make it stop now
+ self.is_running = False
if host == 'mobile.twitter.com':
params = urllib.urlencode({
if host == 'mobile.twitter.com':
params = urllib.urlencode({
@@
-215,7
+218,8
@@
class Pwnitter(dbus.service.Object):
log.error("FAILED to tweet as %s, debug follows:", name)
log.error("%s, %s", response.status, response.reason)
log.error("%s", response.read())
log.error("FAILED to tweet as %s, debug follows:", name)
log.error("%s, %s", response.status, response.reason)
log.error("%s", response.read())
- return self.is_running # Execute next time, we're idle
+
+ return self.is_running # Execute next time, we're idle or stop if we wanted to run once and have processed a message successfully
# FIXME: Ideally, check whether Pcap has got data for us
def main():
# FIXME: Ideally, check whether Pcap has got data for us
def main():
@@
-239,6
+243,9
@@
if __name__ == '__main__':
parser.add_option("-s", "--session", dest="use_session_bus",
action="store_true", default=False,
help="Bind Pwnitter to the SessionBus instead of the SystemBus")
parser.add_option("-s", "--session", dest="use_session_bus",
action="store_true", default=False,
help="Bind Pwnitter to the SessionBus instead of the SystemBus")
+ parser.add_option("-1", "--single", dest="run_once_only",
+ action="store_true", default=False,
+ help="Make it send a single message only")
(options, args) = parser.parse_args()
loglevel = {'debug': logging.DEBUG, 'info': logging.INFO,
'warn': logging.WARN, 'error': logging.ERROR,
(options, args) = parser.parse_args()
loglevel = {'debug': logging.DEBUG, 'info': logging.INFO,
'warn': logging.WARN, 'error': logging.ERROR,
@@
-254,7
+261,7
@@
if __name__ == '__main__':
else:
session_bus = dbus.SystemBus()
name = dbus.service.BusName(NAME, session_bus)
else:
session_bus = dbus.SystemBus()
name = dbus.service.BusName(NAME, session_bus)
- pwnitter = Pwnitter(session_bus, '/Pwnitter')
+ pwnitter = Pwnitter(session_bus, '/Pwnitter', run_once_only=options.run_once_only)
#object.Start()
loop = gobject.MainLoop()
#object.Start()
loop = gobject.MainLoop()