Skip to content
This repository has been archived by the owner on Jul 2, 2023. It is now read-only.

Commit

Permalink
Fixed some problems with restoring after exit
Browse files Browse the repository at this point in the history
  • Loading branch information
h4ckzard committed Nov 15, 2018
1 parent 5302dba commit fa1818c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Unix/wpseyes.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ class bcolors:
def handler_STP(signum, frame):
pass

def restore(interface):
if len(interface) > 3:
os.system('sudo ip link set %s down' % interface)
os.system('sudo iw %s set type managed' % interface)
os.system('sudo ip link set %s up' % interface)
os.system('sudo systemctl restart NetworkManager')

def handler_INT(signum, frame):
os.system('sudo ip link set %s down' % WpsEyes.interface)
os.system('sudo iw %s set type managed' % WpsEyes.interface)
os.system('sudo ip link set %s up' % WpsEyes.interface)
os.system('sudo systemctl restart NetworkManager')
restore(WpsEyes.interface)
print(bcolors.HEADER + 'Bye-bye! . . .\n')
exit(1)

Expand Down Expand Up @@ -95,6 +99,7 @@ class WpsEyes(cmd.Cmd):

def do_EOF(self,_):
"\033[94m[?] Exit from WpsEyes\n"
restore(WpsEyes.interface)
print(bcolors.HEADER + 'Bye-bye! . . .\n')
return True

Expand Down

0 comments on commit fa1818c

Please sign in to comment.