Skip to content

Instantly share code, notes, and snippets.

@onpaws
Last active November 8, 2020 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onpaws/009578d25bc0986e5d209b47486db604 to your computer and use it in GitHub Desktop.
Save onpaws/009578d25bc0986e5d209b47486db604 to your computer and use it in GitHub Desktop.
View Node.js HTTPS requests inside Wireshark

How to see Node.js HTTPS requests inside Wireshark

  • Set up a env var for Node.js:

    export SSLKEYLOGFILE=~/ssl_key_log_file.log

  • Add sslkeylog to Node.js project to wire in the key

    npm i -D sslkeylog

    yarn add sslkeylog

  • import and init sslkeylog in your test driver (or whereever you're making requests)

    import sslkeylog from 'sslkeylog';
    // Make TLS traffic visible for Wireshark
    sslkeylog.hookAll();
    
  • Wireshark -> Preferences -> Protocols -> TLS (or SSL) -> (Pre) Master secret log filename -> point to ssl_key_log_file.log

@onpaws
Copy link
Author

onpaws commented Nov 8, 2020

An alternative way to see what the client sends is to use netcat:

nc -l 8080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment