Class: RouterCrypt::IOS

Inherits:
Object
  • Object
show all
Defined in:
lib/ios/decrypt.rb,
lib/ios/common.rb

Constant Summary collapse

KEY =
'dsfd;kfoA,.iyewrkldJKDHSUBsgvca69834ncxv9873254k;fg87'.unpack("C*")

Class Method Summary collapse

Class Method Details

.decrypt(e_pw) ⇒ String

Decrypts IOS type 7 passwords. Original is from unknown perl source

Parameters:

  • the (String)

    encrypted string

Returns:

  • (String)

    the unencrypted string



7
8
9
10
11
12
13
# File 'lib/ios/decrypt.rb', line 7

def decrypt e_pw
  index = e_pw.slice!(0..1).to_i-1
  e_pw.scan(/../).inject("") do |d_pw, byte|
    index += 1 % KEY.size
    d_pw + (byte.hex ^ KEY[index]).chr
  end
end