Skip to content

Instantly share code, notes, and snippets.

@Palakis
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Palakis/daadcd052095316d5a2d to your computer and use it in GitHub Desktop.
Save Palakis/daadcd052095316d5a2d to your computer and use it in GitHub Desktop.
OpenVPN autokill
#!/usr/bin/env python
import sys
import time
import telnetlib
if len(sys.argv) < 3:
print "Usage : "+__file__+" <host> <port> <client to kill>"
exit()
host = sys.argv[1]
port = sys.argv[2]
target = sys.argv[3]
try:
print "Opening connection to " + host + ":" + port + "..."
mgmt = telnetlib.Telnet(host, port, 20)
print "Autokill running"
while True:
mgmt.write("kill " + target + " \r\n")
time.sleep(1)
except (KeyboardInterrupt, SystemExit):
print "\rClosing connection"
mgmt.write("exit\r\n")
print "Goodbye!"
exit()
except:
raise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment