-
-
Save amorphid/db037f03246962959b6a034b2ca3ef1b to your computer and use it in GitHub Desktop.
Leaky Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# demo that command line environment variables are leaky | |
# | |
# 1. copy this gist into a file called leady_script.rb | |
# 2. make it executable => $ chmod +x leady_script.rb | |
# 3. run it w/ an environment variable => $ SECRET="My PIN code is 12345" ./leaky_script.rb | |
# 4. in another window, find pid for script => $ ps -ef | grep leaky_script | |
# 5. find environment variables: | |
# * On a mac => $ ps eww <pid> | |
# * On Linux => $ cat /proc/<pid>/environ | |
loop do | |
puts "Your $SECRET is safe with me!" | |
sleep 5 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment