#!/bin/env python3 import socket; import sys; def init_socket(): # Create a TCP/IP socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Bind the socket to the port 8000 server_address = ('localhost', 8000) sock.bind(server_address) # Listen for incoming connections sock.listen(1) def check_bridge_socket(): evt = None return evt def handle_bridge_evt(evt): """ TODO: Whatever bridge events to handle """ def check_debug_socket(): dbg_evt = None return dbg_evt def handle_debug_evt(dbg_evt): """ TODO: Do something with the events here.""" def run_loop(): """ """ while True: # 1. Check the BridgeSocket evt = check_bridge_socket() if evt != None: handle_bridge_evt(evt) dbg_evt = check_debug_socket() if dbg_evt != None: handle_debug_evt(dbg_evt) def main(): init_socket() """ 1. TODO: Open Server port that the device connects to. 2. TODO: Open Server port that an admin connects to, i.e., to test sending packets to 3. TODO (Optional): We might be able to start a Scapy [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) and then add these functions. That way the person in debugging the phone can do live testing. """ if __name__ == '__main__': main()