Skip to content

Commit

Permalink
Version: 1.2.0 -> add ssl key logging feature
Browse files Browse the repository at this point in the history
  • Loading branch information
nxenon committed Nov 5, 2024
1 parent 38a240a commit 858b144
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# <img src="https://github.com/nxenon/h2spacex/assets/61124903/fd6387bf-15e8-4a5d-816b-cf5e079e07cc" width="20%" valign="middle" alt="H2SpaceX" />&nbsp;&nbsp; H2SpaceX

[![pypi: 1.1.2](https://img.shields.io/badge/pypi-1.1.2-8c34eb.svg)](https://pypi.org/project/h2spacex/)
[![Python: 3.10](https://img.shields.io/badge/Python->=3.10-blue.svg)](https://www.python.org)
[![pypi: 1.2.0](https://img.shields.io/badge/pypi-1.2.0-8c34eb.svg)](https://pypi.org/project/h2spacex/)
[![Python: 3.8.8](https://img.shields.io/badge/Python->=3.10-blue.svg)](https://www.python.org)
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-006112.svg)](https://github.com/nxenon/h2spacex/blob/main/LICENSE)

HTTP/2 low level library based on Scapy which can be used for Single Packet Attack (Race Condition on H2)
Expand Down Expand Up @@ -63,7 +63,8 @@ from h2spacex import H2OnTlsConnection

h2_conn = H2OnTlsConnection(
hostname='http2.github.io',
port_number=443
port_number=443,
ssl_log_file_path="PATH_TO_SSL_KEYS.log" # optional (if you want to log ssl keys to read the http/2 traffic in wireshark)
)

h2_conn.setup_connection()
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ build-backend = "setuptools.build_meta"

[project]
name = "h2spacex"
version = "1.1.2"
version = "1.2.0"
authors = [
{ name="nxenon", email="nasiri.aminm@gmail.com" },
]
license = { text="GPL-3.0" }
description = "HTTP/2 Single Packet Attack low level library based on Scapy"
readme = "README.md"
keywords = ["race-condition", "http2", "single-packet-attack"]
requires-python = ">=3.10"
requires-python = ">=3.8.8"
dependencies = [
"scapy==2.5.0",
"brotlipy==0.7.0",
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='h2spacex',
version='1.1.2',
version='1.2.0',
description='HTTP/2 Single Packet Attack low level library based on Scapy',
package_dir={"": "src"},
packages=find_packages(where="src"),
Expand All @@ -21,7 +21,7 @@
"Operating System :: OS Independent",
],
install_requires=['scapy==2.5.0', 'brotlipy==0.7.0', 'PySocks==1.7.1'],
python_requires='>=3.10',
python_requires='>=3.8.8',
extras_requires={
'dev': 'twine==4.0.2'
},
Expand Down
6 changes: 5 additions & 1 deletion src/h2spacex/h2_tls_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@


class H2OnTlsConnection(H2Connection):
def __init__(self, hostname, port_number, read_timeout=3, proxy_hostname=None, proxy_port_number=None):
def __init__(self, hostname, port_number, read_timeout=3,
proxy_hostname=None, proxy_port_number=None, ssl_log_file_path=None):
super().__init__(hostname, port_number, read_timeout=read_timeout, proxy_hostname=proxy_hostname, proxy_port_number=proxy_port_number)
self.tls_socket = None # TLS Socket Context
self.ssl_log_file_path = ssl_log_file_path

def setup_connection(self):
try:
Expand Down Expand Up @@ -45,6 +47,8 @@ def close_connection(self):
def __create_tls_context_on_raw_socket(self):
# Create SSL context
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
if self.ssl_log_file_path is not None:
ssl_context.keylog_filename = self.ssl_log_file_path
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
ssl_context.set_alpn_protocols(['h2'])
Expand Down

0 comments on commit 858b144

Please sign in to comment.