Skip to content

Instantly share code, notes, and snippets.

@khun84
khun84 / wireshark.md
Created October 21, 2021 20:17 — forked from EddiG/wireshark.md
How to decrypt SSL/TLS traffic in Wireshark on MacOS

The main point is to save the SSL/TLS keys those used by the web browser (SSLKEYLOGFILE=/tmp/tmp-google/.ssl-key.log).
In the example below we run brand new instance of Google Chrome (--user-data-dir=/tmp/tmp-google do the trick):
SSLKEYLOGFILE=/tmp/tmp-google/.ssl-key.log /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir=/tmp/tmp-google
Then run the Wireshark and open the Preferences -> Protocols -> SSL, where we put the path to the SSL keys log file into the (Pre)-Master-Secret log filename field.
Now all SSL/TLS traffic from this browser instance will be decrypted.

@khun84
khun84 / README.md
Created October 21, 2021 20:17 — forked from felixhammerl/README.md
Write TLS keys system-wide in macOS via SSLKEYLOGFILE and launchd
  1. Put tlskeylogger.plist at ~/Library/LaunchAgents/tlskeylogger.plist
  2. launchctl load ~/Library/LaunchAgents/tlskeylogger.plist, so it will load on the next restart
  3. launchctl start ~/Library/LaunchAgents/tlskeylogger.plist, so it will load the environment variable immediately
  4. Restart your browser(s)
  5. See how TLS keys are being written to ~/.tlskeyfile via tail -f ~/.tlskeyfile
@khun84
khun84 / download_file.rb
Last active August 20, 2022 06:29 — forked from daipresents/example1
Ruby rest-client file upload as multipart
filepath = 'local-filepath'
url = 'web-url'
File.open(filepath, 'w') {|f|
block = proc { |response|
response.read_body do |chunk|
puts "Working on response"
f.write chunk
end
}
RestClient::Request.new(method: :get, url: url, block_response: block).execute
@khun84
khun84 / README.md
Created March 1, 2019 15:52 — forked from magnetikonline/README.md
Mac OS X - SSH client host autocomplete.

Mac OS X SSH client autocomplete for hosts

Snippet for ~/.bash_profile, adding hostname autocomplete to ssh.

Extracts host hints from both ~/.ssh/config and /etc/hosts.

function __completeSSHHosts {
	COMPREPLY=()
	local currentWord=${COMP_WORDS[COMP_CWORD]}
	local completeHosts=$(
@khun84
khun84 / encryption-decryption.rb
Created May 7, 2018 11:29 — forked from gevans/encryption-decryption.rb
A couple examples of using asymmetric RSA signing and encryption using Ruby's OpenSSL libraries.
require 'openssl'
key = OpenSSL::PKey::RSA.new(2048)
p encrypted_string = key.public_encrypt('my plaintext string', OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING)
p decrypted_string = key.private_decrypt(encrypted_string, OpenSSL::PKey::RSA::PKCS1_OAEP_PADDING)