diff --git a/debian/patches/add-script-config-upgrade.patch b/debian/patches/add-script-config-upgrade.patch index 8fb7e2c..46f7a83 100644 --- a/debian/patches/add-script-config-upgrade.patch +++ b/debian/patches/add-script-config-upgrade.patch @@ -3,7 +3,7 @@ Subject: Add a script to manage configuration during upgrade Origin: vendor -Last-Update: 2018-01-24 +Last-Update: 2020-01-23 During a upgrade we have to install the new configuration files in ~/.config/OSRFramework: @@ -12,7 +12,6 @@ - Add a script (which is called in postinst when it's an upgrade) to remove config directories "default", "plugins", "server", "transforms", and install the new directories and files provided by the package. -Last-Update: 2018-01-24 --- osrframework/utils/configuration.py | 6 ++++-- osrframework/utils/upgrade_config.py | 12 ++++++++++++ @@ -27,21 +26,21 @@ shutil.copytree(os.path.join('/etc/osrframework',dirconf), os.path.join(LOCAL_CONFIG_DIR, dirconf)) - # Create directory data -- os.mkdir(getConfigPath()["appPathData"]) +- os.mkdir(get_config_path()["appPathData"]) + # Create directory data if it doesn't exist (we keep it at the + # upgrade) -+ if not os.path.exists(getConfigPath()["appPathData"]): -+ os.mkdir(getConfigPath()["appPathData"]) ++ if not os.path.exists(get_config_path()["appPathData"]): ++ os.mkdir(get_config_path()["appPathData"]) # Create directory Transforms before copy *.py files # os.mkdir(LOCAL_CONFIG_TRANSFORMS_DIR) diff --git a/osrframework/utils/upgrade_config.py b/osrframework/utils/upgrade_config.py new file mode 100644 -index 0000000..6e9c57d +index 0000000..ca2de05 --- /dev/null +++ b/osrframework/utils/upgrade_config.py @@ -0,0 +1,12 @@ -+# !/usr/bin/python ++#!/usr/bin/python3 + +import os +import shutil @@ -49,7 +48,7 @@ +import osrframework.utils.configuration as configuration + +if __name__ == "__main__": -+ if os.path.exists(configuration.getConfigPath()["appPath"]): ++ if os.path.exists(configuration.get_config_path()["appPath"]): + for confdir in ["default", "plugins", "server", "transforms"]: -+ shutil.rmtree(os.path.join(configuration.getConfigPath()["appPath"], confdir), True) ++ shutil.rmtree(os.path.join(configuration.get_config_path()["appPath"], confdir), True) + configuration.initialize_config_files() diff --git a/debian/patches/fix-getConfigPath-issue.patch b/debian/patches/fix-getConfigPath-issue.patch new file mode 100644 index 0000000..a610a57 --- /dev/null +++ b/debian/patches/fix-getConfigPath-issue.patch @@ -0,0 +1,24 @@ +From: Sophie Brun +Date: Thu, 23 Jan 2020 12:03:08 +0100 +Subject: Change getConfigPath to get_config_path + +Last-Update: 2020-01-23 + +Description: upstream rename getConfigPath to get_config_path but not in osrframework/utils/exceptions.py +--- + osrframework/utils/exceptions.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/osrframework/utils/exceptions.py b/osrframework/utils/exceptions.py +index 16ecd8e..3ef56ab 100644 +--- a/osrframework/utils/exceptions.py ++++ b/osrframework/utils/exceptions.py +@@ -47,7 +47,7 @@ class NoCredentialsException(OSRFrameworkException): + """.format( + self.__class__.__name__, + platform, +- os.path.join(configuration.getConfigPath()["appPath"], "accounts.cfg"), ++ os.path.join(configuration.get_config_path()["appPath"], "accounts.cfg"), + general.emphasis("-x " + platform) + ) + OSRFrameworkException.__init__(self, general.warning(msg)) diff --git a/debian/patches/initalize-config.patch b/debian/patches/initalize-config.patch index 6d9cea9..f7a4f68 100644 --- a/debian/patches/initalize-config.patch +++ b/debian/patches/initalize-config.patch @@ -2,13 +2,12 @@ Date: Thu, 23 Jan 2020 10:21:00 +0100 Subject: Initialize the config directory and files -Last-Update: 2017-09-18 +Last-Update: 2020-01-23 Upstream creates and initializes the ~/.config/OSRFramework in the setup.py. We disable this for Kali and create a function initialize_config_files to manage the creation and installation of all the required files. -Last-Update: 2017-09-18 --- osrframework/utils/configuration.py | 41 ++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) @@ -42,7 +41,7 @@ + shutil.copytree(os.path.join('/etc/osrframework',dirconf), os.path.join(LOCAL_CONFIG_DIR, dirconf)) + + # Create directory data -+ os.mkdir(getConfigPath()["appPathData"]) ++ os.mkdir(get_config_path()["appPathData"]) + + # Create directory Transforms before copy *.py files +# os.mkdir(LOCAL_CONFIG_TRANSFORMS_DIR) @@ -55,7 +54,7 @@ + + # Copy default config files for the user + for f in ["browser.cfg", "general.cfg"]: -+ shutil.copy((os.path.join(getConfigPath()["appPathDefaults"], f)),LOCAL_CONFIG_DIR) ++ shutil.copy((os.path.join(get_config_path()["appPathDefaults"], f)),LOCAL_CONFIG_DIR) + + def change_permissions_recursively(path, uid, gid): @@ -79,7 +78,7 @@ """ VALUES = {} -+ if not os.path.exists(getConfigPath()["appPath"]): ++ if not os.path.exists(get_config_path()["appPath"]): + initialize_config_files() # If a api_keys.cfg has not been found, creating it by copying from default diff --git a/debian/patches/series b/debian/patches/series index d6e93da..addd708 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,4 @@ initalize-config.patch add-script-config-upgrade.patch remove-unused-logger-function.patch +fix-getConfigPath-issue.patch