#!/usr/bin/env python3 # -*- coding, 0x utf-8 -*- import socket from time import sleep HOST = '127.0.0.1' PORT = 12345 def main(): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) startSession = bytes([ # header start 0x20, 0x07, 0x01, 0x00, # max data size 0x00, 0x00, 0x00, 0x00, # message ID 0x00, 0x00, 0x00, 0x00, ]) registerApp = bytes([ 0x21, 0x07, 0x00, 0x01, 0x00, 0x00, 0x01, 0x25, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0xf9, 0x00, 0x00, 0x01, 0x19, 0x7b, 0x22, 0x6e, 0x67, 0x6e, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x41, 0x70, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x22, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x22, 0x2c, 0x22, 0x61, 0x70, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x22, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x54, 0x65, 0x73, 0x74, 0x65, 0x72, 0x22, 0x2c, 0x22, 0x76, 0x72, 0x53, 0x79, 0x6e, 0x6f, 0x6e, 0x79, 0x6d, 0x73, 0x22, 0x3a, 0x5b, 0x22, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x54, 0x65, 0x73, 0x74, 0x65, 0x72, 0x22, 0x5d, 0x2c, 0x22, 0x68, 0x6d, 0x69, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x44, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x22, 0x3a, 0x22, 0x45, 0x4e, 0x2d, 0x55, 0x53, 0x22, 0x2c, 0x22, 0x69, 0x73, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x22, 0x73, 0x79, 0x6e, 0x63, 0x4d, 0x73, 0x67, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x7b, 0x22, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x32, 0x2c, 0x22, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x61, 0x70, 0x70, 0x48, 0x4d, 0x49, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x5b, 0x22, 0x4e, 0x41, 0x56, 0x49, 0x47, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x22, 0x5d, 0x2c, 0x22, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x44, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x22, 0x3a, 0x22, 0x45, 0x4e, 0x2d, 0x55, 0x53, 0x22, 0x2c, 0x22, 0x61, 0x70, 0x70, 0x49, 0x44, 0x22, 0x3a, 0x22, 0x38, 0x36, 0x37, 0x35, 0x33, 0x30, 0x38, 0x22, 0x7d ]) zeroLenRegisterApp = bytes([ 0x21, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 ]) s.sendall(startSession) sleep(1) s.sendall(registerApp) sleep(1) s.sendall(zeroLenRegisterApp) sleep(1) rndfile = open("/dev/urandom","rb") while True: s.sendall(rndfile.read(1024)) s.close() if __name__ == '__main__': main()