Fix typo in debug command
This commit is contained in:
parent
d513ff32d7
commit
3737c6810c
|
@ -49,7 +49,7 @@ module Msf
|
|||
# Delete all groups from the config ini that potentially have more up to date information
|
||||
ini.keys.each do |key|
|
||||
unless key =~ %r{^framework/database}
|
||||
ini.delete(k)
|
||||
ini.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
[framework/ui/console]
|
||||
ActiveModule=auxiliary/gather/foo
|
||||
|
||||
[gather/foo]
|
||||
HOSTNAME=example.com
|
|
@ -354,7 +354,7 @@ RSpec.describe Msf::Ui::Debug do
|
|||
expect(subject.datastore(framework, driver)).to eql(expected_output)
|
||||
end
|
||||
|
||||
it 'correctly retrieves and parses active module variables ' do
|
||||
it 'correctly retrieves and parses active module variables' do
|
||||
allow(::Msf::Config).to receive(:config_file).and_return(File.join(file_fixtures_path, 'debug', 'config_files', 'empty.ini'))
|
||||
|
||||
framework = instance_double(
|
||||
|
@ -402,6 +402,57 @@ RSpec.describe Msf::Ui::Debug do
|
|||
expect(subject.datastore(framework, driver)).to eql(expected_output)
|
||||
end
|
||||
|
||||
it 'preferences the framework datastore values over config stored values' do
|
||||
allow(::Msf::Config).to receive(:config_file).and_return(File.join(file_fixtures_path, 'debug', 'config_files', 'module.ini'))
|
||||
|
||||
framework = instance_double(
|
||||
::Msf::Framework,
|
||||
datastore: {
|
||||
'key1' => 'val1',
|
||||
'key2' => 'val2',
|
||||
'key3' => 'val3'
|
||||
}
|
||||
)
|
||||
|
||||
driver = instance_double(
|
||||
::Msf::Ui::Console::Driver,
|
||||
get_config_core: 'group/name/1',
|
||||
get_config: {
|
||||
'key4' => 'val4',
|
||||
'key5' => 'val5',
|
||||
'key6' => 'val6'
|
||||
},
|
||||
get_config_group: 'group/name/2',
|
||||
active_module: nil
|
||||
)
|
||||
|
||||
expected_output = <<~OUTPUT
|
||||
## %grnModule/Datastore%clr
|
||||
|
||||
The following global/module datastore, and database setup was configured before the issue occurred:
|
||||
<details>
|
||||
<summary>Collapse</summary>
|
||||
|
||||
```
|
||||
[group/name/1]
|
||||
key1=val1
|
||||
key2=val2
|
||||
key3=val3
|
||||
|
||||
[group/name/2]
|
||||
key4=val4
|
||||
key5=val5
|
||||
key6=val6
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
OUTPUT
|
||||
|
||||
expect(subject.datastore(framework, driver)).to eql(expected_output)
|
||||
end
|
||||
|
||||
it 'correctly retrieves and parses Database information' do
|
||||
allow(::Msf::Config).to receive(:config_file).and_return(File.join(file_fixtures_path, 'debug', 'config_files', 'db.ini'))
|
||||
|
||||
|
|
Loading…
Reference in New Issue