-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to receive only one protocol message? #178
Comments
For this you can take a look at the TightReceiveAction: A layer configuration is your encoding on how TLS-Attacker should behave on a given layer, i.e. which containers it should receive or which containers it should send. To limit the receiving of only the specified messages, you can use a TightReceiveLayerConfiguration, which is just a regular receiveConfiguration that sets "isProcessTrailingContainers" to false to tell the layer that once all messages are there no further messages should be processed. |
Thanks for your quick response!! From what I understand, However, in my case, the expected message isn't known in advance. Is there still a way to receive just a single protocol message using |
Ok this we did not have before. To realize this you need to write a custom layer configuration. I would simply extend the TightReceiveLayerConfiguration class and overwrite the function
The function basically tells the layer when you are successful in the execution. In your case, if you overwrite it with:
the layer should then stop receiving once the first message is received. |
Great! |
Hello, I defined the custom layer However, I encountered an issue with the
The While it is okay to receive TCP packets corresponding a single TLS handshake message, the problem arises when I try to execute a sequence of actions like the following, in cases where the server sends multiple messages at once:
After the first action executed (receiving the ServerHello message), the remaining TCP packet data (stored in To resolve this, I modified the
Maybe TLS-Attacker's design intends to prevent parsing or processing only one valid message from a stream of received packets. I believe allowing this could be useful. What do you think about enabling the option to receive only one valid message from a batch of received packets? |
Thats a good analysis. I think the mentioned behavior also kind of prevents the tight receive action from behaving as intended. I think your patch is not enough as the second action would now receive both more containers as expected since the produced data containers did not get reset - but the general idea seems right |
I agree with your thoughts and suggestions! |
Hello,
I'm looking to implement a custom action that reads only any single protocol message.
I came across your comments on issue #177 and I believe the action for receiving just one protocol message might involve working with
LayerConfiguration
. (Is that correct?)However, I'm having trouble deeply understanding how
LayerConfiguration
andLayerStack
work.Could you provide an example or sample code that demonstrates how to receive just any single protocol message?
Thank you for providing such a great TLS library!
Thank you!
The text was updated successfully, but these errors were encountered: