X-Git-Url: https://git.distorted.org.uk/~mdw/tripe/blobdiff_plain/76a24ae6cece0604e3155b628622a4b425cb77f3..5d60949f7d6a88e88d4d962d093b0ae1a4df5096:/contrib/greet.in diff --git a/contrib/greet.in b/contrib/greet.in new file mode 100644 index 00000000..c84efdcb --- /dev/null +++ b/contrib/greet.in @@ -0,0 +1,17 @@ +#! @PYTHON@ +### greet HOST PORT CHALLENGE +### Sends a TrIPE greeting packet to the server listening on HOST and PORT. +### The payload is the base64-encoded CHALLENGE. + +import socket as S +from sys import argv + +def db64(s): + return (s + '='*((-len(s))%4)).decode('base64') + +addr, chal = (lambda _, h, p, c: ((h, int(p)), db64(c)))(*argv) +sk = S.socket(S.AF_INET, S.SOCK_DGRAM) +sk.connect(addr) + +pkt = '\x25' + chal +sk.send(pkt)