Debug Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.2 KiB

  1. #!/bin/env python3
  2. import socket;
  3. import sys;
  4. def init_socket():
  5. # Create a TCP/IP socket
  6. sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  7. def check_bridge_socket():
  8. evt = None
  9. return evt
  10. def handle_bridge_evt(evt):
  11. """
  12. TODO: Whatever bridge events to handle
  13. """
  14. def check_debug_socket():
  15. dbg_evt = None
  16. return dbg_evt
  17. def handle_debug_evt(dbg_evt):
  18. """ TODO: Do something with the events here."""
  19. def run_loop():
  20. """ """
  21. while True:
  22. # 1. Check the BridgeSocket
  23. evt = check_bridge_socket()
  24. if evt != None:
  25. handle_bridge_evt(evt)
  26. dbg_evt = check_debug_socket()
  27. if dbg_evt != None:
  28. handle_debug_evt(dbg_evt)
  29. def main():
  30. """
  31. 1. TODO: Open Server port that the device connects to.
  32. 2. TODO: Open Server port that an admin connects to, i.e., to test sending packets to
  33. 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)
  34. and then add these functions. That way the person in debugging the phone can do live testing.
  35. """
  36. if __name__ == '__main__':
  37. main()