Method: String#decode_cisco7

Defined in:
lib/pentex/core.rb

#decode_cisco7Object

decodes cisco 7 passwords which can be found in IOS/CatOS configs.
e.g., password 7 07362E590E1B1C041B1E124C0A2F2E206832752E1A01134D



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/pentex/core.rb', line 106

def decode_cisco7

  xlat = %w( 64 73 66 64 3b 6b 66 6f 41 2c 2e 69 79 65 77 72 6b 6c 64 4a 4b 44 48 53 55 42 73 67 76 63 )

  ep = self.strip
  # sample: "07362E590E1B1C041B1E124C0A2F2E206832752E1A01134D" # -> "You really need a life."
  dp = ""
  if ep =~ /^(..)(.*)/o
    s = $1.to_i
    e = $2
    i = 0
    0.step(e.length-1, 2) do |x|
      dp += ( e.slice(x,2).hex ^ xlat[s].hex ).chr;
      s+=1
      break if s >= xlat.length
    end

  end
  dp
end