Skip to content

Feat: Add SSLKEYLOGFILE dumping #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/keyfinder/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import shutil
import subprocess
import time
from tempfile import NamedTemporaryFile
from datetime import datetime
from typing import Dict, List, Tuple, Union

from src.keyfinder.tshark_keytester import TsharkKeyTester
Expand Down Expand Up @@ -323,8 +323,8 @@ def get_command_sha256(self, command: str) -> Union[str, None]:

return binary_hash

@staticmethod
def edit_pcap(
self,
dump_file: str,
ssl_key_log_file_content: str,
capture_comment: str) -> None:
Expand All @@ -335,8 +335,8 @@ def edit_pcap(
os.environ.get("CUSTOM_WIRESHARK_BIN_PATH", "/opt/wireshark-custom/bin"),
"editcap"
)
with NamedTemporaryFile(buffering=0) as keylog:
keylog.write(ssl_key_log_file_content.encode("ascii"))
with open(os.path.join(self.dump_directory, os.environ.get("SSLKEYLOG_FILENAME", f"{datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}_sslkeylogfile")), "wt") as keylog:
_ = keylog.write(ssl_key_log_file_content)
try:
subprocess.run(
[
Expand Down