projects
/
pwnitter
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9baaa35
)
setup and tear down monitor in separate functions and change DBus API for Start()
author
Tobias Mueller
<tobiasmue@gnome.org>
Wed, 12 Jan 2011 12:50:34 +0000
(13:50 +0100)
committer
Tobias Mueller
<tobiasmue@gnome.org>
Wed, 12 Jan 2011 12:50:34 +0000
(13:50 +0100)
pwnitter.py
patch
|
blob
|
history
diff --git
a/pwnitter.py
b/pwnitter.py
index
4d661fd
..
a0860be
100755
(executable)
--- a/
pwnitter.py
+++ b/
pwnitter.py
@@
-29,15
+29,18
@@
class Pwnitter(dbus.service.Object):
self.status = status
self.is_running = False
self.status = status
self.is_running = False
- @dbus.service.method(NAME,
- in_signature='', out_signature='')
- def Start(self, device='mon0'):
- # FIXME: Prevent double Start()
+ def setup_monitor(device='mon0'):
# FIXME: Replace hardcoded interface
cmd = '/usr/sbin/iw wlan0 interface add mon0 type monitor'.split()
subprocess.call(cmd)
cmd = '/sbin/ifconfig mon0 up'.split()
subprocess.call(cmd)
# FIXME: Replace hardcoded interface
cmd = '/usr/sbin/iw wlan0 interface add mon0 type monitor'.split()
subprocess.call(cmd)
cmd = '/sbin/ifconfig mon0 up'.split()
subprocess.call(cmd)
+
+ @dbus.service.method(NAME,
+ in_signature='', out_signature='')
+ def Start(self):
+ # FIXME: Prevent double Start()
+ self.setup_monitor(self.device):
self.is_running = True
try:
self.cap = pcap.pcap(device)
self.is_running = True
try:
self.cap = pcap.pcap(device)
@@
-68,16
+71,20
@@
class Pwnitter(dbus.service.Object):
def GetMessage(self):
return self.status
def GetMessage(self):
return self.status
+
+ def tear_down_monitor(device='mon0'):
+ cmd = '/sbin/ifconfig mon0 down'.split()
+ subprocess.call(cmd)
+ cmd = '/usr/sbin/iw dev mon0 del'.split()
+ subprocess.call(cmd)
+
@dbus.service.method(NAME,
in_signature='', out_signature='')
def Stop(self):
self.is_running = False
print "Receive Stop"
gobject.source_remove(self.source_id)
@dbus.service.method(NAME,
in_signature='', out_signature='')
def Stop(self):
self.is_running = False
print "Receive Stop"
gobject.source_remove(self.source_id)
- cmd = '/sbin/ifconfig mon0 down'.split()
- subprocess.call(cmd)
- cmd = '/usr/sbin/iw dev mon0 del'.split()
- subprocess.call(cmd)
+ self.tear_down_monitor(self.device)
loop.quit()
loop.quit()