def unpack_handshake(pay):
 paylen = len(pay)
 offset = 0
 payarr = []
 while (offset < paylen):
  h = pay[offset:(offset + 4)]
  (t, l24) = struct.unpack('>B3s', h)
  l = struct.unpack('>I', ('\x00' + l24))[0]
  payarr.append((t, l, pay[(offset + 4):((offset + 4) + l)]))
  offset = ((offset + l) + 4)
 return payarr

def unpack_handshake ( pay ) : paylen = len ( pay ) offset = 0 payarr = [ ] while ( offset < paylen ) : h = pay [ offset : ( offset + 4 ) ] ( t , l24 ) = struct . unpack ( '>B3s' , h ) l = struct . unpack ( '>I' , ( '\x00' + l24 ) ) [ 0 ] payarr . append ( ( t , l , pay [ ( offset + 4 ) : ( ( offset + 4 ) + l ) ] ) ) offset = ( ( offset + l ) + 4 ) return payarr
unpack the ssl handshake in multiple handshake message .