20 lines
437 B
Python
20 lines
437 B
Python
|
#!/usr/bin/python3
|
||
|
|
||
|
import socket
|
||
|
import sys
|
||
|
|
||
|
def encode(data):
|
||
|
return b"\xc0\x30%s\xc0" % data.replace(b"\xdb", b"\xdb\xdd").replace(b"\xc0", b"\xdb\xdc")
|
||
|
|
||
|
def main():
|
||
|
sock = socket.socket()
|
||
|
sock.connect(("192.168.4.1", 8000))
|
||
|
while True:
|
||
|
line = sys.stdin.readline()
|
||
|
data = encode(line.encode("utf8"))
|
||
|
print("sending %r" % data)
|
||
|
sock.send(data)
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
main()
|