Skip to content

Commit

Permalink
TLSv1.2 versions of SNIDifferentTypeRev probe
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato42 committed Aug 27, 2016
1 parent 92a56a6 commit 5759114
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
2 changes: 2 additions & 0 deletions prober.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@
SNIWithDifferentType12(),
SNIWithDifferentType12PFS(),
SNIDifferentTypeRev(),
SNIDifferentTypeRev12(),
SNIDifferentTypeRev12PFS(),
SNIOverflow(),
SNIUnderflow(),
SecureRenegoOverflow(),
Expand Down
10 changes: 10 additions & 0 deletions probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,16 @@ def test(self, sock):
sock.write(self.make_sni_hello(server_names))


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


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


class SNIOverflow(NormalHandshake):
'''Send server name indication with data length exceeding stated size'''

Expand Down
50 changes: 50 additions & 0 deletions tests/test_probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,56 @@ def test_test(self):
b'\x00\x00\x0bexample.com'])


class TestSNIDifferentTypeRev12(unittest.TestCase):
def test_test(self):
probe = SNIDifferentTypeRev12()
probe.ipaddress = b'example.com'
sock = MockSock()

probe.test(sock)

self.maxDiff = None
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$'
b'\x00\x00\x00 '
b'\x00\x1e'
b'\x04\x00\r<binary-data>'
b'\x00\x00\x0bexample.com'])


class TestSNIDifferentTypeRev12PFS(unittest.TestCase):
def test_test(self):
probe = SNIDifferentTypeRev12PFS()
probe.ipaddress = b'example.com'
sock = MockSock()

probe.test(sock)

self.maxDiff = None
self.assertEqual(sock.sent_data,
[b"\x16\x03\x01\x00\xaf"
b"\x01\x00\x00\xab"
b"\x03\x03" +
RANDOM_STR +
b"\x00"
b"\x00^" +
DEFAULT_PFS_CIPHERS_STR +
b"\x01\x00"
b'\x00$'
b'\x00\x00\x00 '
b'\x00\x1e'
b'\x04\x00\r<binary-data>'
b'\x00\x00\x0bexample.com'])


class TestSNIOverflow(unittest.TestCase):
def test_test(self):
probe = SNIOverflow()
Expand Down

0 comments on commit 5759114

Please sign in to comment.