3

I want to create a directory and put all the key logs into it. There are 2 issues. No key files are generated no matter what location i give. Also the log files have to be in the Date folder(~/Users/Sam/Date/key.log). Since the folder is just created, how to specify the path? '''

Date="$(date)"
mkdir -p -- "$Date"
cd "$Date" 
export SSLKEYLOGFILE="~/Desktop/key.log" 
open /Applications/Google\ Chrome.app

2 Answers2

3

SSLKEYLOG VARIABLE

Your first issue might have something to do with the location that your SSLKEYLOGFILE variable is pointing to. For me it did not work if I put that file on the Desktop so I did:

export SSLKEYLOGFILE=~/Documents/sslkeylog.log

This did generate keylogs for me when running a new instance (by using the -n parameter) of the Firefox Developer Version:

open -n /Applications/Firefox\ Developer\ Edition.app

I'm not sure if Google Chrome supports saving SSL Key logs out of the box so you might want to try Firefox Developer Edition.

Date Folder

Since the third step in your script runs cd "$Date", you are currently in that folder. Therefore you could try to use the $PWD variable to grab the current directory for your SSLKEYLOGFILE.

Summary

Your script would then become:

Date="$(date)"
mkdir -p -- "$Date"
cd "$Date" 
export SSLKEYLOGFILE=$PWD/keylog.log
open -n /Applications/Google\ Chrome.app

Or use Firefox:

Date="$(date)"
mkdir -p -- "$Date"
cd "$Date" 
export SSLKEYLOGFILE=$PWD/keylog.log
open -n /Applications/Firefox\ Developer\ Edition.app

I hope this helped you on your way.

Poocsed
  • 39
  • 2
2

All the hacks with export only work in an interactive non-login shell, when you launch your browser from this shell session, but they will not work when you just open the browser regularly, as (obviously) you shell configuration is not loaded then.

Answer: You need to use launchd to set the environment variable system-wide and restart your browser. Here's how this works: https://gist.github.com/felixhammerl/61e096924af34e91b43a930f36d3e1f9