Merge pull request #14 from viniciusmarangoni/master
Put interfaces up and start Network Manager after exit Credit to @viniciusmarangoni
This commit is contained in:
11
py/Airmon.py
11
py/Airmon.py
@@ -250,6 +250,17 @@ class Airmon(object):
|
|||||||
' {R}%s{O} (PID {R}%s{O})' % (pname, pid))
|
' {R}%s{O} (PID {R}%s{O})' % (pname, pid))
|
||||||
os.kill(int(pid), signal.SIGTERM)
|
os.kill(int(pid), signal.SIGTERM)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def put_interfaces_up():
|
||||||
|
Color.pl("{+} {O}Putting interfaces up...")
|
||||||
|
for interface in Airmon.get_interfaces():
|
||||||
|
Color.pl("{+} {B}up into {O}%s" %(interface.name))
|
||||||
|
(out,err) = Process.call('ifconfig %s up' %(interface.name))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def start_network_manager():
|
||||||
|
Color.pl("{+} {O}Starting NetworkManager")
|
||||||
|
(out,err) = Process.call('systemctl start NetworkManager')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
Airmon.terminate_conflicting_processes()
|
Airmon.terminate_conflicting_processes()
|
||||||
|
|||||||
@@ -288,6 +288,10 @@ class Configuration(object):
|
|||||||
''' Deletes temp and exist with the given code '''
|
''' Deletes temp and exist with the given code '''
|
||||||
Configuration.delete_temp()
|
Configuration.delete_temp()
|
||||||
Macchanger.reset_if_changed()
|
Macchanger.reset_if_changed()
|
||||||
|
from Airmon import Airmon
|
||||||
|
Airmon.stop(Configuration.interface)
|
||||||
|
Airmon.put_interfaces_up()
|
||||||
|
Airmon.start_network_manager()
|
||||||
exit(code)
|
exit(code)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -312,4 +316,3 @@ class Configuration(object):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
Configuration.initialize(False)
|
Configuration.initialize(False)
|
||||||
print Configuration.dump()
|
print Configuration.dump()
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ class Interface(object):
|
|||||||
output = Process(['ifconfig', iface]).stdout()
|
output = Process(['ifconfig', iface]).stdout()
|
||||||
mac_regex = ('[a-zA-Z0-9]{2}-' * 6)[:-1]
|
mac_regex = ('[a-zA-Z0-9]{2}-' * 6)[:-1]
|
||||||
match = re.search(' (%s)' % mac_regex, output)
|
match = re.search(' (%s)' % mac_regex, output)
|
||||||
|
if not match:
|
||||||
|
match = re.search('unspec (%s)' % mac_regex, output)
|
||||||
if not match:
|
if not match:
|
||||||
raise Exception('Could not find the mac address for %s' % iface)
|
raise Exception('Could not find the mac address for %s' % iface)
|
||||||
return match.groups()[0].replace('-', ':')
|
return match.groups()[0].replace('-', ':')
|
||||||
@@ -98,4 +100,3 @@ class Interface(object):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
mac = Interface.get_mac()
|
mac = Interface.get_mac()
|
||||||
print 'wlan0mon mac address:', mac
|
print 'wlan0mon mac address:', mac
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user