Codebase list osrframework / 3314a88
Fix issue with renaming getConfigPath to get_config_path Sophie Brun 4 years ago
4 changed file(s) with 37 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
22 Subject: Add a script to manage configuration during upgrade
33
44 Origin: vendor
5 Last-Update: 2018-01-24
5 Last-Update: 2020-01-23
66
77 During a upgrade we have to install the new configuration files in
88 ~/.config/OSRFramework:
1111 - Add a script (which is called in postinst when it's an upgrade) to
1212 remove config directories "default", "plugins", "server", "transforms",
1313 and install the new directories and files provided by the package.
14 Last-Update: 2018-01-24
1514 ---
1615 osrframework/utils/configuration.py | 6 ++++--
1716 osrframework/utils/upgrade_config.py | 12 ++++++++++++
2625 shutil.copytree(os.path.join('/etc/osrframework',dirconf), os.path.join(LOCAL_CONFIG_DIR, dirconf))
2726
2827 - # Create directory data
29 - os.mkdir(getConfigPath()["appPathData"])
28 - os.mkdir(get_config_path()["appPathData"])
3029 + # Create directory data if it doesn't exist (we keep it at the
3130 + # upgrade)
32 + if not os.path.exists(getConfigPath()["appPathData"]):
33 + os.mkdir(getConfigPath()["appPathData"])
31 + if not os.path.exists(get_config_path()["appPathData"]):
32 + os.mkdir(get_config_path()["appPathData"])
3433
3534 # Create directory Transforms before copy *.py files
3635 # os.mkdir(LOCAL_CONFIG_TRANSFORMS_DIR)
3736 diff --git a/osrframework/utils/upgrade_config.py b/osrframework/utils/upgrade_config.py
3837 new file mode 100644
39 index 0000000..6e9c57d
38 index 0000000..ca2de05
4039 --- /dev/null
4140 +++ b/osrframework/utils/upgrade_config.py
4241 @@ -0,0 +1,12 @@
43 +# !/usr/bin/python
42 +#!/usr/bin/python3
4443 +
4544 +import os
4645 +import shutil
4847 +import osrframework.utils.configuration as configuration
4948 +
5049 +if __name__ == "__main__":
51 + if os.path.exists(configuration.getConfigPath()["appPath"]):
50 + if os.path.exists(configuration.get_config_path()["appPath"]):
5251 + for confdir in ["default", "plugins", "server", "transforms"]:
53 + shutil.rmtree(os.path.join(configuration.getConfigPath()["appPath"], confdir), True)
52 + shutil.rmtree(os.path.join(configuration.get_config_path()["appPath"], confdir), True)
5453 + configuration.initialize_config_files()
0 From: Sophie Brun <[email protected]>
1 Date: Thu, 23 Jan 2020 12:03:08 +0100
2 Subject: Change getConfigPath to get_config_path
3
4 Last-Update: 2020-01-23
5
6 Description: upstream rename getConfigPath to get_config_path but not in osrframework/utils/exceptions.py
7 ---
8 osrframework/utils/exceptions.py | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11 diff --git a/osrframework/utils/exceptions.py b/osrframework/utils/exceptions.py
12 index 16ecd8e..3ef56ab 100644
13 --- a/osrframework/utils/exceptions.py
14 +++ b/osrframework/utils/exceptions.py
15 @@ -47,7 +47,7 @@ class NoCredentialsException(OSRFrameworkException):
16 """.format(
17 self.__class__.__name__,
18 platform,
19 - os.path.join(configuration.getConfigPath()["appPath"], "accounts.cfg"),
20 + os.path.join(configuration.get_config_path()["appPath"], "accounts.cfg"),
21 general.emphasis("-x " + platform)
22 )
23 OSRFrameworkException.__init__(self, general.warning(msg))
11 Date: Thu, 23 Jan 2020 10:21:00 +0100
22 Subject: Initialize the config directory and files
33
4 Last-Update: 2017-09-18
4 Last-Update: 2020-01-23
55
66 Upstream creates and initializes the ~/.config/OSRFramework in the
77 setup.py. We disable this for Kali and create a function
88 initialize_config_files to manage the creation and installation of all
99 the required files.
10 Last-Update: 2017-09-18
1110 ---
1211 osrframework/utils/configuration.py | 41 ++++++++++++++++++++++++++++++++++---
1312 1 file changed, 38 insertions(+), 3 deletions(-)
4140 + shutil.copytree(os.path.join('/etc/osrframework',dirconf), os.path.join(LOCAL_CONFIG_DIR, dirconf))
4241 +
4342 + # Create directory data
44 + os.mkdir(getConfigPath()["appPathData"])
43 + os.mkdir(get_config_path()["appPathData"])
4544 +
4645 + # Create directory Transforms before copy *.py files
4746 +# os.mkdir(LOCAL_CONFIG_TRANSFORMS_DIR)
5453 +
5554 + # Copy default config files for the user
5655 + for f in ["browser.cfg", "general.cfg"]:
57 + shutil.copy((os.path.join(getConfigPath()["appPathDefaults"], f)),LOCAL_CONFIG_DIR)
56 + shutil.copy((os.path.join(get_config_path()["appPathDefaults"], f)),LOCAL_CONFIG_DIR)
5857 +
5958 +
6059 def change_permissions_recursively(path, uid, gid):
7877 """
7978
8079 VALUES = {}
81 + if not os.path.exists(getConfigPath()["appPath"]):
80 + if not os.path.exists(get_config_path()["appPath"]):
8281 + initialize_config_files()
8382
8483 # If a api_keys.cfg has not been found, creating it by copying from default
22 initalize-config.patch
33 add-script-config-upgrade.patch
44 remove-unused-logger-function.patch
5 fix-getConfigPath-issue.patch