When running OWTF from a different directory and OWTF cannot find the file profile/general/default.cfg, it silently fails.
Instead of throwing a verbose error message such as "Configuration file not found", it simply does not load the configuration DB values and later fails when loading Zest with the following error message:
Traceback (most recent call last):
File "/home/depierre/git-repo/owtf/owtf_testing/tests_functional/cli/test_empty_run.py", line 13, in test_cli_empty_run
self.run_owtf()
File "/home/depierre/git-repo/owtf/owtf_testing/utils/owtftest.py", line 55, in run_owtf
owtf.main(args)
File "/home/depierre/git-repo/owtf/owtf.py", line 235, in main
ComponentInitialiser.initialisation_phase_1(root_dir, owtf_pid)
File "/home/depierre/git-repo/owtf/framework/dependency_management/component_initialiser.py", line 73, in initialisation_phase_1
zest.init()
File "/home/depierre/git-repo/owtf/framework/zest.py", line 25, in init
self.StopRecorder() # recorded should be stopped when OWTF starts
File "/home/depierre/git-repo/owtf/framework/zest.py", line 145, in StopRecorder
self.db_config.Update("ZEST_RECORDING", "False")
File "/home/depierre/git-repo/owtf/framework/db/config_manager.py", line 114, in Update
raise InvalidConfigurationReference("No setting exists with key: " + str(key))
InvalidConfigurationReference: 'No setting exists with key: ZEST_RECORDING'
The error is in https://github.com/owtf/owtf/blob/develop/framework/db/config_manager.py#L31 where the documentation of RawConfigParser.read() says:
If none of the named files exist, the ConfigParser instance will contain an empty dataset.
To fix the issue and get a verbose message, the function LoadConfigDBFromFile should use https://docs.python.org/2/library/configparser.html#ConfigParser.RawConfigParser.readfp.
Another approach would be to check that file_path exists before https://github.com/owtf/owtf/blob/develop/framework/db/config_manager.py#L31
When running OWTF from a different directory and OWTF cannot find the file
profile/general/default.cfg, it silently fails.Instead of throwing a verbose error message such as "Configuration file not found", it simply does not load the configuration DB values and later fails when loading Zest with the following error message:
The error is in https://github.com/owtf/owtf/blob/develop/framework/db/config_manager.py#L31 where the documentation of
RawConfigParser.read()says:To fix the issue and get a verbose message, the function
LoadConfigDBFromFileshould use https://docs.python.org/2/library/configparser.html#ConfigParser.RawConfigParser.readfp.Another approach would be to check that
file_pathexists before https://github.com/owtf/owtf/blob/develop/framework/db/config_manager.py#L31