From 5e60c3e54081d6e1efc0bcc3492dc67a27f488c1 Mon Sep 17 00:00:00 2001 From: End Date: Tue, 11 Aug 2020 00:24:08 +0200 Subject: [PATCH] state machine --- mitmaddon/littlesnitch.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mitmaddon/littlesnitch.py b/mitmaddon/littlesnitch.py index 94c6a17..3eb833e 100644 --- a/mitmaddon/littlesnitch.py +++ b/mitmaddon/littlesnitch.py @@ -6,6 +6,7 @@ from queue import Queue, Empty import time import zmq import json +from enum import Enum NO_MSG = {"msg": None} INIT_MSG = {"msg": "init"} @@ -13,6 +14,12 @@ ACK_MSG = {"msg": "ack"} PING_MSG = {"msg": "ping"} PONG_MSG = {"msg": "pong"} +class NetworkState(Enum): + DISCONNECTED = auto() + CONNECTED = auto() + PING = auto() + SENDING = auto() + def convert_to_strings(obj): if isinstance(obj, dict): return {convert_to_strings(key): convert_to_strings(value)