Skip to content

Commit

Permalink
Merge pull request #4 from coderm4ster/master
Browse files Browse the repository at this point in the history
Fix - IndexError: list index out of range
  • Loading branch information
doomedraven authored Oct 30, 2023
2 parents 60d4f47 + 48f2328 commit 86c13da
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions httpreplay/smegma.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,15 +487,15 @@ def state_init(self, s, ts):
self.client_hello = self.parse_record(self.sent.pop(0))
self.server_hello = self.parse_record(self.recv.pop(0))

if not isinstance(self.client_hello.data, dpkt.ssl.TLSClientHello):
if not hasattr(self.client_hello, "data") or not isinstance(self.client_hello.data, dpkt.ssl.TLSClientHello):
log.info(
"Stream %s:%d -> %s:%d doesn't appear to be a proper TLS "
"stream (perhaps the client is outdated), skipping it.", *s
)
self.state = "done"
return

if not isinstance(self.server_hello.data, dpkt.ssl.TLSServerHello):
if not hasattr(self.server_hello, "data") or not isinstance(self.server_hello.data, dpkt.ssl.TLSServerHello):
log.info(
"Stream %s:%d -> %s:%d doesn't appear to be a proper TLS "
"stream (perhaps the server is outdated), skipping it.", *s
Expand Down Expand Up @@ -598,9 +598,9 @@ def state_stream(self, s, ts):
ts,
)

if not isinstance(sent[0], bytes):
if sent and not isinstance(sent[0], bytes):
sent = [ord(c) if len(c) != 0 else b"" for c in sent]
if not isinstance(recv[0], bytes):
if recv and not isinstance(recv[0], bytes):
recv = [ord(c) if len(c) != 0 else b"" for c in recv]
ja3, ja3s, ja3_p, ja3s_p = None, None, None, None
try:
Expand Down

0 comments on commit 86c13da

Please sign in to comment.