Open awhipp opened 5 years ago
Easiest way to do this is create an exit handler with the atexit package. Below is an example that I used in my fork of this branch:
def exit_handler(): if not dns_sniff_gource: print(bcolours.OKBLUE + '[Info] Disabling IP Forwarding...' + bcolours.ENDC) os.system('sysctl -w net.inet.ip.forwarding=0 > /dev/null') os.system('sudo sysctl -w net.inet.ip.forwarding=0 > /dev/null ') print(bcolours.OKBLUE + '[Info] Application Ended Gracefully.' + bcolours.ENDC) atexit.register(exit_handler)
Easiest way to do this is create an exit handler with the atexit package. Below is an example that I used in my fork of this branch: