Skip to content

Commit

Permalink
Merge pull request #623 from tlsfuzzer/print-received
Browse files Browse the repository at this point in the history
allow logging of received data in AppData
  • Loading branch information
tomato42 committed Apr 16, 2021
2 parents 4fd9acc + 6bdf7e6 commit 200dddb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tlsfuzzer/expect.py
Original file line number Diff line number Diff line change
Expand Up @@ -1791,11 +1791,12 @@ def process(self, state, msg):
class ExpectApplicationData(Expect):
"""Processing Application Data message"""

def __init__(self, data=None, size=None):
def __init__(self, data=None, size=None, output=None):
super(ExpectApplicationData, self).\
__init__(ContentType.application_data)
self.data = data
self.size = size
self.output = output

def process(self, state, msg):
assert msg.contentType == ContentType.application_data
Expand All @@ -1806,6 +1807,10 @@ def process(self, state, msg):
if self.size and len(data) != self.size:
raise AssertionError("ApplicationData of unexpected size: {0}, "
"expected: {1}".format(len(data), self.size))
if self.output:
self.output.write("ExpectApplicationData received payload:\n")
self.output.write(data)
self.output.write("ExpectApplicationData end of payload.\n")


class ExpectHeartbeat(ExpectMessage):
Expand Down

0 comments on commit 200dddb

Please sign in to comment.