Skip to content

Commit

Permalink
updated ssl wrap_socket function
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Luis Verdeguer authored and Jose Luis Verdeguer committed Apr 25, 2024
1 parent 2db69f8 commit 21c9bda
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 22 deletions.
8 changes: 6 additions & 2 deletions src/sippts/sipdigestleak.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,12 @@ def call(self, ip, port, proto):
sock.connect(host)

if self.proto == 'TLS':
sock_ssl = ssl.wrap_socket(
sock, ssl_version=ssl.PROTOCOL_TLS, ciphers='DEFAULT', cert_reqs=ssl.CERT_NONE)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
context.load_default_certs()

sock_ssl = context.wrap_socket(sock, server_hostname=str(host[0]))
sock_ssl.connect(host)
sock_ssl.sendall(bytes(msg[:8192], 'utf-8'))
else:
Expand Down
8 changes: 6 additions & 2 deletions src/sippts/sipenumerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,12 @@ def send(self, method):
sock.connect(host)

if self.proto == 'TLS':
sock_ssl = ssl.wrap_socket(
sock, ssl_version=ssl.PROTOCOL_TLS, ciphers='DEFAULT', cert_reqs=ssl.CERT_NONE)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
context.load_default_certs()

sock_ssl = context.wrap_socket(sock, server_hostname=str(host[0]))
sock_ssl.connect(host)
except:
print('Socket connection error')
Expand Down
8 changes: 6 additions & 2 deletions src/sippts/sipexten.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,12 @@ def scan_host(self, ipaddr, to_user):
sock.connect(host)

if self.proto == 'TLS':
sock_ssl = ssl.wrap_socket(
sock, ssl_version=ssl.PROTOCOL_TLS, ciphers='DEFAULT', cert_reqs=ssl.CERT_NONE)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
context.load_default_certs()

sock_ssl = context.wrap_socket(sock, server_hostname=str(host[0]))
sock_ssl.connect(host)
sock_ssl.sendall(bytes(msg[:8192], 'utf-8'))
else:
Expand Down
8 changes: 6 additions & 2 deletions src/sippts/sipflood.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,12 @@ def flood(self):
sock.connect(host)

if self.proto == 'TLS':
sock_ssl = ssl.wrap_socket(
sock, ssl_version=ssl.PROTOCOL_TLS, ciphers='DEFAULT', cert_reqs=ssl.CERT_NONE)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
context.load_default_certs()

sock_ssl = context.wrap_socket(sock, server_hostname=str(host[0]))
sock_ssl.connect(host)
except:
# print(self.c.RED + '\nSocket connection error\n' + self.c.WHITE)
Expand Down
16 changes: 12 additions & 4 deletions src/sippts/sipfuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,12 @@ def ping(self):
sock.connect(host)

if self.proto == 'TLS':
sock_ssl = ssl.wrap_socket(
sock, ssl_version=ssl.PROTOCOL_TLS, ciphers=None, cert_reqs=ssl.CERT_NONE)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
context.load_default_certs()

sock_ssl = context.wrap_socket(sock, server_hostname=str(host[0]))
sock_ssl.connect(host)

ping = create_message('OPTIONS', '', self.ip, '100', '', self.ip, '100', '', self.ip,
Expand Down Expand Up @@ -224,8 +228,12 @@ def fuzz(self):
sock.connect(host)

if self.proto == 'TLS':
sock_ssl = ssl.wrap_socket(
sock, ssl_version=ssl.PROTOCOL_TLS, ciphers=None, cert_reqs=ssl.CERT_NONE)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
context.load_default_certs()

sock_ssl = context.wrap_socket(sock, server_hostname=str(host[0]))
sock_ssl.connect(host)

while self.quit == False:
Expand Down
8 changes: 6 additions & 2 deletions src/sippts/sipinvite.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,12 @@ def invite(self, fw, src, dst):
sock.connect(host)

if self.proto == 'TLS':
sock_ssl = ssl.wrap_socket(
sock, ssl_version=ssl.PROTOCOL_TLS, ciphers=None, cert_reqs=ssl.CERT_NONE)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
context.load_default_certs()

sock_ssl = context.wrap_socket(sock, server_hostname=str(host[0]))
sock_ssl.connect(host)

try:
Expand Down
8 changes: 6 additions & 2 deletions src/sippts/sipping.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,12 @@ def start(self):
sock.connect(host)

if self.proto == 'TLS':
sock_ssl = ssl.wrap_socket(
sock, ssl_version=ssl.PROTOCOL_TLS, ciphers='DEFAULT', cert_reqs=ssl.CERT_NONE)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
context.load_default_certs()

sock_ssl = context.wrap_socket(sock, server_hostname=str(host[0]))
sock_ssl.connect(host)
except socket.timeout:
print(self.c.RED +
Expand Down
8 changes: 6 additions & 2 deletions src/sippts/siprcrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,12 @@ def register(self, ip, to_user, pwd):
sock.connect(host)

if self.proto == 'TLS':
sock_ssl = ssl.wrap_socket(
sock, ssl_version=ssl.PROTOCOL_TLS, ciphers='DEFAULT', cert_reqs=ssl.CERT_NONE)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
context.load_default_certs()

sock_ssl = context.wrap_socket(sock, server_hostname=str(host[0]))
sock_ssl.connect(host)
sock_ssl.sendall(bytes(msg[:8192], 'utf-8'))
else:
Expand Down
8 changes: 6 additions & 2 deletions src/sippts/sipscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,12 @@ def scan_host(self, ipaddr, port, proto):
sock.connect(host)

if proto == 'TLS':
sock_ssl = ssl.wrap_socket(
sock, ssl_version=ssl.PROTOCOL_TLS, ciphers='DEFAULT', cert_reqs=ssl.CERT_NONE)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
context.load_default_certs()

sock_ssl = context.wrap_socket(sock, server_hostname=str(host[0]))
sock_ssl.connect(host)
sock_ssl.sendall(bytes(msg[:8192], 'utf-8'))
else:
Expand Down
8 changes: 6 additions & 2 deletions src/sippts/sipsend.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,12 @@ def start(self):
sock.connect(host)

if self.proto == 'TLS':
sock_ssl = ssl.wrap_socket(
sock, ssl_version=ssl.PROTOCOL_TLS, ciphers='DEFAULT', cert_reqs=ssl.CERT_NONE)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
context.load_default_certs()

sock_ssl = context.wrap_socket(sock, server_hostname=str(host[0]))
sock_ssl.connect(host)
sock_ssl.sendall(bytes(msg[:8192], 'utf-8'))
else:
Expand Down

0 comments on commit 21c9bda

Please sign in to comment.