diff --git a/twnet_parser/messages6/control/accept.py b/twnet_parser/messages6/control/accept.py index 05abed4..42716da 100644 --- a/twnet_parser/messages6/control/accept.py +++ b/twnet_parser/messages6/control/accept.py @@ -7,6 +7,11 @@ class CtrlAccept(PrettyPrint): self.message_name: str = 'accept' self.message_id: int = 3 + def __iter__(self): + yield 'message_type', self.message_type + yield 'message_name', self.message_name + yield 'message_id', self.message_id + def unpack(self, data: bytes, we_are_a_client: bool = True) -> bool: return False diff --git a/twnet_parser/messages6/control/close.py b/twnet_parser/messages6/control/close.py index 68b548c..d943caa 100644 --- a/twnet_parser/messages6/control/close.py +++ b/twnet_parser/messages6/control/close.py @@ -15,6 +15,13 @@ class CtrlClose(PrettyPrint): self.reason: Optional[str] = reason + def __iter__(self): + yield 'message_type', self.message_type + yield 'message_name', self.message_name + yield 'message_id', self.message_id + + yield 'reason', self.reason + # first byte of data # has to be the first byte of the message payload # NOT the chunk header and NOT the message id diff --git a/twnet_parser/messages6/control/connect.py b/twnet_parser/messages6/control/connect.py index 3a188a4..1b3beb8 100644 --- a/twnet_parser/messages6/control/connect.py +++ b/twnet_parser/messages6/control/connect.py @@ -19,6 +19,13 @@ class CtrlConnect(PrettyPrint): self.response_token: bytes = response_token + def __iter__(self): + yield 'message_type', self.message_type + yield 'message_name', self.message_name + yield 'message_id', self.message_id + + yield 'response_token', self.response_token + def unpack(self, data: bytes, we_are_a_client: bool = True) -> bool: # anti reflection attack if len(data) < 512: diff --git a/twnet_parser/messages6/control/connect_accept.py b/twnet_parser/messages6/control/connect_accept.py index 478c948..dc288d9 100644 --- a/twnet_parser/messages6/control/connect_accept.py +++ b/twnet_parser/messages6/control/connect_accept.py @@ -18,6 +18,13 @@ class CtrlConnectAccept(PrettyPrint): self.response_token: bytes = response_token + def __iter__(self): + yield 'message_type', self.message_type + yield 'message_name', self.message_name + yield 'message_id', self.message_id + + yield 'response_token', self.response_token + def unpack(self, data: bytes, we_are_a_client: bool = True) -> bool: self.response_token = data[0:4] return True diff --git a/twnet_parser/messages6/control/keep_alive.py b/twnet_parser/messages6/control/keep_alive.py index 1de62fe..9f0659d 100644 --- a/twnet_parser/messages6/control/keep_alive.py +++ b/twnet_parser/messages6/control/keep_alive.py @@ -7,6 +7,11 @@ class CtrlKeepAlive(PrettyPrint): self.message_name: str = 'keep_alive' self.message_id: int = 0 + def __iter__(self): + yield 'message_type', self.message_type + yield 'message_name', self.message_name + yield 'message_id', self.message_id + def unpack(self, data: bytes, we_are_a_client: bool = True) -> bool: return False diff --git a/twnet_parser/messages6/control/token.py b/twnet_parser/messages6/control/token.py index 8925774..220ae02 100644 --- a/twnet_parser/messages6/control/token.py +++ b/twnet_parser/messages6/control/token.py @@ -12,6 +12,14 @@ class CtrlToken(PrettyPrint): self.response_token: bytes = response_token + def __iter__(self): + yield 'message_type', self.message_type + yield 'message_name', self.message_name + yield 'message_id', self.message_id + + yield 'response_token', self.response_token + + def unpack(self, data: bytes, we_are_a_client: bool = True) -> bool: if not we_are_a_client: # anti reflection attack diff --git a/twnet_parser/messages7/control/accept.py b/twnet_parser/messages7/control/accept.py index 5265ef6..0cba375 100644 --- a/twnet_parser/messages7/control/accept.py +++ b/twnet_parser/messages7/control/accept.py @@ -7,6 +7,11 @@ class CtrlAccept(PrettyPrint): self.message_name: str = 'accept' self.message_id: int = 2 + def __iter__(self): + yield 'message_type', self.message_type + yield 'message_name', self.message_name + yield 'message_id', self.message_id + def unpack(self, data: bytes, we_are_a_client: bool = True) -> bool: return False diff --git a/twnet_parser/messages7/control/close.py b/twnet_parser/messages7/control/close.py index 68b548c..d943caa 100644 --- a/twnet_parser/messages7/control/close.py +++ b/twnet_parser/messages7/control/close.py @@ -15,6 +15,13 @@ class CtrlClose(PrettyPrint): self.reason: Optional[str] = reason + def __iter__(self): + yield 'message_type', self.message_type + yield 'message_name', self.message_name + yield 'message_id', self.message_id + + yield 'reason', self.reason + # first byte of data # has to be the first byte of the message payload # NOT the chunk header and NOT the message id diff --git a/twnet_parser/messages7/control/connect.py b/twnet_parser/messages7/control/connect.py index e3cbe6e..3ea4777 100644 --- a/twnet_parser/messages7/control/connect.py +++ b/twnet_parser/messages7/control/connect.py @@ -12,6 +12,13 @@ class CtrlConnect(PrettyPrint): self.response_token: bytes = response_token + def __iter__(self): + yield 'message_type', self.message_type + yield 'message_name', self.message_name + yield 'message_id', self.message_id + + yield 'response_token', self.response_token + def unpack(self, data: bytes, we_are_a_client: bool = True) -> bool: # anti reflection attack if len(data) < 512: diff --git a/twnet_parser/messages7/control/keep_alive.py b/twnet_parser/messages7/control/keep_alive.py index 1de62fe..9f0659d 100644 --- a/twnet_parser/messages7/control/keep_alive.py +++ b/twnet_parser/messages7/control/keep_alive.py @@ -7,6 +7,11 @@ class CtrlKeepAlive(PrettyPrint): self.message_name: str = 'keep_alive' self.message_id: int = 0 + def __iter__(self): + yield 'message_type', self.message_type + yield 'message_name', self.message_name + yield 'message_id', self.message_id + def unpack(self, data: bytes, we_are_a_client: bool = True) -> bool: return False diff --git a/twnet_parser/messages7/control/token.py b/twnet_parser/messages7/control/token.py index 8925774..0e25ca2 100644 --- a/twnet_parser/messages7/control/token.py +++ b/twnet_parser/messages7/control/token.py @@ -12,6 +12,13 @@ class CtrlToken(PrettyPrint): self.response_token: bytes = response_token + def __iter__(self): + yield 'message_type', self.message_type + yield 'message_name', self.message_name + yield 'message_id', self.message_id + + yield 'response_token', self.response_token + def unpack(self, data: bytes, we_are_a_client: bool = True) -> bool: if not we_are_a_client: # anti reflection attack