Created
January 28, 2014 20:13
-
-
Save yanatan16/8675360 to your computer and use it in GitHub Desktop.
Stripe CTF 3 blog post
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 | |
# Our test cases will always use the same dictionary file (with SHA1 | |
# 6b898d7c48630be05b72b3ae07c5be6617f90d8e). Running `test/harness` | |
# will automatically download this dictionary for you if you don't | |
# have it already. | |
path = ARGV.length > 0 ? ARGV[0] : '/usr/share/dict/words' | |
entries = File.read(path).split("\n") | |
contents = $stdin.read | |
output = contents.gsub(/[^ \n]+/) do |word| | |
if entries.include?(word.downcase) | |
word | |
else | |
"<#{word}>" | |
end | |
end | |
print output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment