Module: CiscoDecrypt

Defined in:
lib/cisco_decrypt.rb,
ext/cisco_decrypt/cisco-decrypt.c

Class Method Summary collapse

Class Method Details

.decrypt_string(string) ⇒ Object



147
148
149
150
151
152
# File 'ext/cisco_decrypt/cisco-decrypt.c', line 147

static VALUE decrypt_string(VALUE klass, VALUE string)
{
    Check_Type(string, T_STRING);
    char *str = StringValueCStr(string);
    return rb_str_new2(decrypt(str));
}

.from_pcf(file) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/cisco_decrypt.rb', line 5

def self.from_pcf(file)
  config_file = IniFile.new(File.expand_path(file))
  main_config = config_file['main']
  encrypted_password = main_config['enc_GroupPwd']
  group_name = main_config['GroupName']
  host = main_config['Host']
  description = main_config['Description']
  puts "    Description: \#{description}\n    Host:        \#{host}\n    Group Name:  \#{group_name}\n    Encrypted:   \\033[031m\#{encrypted_password}\\033[0m\n    Decrypted:   \\033[032m\#{self.decrypt_string(encrypted_password)}\\033[0m\n  OUT\nend\n"