leonteale

gppdecrypt.rb

Sep 16th, 2013
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.68 KB | None | 0 0
  1. require 'rubygems'
  2.  
  3. require 'openssl'
  4.  
  5. require 'base64'
  6.  
  7.  
  8.  
  9.  
  10.  
  11. encrypted_data = ARGV
  12.  
  13.  
  14.  
  15. def decrypt(encrypted_data)
  16.  
  17. padding = "=" * (4 - (encrypted_data.length % 4))
  18.  
  19. epassword = "#{encrypted_data}#{padding}"
  20.  
  21. decoded = Base64.decode64(epassword)
  22.  
  23.  
  24.  
  25. key = "\x4e\x99\x06\xe8\xfc\xb6\x6c\xc9\xfa\xf4\x93\x10\x62\x0f\xfe\xe8\xf4\x96\xe8\x06\xcc\x05\x79\x90\x20\x9b\x09\xa4\x33\xb6\x6c\x1b"
  26.  
  27. aes = OpenSSL::Cipher::Cipher.new("AES-256-CBC")
  28.  
  29. aes.decrypt
  30.  
  31. aes.key = key
  32.  
  33. plaintext = aes.update(decoded)
  34.  
  35. plaintext << aes.final
  36.  
  37. pass = plaintext.unpack('v*').pack('C*') # UNICODE conversion
  38.  
  39.  
  40.  
  41. return pass
  42.  
  43. end
  44.  
  45.  
  46.  
  47. blah = decrypt(encrypted_data)
  48.  
  49. puts blah
Advertisement
Add Comment
Please, Sign In to add comment