Created
January 22, 2014 22:48
-
-
Save Yardboy/8569010 to your computer and use it in GitHub Desktop.
CTF 2014 Level 0
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 | |
checker = entries & contents.gsub(/[^ \n]+/).map(&:downcase) | |
output = contents.gsub(/[^ \n]+/) do |word| | |
#if entries.include?(word.downcase) | |
if checker.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