Unverified Commit db145aaf by Marcin Bury Committed by GitHub

OpenSSL Heartbleed module (#409)

* Init heartbleed fixes

* Improving description

* Adding certificate parsing
parent a0d7e4ca
......@@ -54,6 +54,9 @@ class OptPort(Option):
raise OptionValidationError("Invalid option. Port value should be between 0 and 65536.")
except ValueError:
raise OptionValidationError("Invalid option. Cannot cast '{}' to integer.".format(value))
def __get__(self, instance, owner):
return int(self.value)
class OptBool(Option):
......
......@@ -36,8 +36,9 @@ class TCPClient(Exploit):
print_status("Connection established")
return tcp_client
except Exception:
except Exception as err:
print_error("Could not connect")
print_error(err)
return None
......@@ -45,18 +46,22 @@ class TCPClient(Exploit):
if tcp_client:
if type(data) is bytes:
return tcp_client.send(data)
elif type(data) is str:
return tcp_client.send(bytes(data, "utf-8"))
else:
print_error("Data to send is not type of bytes or string")
print_error("Data to send is not type of bytes")
return None
def tcp_recv(self, tcp_client, num):
if tcp_client:
try:
response = tcp_client.recv(num)
return str(response, "utf-8")
response = b""
received = 0
while received < num:
tmp = tcp_client.recv(num - received)
received += len(tmp)
response += tmp
return response
except socket.timeout:
print_error("Socket did timeout")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment