Skip to content

Commit

Permalink
Fixed wrap_socket
Browse files Browse the repository at this point in the history
  • Loading branch information
giga-a authored Sep 12, 2024
1 parent cf07da5 commit d452b94
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions honeypots/elastic_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from contextlib import suppress
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
from json import dumps
from ssl import wrap_socket
from ssl import SSLContext, PROTOCOL_TLS_SERVER
from urllib.parse import urlparse
from zlib import compressobj, DEFLATED

Expand Down Expand Up @@ -312,10 +312,10 @@ def get_auth_key(self):
with create_certificate() as (cert, key):
server = CustomElasticServer((self.ip, self.port))
server.set_auth_key(self.username, self.password)
server.socket = wrap_socket(
ctx = SSLContext(PROTOCOL_TLS_SERVER)
ctx.load_cert_chain(certfile=cert, keyfile=key)
server.socket = ctx.wrap_socket(
server.socket,
keyfile=key,
certfile=cert,
server_side=True,
)
server.serve_forever()
Expand Down

0 comments on commit d452b94

Please sign in to comment.