Skip to content

Commit

Permalink
Fix ssl-error handling (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
SR4ven authored Dec 9, 2019
1 parent 1e26ab9 commit 8a7521c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions boofuzz/socket_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,9 @@ def recv(self, max_bytes):
raise exception.SullyRuntimeError("INVALID PROTOCOL SPECIFIED: %s" % self.proto)
except socket.timeout:
data = b""
except ssl.SSLError as e:
# If an SSL error is thrown the connection should be treated as lost
raise_(exception.BoofuzzSSLError(e.reason))
except socket.error as e:
if e.errno == errno.ECONNABORTED:
raise_(
Expand All @@ -254,9 +257,6 @@ def recv(self, max_bytes):
data = b""
else:
raise
except ssl.SSLError as e:
# If an SSL error is thrown the connection should be treated as lost
raise_(exception.BooFuzzSSLError(e.reason))

return data

Expand Down Expand Up @@ -305,6 +305,9 @@ def send(self, data):
num_sent = self._sock.sendto(data, (self.host, self.ethernet_proto, 0, 0, self.l2_dst))
else:
raise exception.SullyRuntimeError("INVALID PROTOCOL SPECIFIED: %s" % self.proto)
except ssl.SSLError as e:
# If an SSL error is thrown the connection should be treated as lost
raise_(exception.BoofuzzSSLError(e.reason))
except socket.error as e:
if e.errno == errno.ECONNABORTED:
raise_(
Expand All @@ -321,9 +324,6 @@ def send(self, data):
raise_(exception.BoofuzzTargetConnectionReset(), None, sys.exc_info()[2])
else:
raise
except ssl.SSLError as e:
# If an SSL error is thrown the connection should be treated as lost
raise_(exception.BooFuzzSSLError(e.reason))

return num_sent

Expand Down

0 comments on commit 8a7521c

Please sign in to comment.