This page defines the HELLOWORLD protocol for which a basic dissector module will be created for.
helloworldstarts (16 byte protocol string)
<Message to be sent> (8 byte message)
helloworldending (16 byte protocol string)
TCP socket connection:
helloworldstarts<Message to be sent>helloworldending
Example:
- Client makes a TCP connection to Server - Client sends a HELLOWORLD protocol message containing the 8 byte message "hiserver" actual bytes sent: helloworldstartshiserverhelloworldending - TCP connection is closed
#!/usr/bin/env python # Python Message Sender import socket HOST = '192.168.202.1' # The remote host PORT = 2233 # The same port as used by the server s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) s.send(bytes("helloworldstartsmessage1helloworldending", 'ascii')) #data = s.recv(1024) print('message sent\n') s.close()
#!/usr/bin/env python # Python Message Receiver import socket HOST = '' # Symbolic name meaning the local host PORT = 2233 # Arbitrary non-privileged port s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((HOST, PORT)) s.listen(1) conn, addr = s.accept() print('Connected by', addr) data = conn.recv(40) print('Data: ' + data) print('Message: ' + data[16:24:1]) conn.close()