Advertisement
Peaser

Port knock with python - no expire

Jun 1st, 2014
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. import sys,time,struct,hmac
  2. from socket import gethostbyname, inet_aton, socket, AF_INET, SOCK_DGRAM
  3. from Crypto.Hash import SHA256
  4.  
  5. m = hmac.new(sys.argv[1], digestmod=SHA256)
  6. m.update(inet_aton(gethostbyname(sys.argv[2])))
  7. m.update(struct.pack("i", (int)(time.time() / 60)))
  8.  
  9. s = socket(AF_INET, SOCK_DGRAM)
  10. s.connect((sys.argv[3], (int)(sys.argv[4])))
  11. s.send(m.hexdigest())
  12. s.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement