Method: Msf::DataStore#to_file

Defined in:
lib/msf/core/data_store.rb

#to_file(path, name = 'global') ⇒ Object

Persists the contents of the data store to a file


300
301
302
303
304
305
306
307
308
309
310
311
# File 'lib/msf/core/data_store.rb', line 300

def to_file(path, name = 'global')
  ini = Rex::Parser::Ini.new(path)

  ini.add_group(name)

  # Save all user-defined options to the file.
  @user_defined.each_pair { |k, v|
    ini[name][k] = v
  }

  ini.to_file(path)
end