Created
December 13, 2012 03:03
-
-
Save JGallardo/4273696 to your computer and use it in GitHub Desktop.
File decryption script written in Ruby
This file contains hidden or 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
require 'crypt/blowfish' | |
unless ARGV[0] | |
puts "Usage: ruby decrypt.rb <Encrypted_filename.ext>" | |
puts "Example: ruby decrypt.rb" Encrypted_secret.stuff" | |
exit | |
end | |
filename = ARGV[0].chomp | |
puts "Decrypting #{filename}." | |
p = "Decrypted_#{filename}" | |
if File.exists?(p) | |
puts "File already exists." | |
exit | |
end | |
print 'Enter your encryption key: ' | |
kee = gets.chomp | |
begin | |
blowfish = Crypt::Blowfish.new(kee) | |
blowfish.decrypt_file(filename.to_str, p) | |
puts 'Decryption SUCCESS!' | |
rescue Exception => e | |
puts "An error occurred during decryption: \n #{e}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment