Class: RCS::Config

Inherits:
Object
  • Object
show all
Includes:
Crypt, Tracer
Defined in:
lib/rcs-backdoor/config.rb

Instance Method Summary collapse

Constructor Details

#initialize(backdoor, buff) ⇒ Config

Returns a new instance of Config.



16
17
18
19
20
# File 'lib/rcs-backdoor/config.rb', line 16

def initialize(backdoor, buff)
  @backdoor = backdoor
  @content = buff
  trace :info, "Configuration size is #{@content.length}"
end

Instance Method Details

#dump_to_fileObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/rcs-backdoor/config.rb', line 22

def dump_to_file
  
  # dump the configuration still encrypted
  str = './' + @backdoor.id + "_config.enc"
  f = File.new(str, File::CREAT | File::TRUNC | File::RDWR, 0644)
  f.write @content
  f.close
  trace :debug, str + " created."
  
  # dump the configuration in clear
  str = './' + @backdoor.id + "_config.dec"
  f = File.new(str, File::CREAT | File::TRUNC | File::RDWR, 0644)
  f.write aes_decrypt(@content, @backdoor.conf_key)
  f.close
  trace :debug, str + " created."
  
end