Skip to content

Instantly share code, notes, and snippets.

@crmaxx
Created June 4, 2015 09:20
Show Gist options
  • Save crmaxx/555dddfdb180d2f8f216 to your computer and use it in GitHub Desktop.
Save crmaxx/555dddfdb180d2f8f216 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# gem install ruby-rc4
require "rc4"
dir = ARGV[0]
key = "\x5E\xAE\x45\xB3\x77\xE7\x9C\x36\x9B\x1D\xB4\x4E\xD6\x4F\xE1\x1F"
rb_files = Dir.glob("#{dir}/**/*.rb")
puts "Begin decrypting..\n"
rb_files.each do |rb_file|
encrypted_file = File.read(rb_file, mode: "rb")
encrypted_data = encrypted_file[4, encrypted_file.length]
decrypter = RC4.new(key)
decrypted_data = decrypter.decrypt(encrypted_data)
File.open(rb_file, "w") { |file| file.write(decrypted_data) }
end
puts "#{rb_files.count} files processed."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment