Skip to content

Commit

Permalink
add probes for srp extension from RFC 5054
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato42 committed Aug 27, 2016
1 parent eb163e0 commit 8d51ada
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
8 changes: 7 additions & 1 deletion prober.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,13 @@
ECPointFormatsOverflow12PFS(),
ECPointFormatsCompOnly(),
ECPointFormatsCompOnly12(),
ECPointFormatsCompOnly12PFS()
ECPointFormatsCompOnly12PFS(),
SRPNull(),
SRPNull12(),
SRPNull12PFS(),
SRPOverflow(),
SRPOverflow12(),
SRPOverflow12PFS()
]

def probe(ipaddress, port, starttls, specified_probe):
Expand Down
44 changes: 44 additions & 0 deletions probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1884,3 +1884,47 @@ class ECPointFormatsCompOnly12PFS(ECPointFormatsCompOnly,
NormalHandshake12PFS):
'''As with ECPointFormatsCompOnly but in PFS TLS v1.2 hello'''
pass


class SRPNull(NormalHandshake):
'''Send empty srp extension in hello'''

def make_srp_hello(self, value):
srp_ext = Extension.create(
extension_type=12,
data=value)
return self.make_hello([srp_ext])

def test(self, sock):
logging.debug('Sending Client Hello...')
# normally the extension has client's identity, don't include any
sock.write(self.make_srp_hello(b''))


class SRPNull12(SRPNull, NormalHandshake12):
'''Send empty srp extension in TLSv1.2 hello'''
pass


class SRPNull12PFS(SRPNull, NormalHandshake12PFS):
'''Send empty srp extension in PFS TLSv1.2 hello'''
pass


class SRPOverflow(SRPNull):
'''Send srp extension with too large length in hello'''

def test(self, sock):
logging.debug('Sending Client Hello...')
# first byte is the length, send too large
sock.write(self.make_srp_hello(b'\x06test'))


class SRPOverflow12(SRPOverflow, NormalHandshake12):
'''Send srp extension with too large length in TLSv1.2 hello'''
pass


class SRPOverflow12PFS(SRPOverflow, NormalHandshake12PFS):
'''Send srp extension with too large length in PFS TLSv1.2 hello'''
pass

0 comments on commit 8d51ada

Please sign in to comment.