Skip to content

Commit

Permalink
TLSv1.2 versions of MaxFragmentNull probe
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato42 committed Aug 27, 2016
1 parent b9cc0a9 commit 1596c0e
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
2 changes: 2 additions & 0 deletions prober.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
SecureRenegoNull12(),
SecureRenegoNull12PFS(),
MaxFragmentNull(),
MaxFragmentNull12(),
MaxFragmentNull12PFS(),
MaxFragmentInvalid(),
ClientCertURLsNotNull(),
TrustedCANull(),
Expand Down
10 changes: 10 additions & 0 deletions probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,16 @@ def test(self, sock):
sock.write(self.make_fragment_hello(''))


class MaxFragmentNull12(MaxFragmentNull, NormalHandshake12):
'''As with MaxFragmentNull, but in TLSv1.2 hello'''
pass


class MaxFragmentNull12PFS(MaxFragmentNull, NormalHandshake12PFS):
'''As with MaxFragmentNull, but in PFS TLSv1.2 hello'''
pass


class MaxFragmentInvalid(MaxFragmentNull):
'''Send maximum fragment length extension with invalid value'''

Expand Down
41 changes: 41 additions & 0 deletions tests/test_probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1600,6 +1600,47 @@ def test_test(self):
b'\x00\x01\x00\x00'])


class TestMaxFragmentNull12(unittest.TestCase):
def test_test(self):
probe = MaxFragmentNull12()
sock = MockSock()

probe.test(sock)

self.assertEqual(sock.sent_data,
[b'\x16\x03\x01\x00W'
b'\x01\x00\x00S'
b'\x03\x03' +
RANDOM_STR +
b'\x00'
b'\x00&' +
DEFAULT_12_CIPHERS_STR +
b'\x01\x00'
b'\x00\x04'
b'\x00\x01\x00\x00'])


class TestMaxFragmentNull12PFS(unittest.TestCase):
def test_test(self):
probe = MaxFragmentNull12PFS()
sock = MockSock()

probe.test(sock)

self.maxDiff = None
self.assertEqual(sock.sent_data,
[b"\x16\x03\x01\x00\x8f"
b"\x01\x00\x00\x8b"
b"\x03\x03" +
RANDOM_STR +
b"\x00"
b"\x00^" +
DEFAULT_PFS_CIPHERS_STR +
b"\x01\x00"
b'\x00\x04'
b'\x00\x01\x00\x00'])


class TestMaxFragmentInvalid(unittest.TestCase):
def test_test(self):
probe = MaxFragmentInvalid()
Expand Down

0 comments on commit 1596c0e

Please sign in to comment.