Terminate conflicting processe at startup
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python2.7
|
||||||
|
|
||||||
from py.Configuration import Configuration
|
from py.Configuration import Configuration
|
||||||
from py.Scanner import Scanner
|
from py.Scanner import Scanner
|
||||||
|
|||||||
21
py/Airmon.py
21
py/Airmon.py
@@ -156,9 +156,19 @@ class Airmon(object):
|
|||||||
interfaces.append(iface)
|
interfaces.append(iface)
|
||||||
return interfaces
|
return interfaces
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def ask():
|
def ask():
|
||||||
''' Asks user to define which wireless interface to use '''
|
'''
|
||||||
|
Asks user to define which wireless interface to use.
|
||||||
|
Does not ask if:
|
||||||
|
1. There is already an interface in monitor mode, or
|
||||||
|
2. There is only one wireles interface (automatically selected).
|
||||||
|
Puts selected device into Monitor Mode.
|
||||||
|
'''
|
||||||
|
|
||||||
|
Airmon.terminate_conflicting_processes()
|
||||||
|
|
||||||
Color.pl('\n{+} looking for {C}wireless interfaces{W}')
|
Color.pl('\n{+} looking for {C}wireless interfaces{W}')
|
||||||
mon_ifaces = Airmon.get_interfaces_in_monitor_mode()
|
mon_ifaces = Airmon.get_interfaces_in_monitor_mode()
|
||||||
mon_count = len(mon_ifaces)
|
mon_count = len(mon_ifaces)
|
||||||
@@ -197,6 +207,7 @@ class Airmon(object):
|
|||||||
iface.name = Airmon.start(iface)
|
iface.name = Airmon.start(iface)
|
||||||
return iface.name
|
return iface.name
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def terminate_conflicting_processes():
|
def terminate_conflicting_processes():
|
||||||
''' Deletes conflicting processes reported by airmon-ng '''
|
''' Deletes conflicting processes reported by airmon-ng '''
|
||||||
@@ -219,8 +230,14 @@ class Airmon(object):
|
|||||||
# No proceses to kill
|
# No proceses to kill
|
||||||
return
|
return
|
||||||
|
|
||||||
|
hit_pids = False
|
||||||
for line in out.split('\n'):
|
for line in out.split('\n'):
|
||||||
match = re.search('^(\d+)\t(.+)$', line)
|
if re.search('^ *PID', line):
|
||||||
|
hit_pids = True
|
||||||
|
continue
|
||||||
|
if not hit_pids: continue
|
||||||
|
if line.strip() == '': continue
|
||||||
|
match = re.search('^[ \t]*(\d+)[ \t]*([a-zA-Z0-9_\-]+)[ \t]*$', line)
|
||||||
if match:
|
if match:
|
||||||
# Found process to kill
|
# Found process to kill
|
||||||
pid = match.groups()[0]
|
pid = match.groups()[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user