Codebase list osrframework / 413d35c
Refresh patches Sophie Brun 4 years ago
8 changed file(s) with 153 addition(s) and 202 deletion(s). Raw diff Collapse all Expand all
0 Description: Add a script to manage configuration during upgrade
1 During a upgrade we have to install the new configuration files in
2 ~/.config/OSRFramework:
3 - Update configuration.py to create the missing directory "data"
4 only if it doesn't exist.
5 - Add a script (which is called in postinst when it's an upgrade) to
6 remove config directories "default", "plugins", "server", "transforms",
7 and install the new directories and files provided by the package.
8 Author: Sophie Brun <[email protected]>
0 From: Sophie Brun <[email protected]>
1 Date: Thu, 23 Jan 2020 10:21:00 +0100
2 Subject: Add a script to manage configuration during upgrade
3
94 Origin: vendor
105 Last-Update: 2018-01-24
6
7 During a upgrade we have to install the new configuration files in
8 ~/.config/OSRFramework:
9 - Update configuration.py to create the missing directory "data"
10 only if it doesn't exist.
11 - Add a script (which is called in postinst when it's an upgrade) to
12 remove config directories "default", "plugins", "server", "transforms",
13 and install the new directories and files provided by the package.
14 Last-Update: 2018-01-24
1115 ---
12 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
16 osrframework/utils/configuration.py | 6 ++++--
17 osrframework/utils/upgrade_config.py | 12 ++++++++++++
18 2 files changed, 16 insertions(+), 2 deletions(-)
19 create mode 100644 osrframework/utils/upgrade_config.py
20
21 diff --git a/osrframework/utils/configuration.py b/osrframework/utils/configuration.py
22 --- a/osrframework/utils/configuration.py
23 +++ b/osrframework/utils/configuration.py
24 @@ -40,8 +40,10 @@ def initialize_config_files():
25 for dirconf in ["default", "plugins"]:
26 shutil.copytree(os.path.join('/etc/osrframework',dirconf), os.path.join(LOCAL_CONFIG_DIR, dirconf))
27
28 - # Create directory data
29 - os.mkdir(getConfigPath()["appPathData"])
30 + # Create directory data if it doesn't exist (we keep it at the
31 + # upgrade)
32 + if not os.path.exists(getConfigPath()["appPathData"]):
33 + os.mkdir(getConfigPath()["appPathData"])
34
35 # Create directory Transforms before copy *.py files
36 # os.mkdir(LOCAL_CONFIG_TRANSFORMS_DIR)
37 diff --git a/osrframework/utils/upgrade_config.py b/osrframework/utils/upgrade_config.py
38 new file mode 100644
39 index 0000000..6e9c57d
1340 --- /dev/null
1441 +++ b/osrframework/utils/upgrade_config.py
1542 @@ -0,0 +1,12 @@
2552 + for confdir in ["default", "plugins", "server", "transforms"]:
2653 + shutil.rmtree(os.path.join(configuration.getConfigPath()["appPath"], confdir), True)
2754 + configuration.initialize_config_files()
28 --- a/osrframework/utils/configuration.py
29 +++ b/osrframework/utils/configuration.py
30 @@ -41,8 +41,10 @@ def initialize_config_files():
31 for dirconf in ["default", "plugins"]:
32 shutil.copytree(os.path.join('/etc/osrframework',dirconf), os.path.join(LOCAL_CONFIG_DIR, dirconf))
33
34 - # Create directory data
35 - os.mkdir(getConfigPath()["appPathData"])
36 + # Create directory data if it doesn't exist (we keep it at the
37 + # upgrade)
38 + if not os.path.exists(getConfigPath()["appPathData"]):
39 + os.mkdir(getConfigPath()["appPathData"])
40
41 # Create directory Transforms before copy *.py files
42 # os.mkdir(LOCAL_CONFIG_TRANSFORMS_DIR)
0 Description: Cleanup setup.py
1 The setup.py makes changes that should not be done in a setup:
2 - change the bin path: there is no need for Kali
3 - install config files is the home user directory: should be done at
4 first launch
5 - configure maltego: should be done at first launch
6 Author: Sophie Brun <[email protected]>
0 From: Sophie Brun <[email protected]>
1 Date: Thu, 23 Jan 2020 10:21:00 +0100
2 Subject: Cleanup setup.py
3
4 Last-Update: 2017-09-04
5
6 The setup.py makes changes that should not be done in a setup:
7 - change the bin path: there is no need for Kali
8 - install config files is the home user directory: should be done at
9 first launch
10 - configure maltego: should be done at first launch
711 Last-Update: 2017-09-04
812 ---
9 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
13 setup.py | 90 ++++++++++++++++++++++++++++++++--------------------------------
14 1 file changed, 45 insertions(+), 45 deletions(-)
15
16 diff --git a/setup.py b/setup.py
17 index 0f05c1c..8ed4965 100644
1018 --- a/setup.py
1119 +++ b/setup.py
12 @@ -37,15 +37,15 @@ NEW_VERSION = osrframework.__version__
13 import osrframework.utils.configuration as configuration
14
15 # Depending on the place in which the project is going to be upgraded
16 -try:
17 - raise Exception('Trying to load the markdown manually!')
18 - from pypandoc import convert
19 - read_md = lambda f: convert(f, 'rst')
20 -except ImportError:
21 - print("[!] pypandoc module not found, could not convert Markdown to RST")
22 - read_md = lambda f: open(f, 'r').read()
23 -except Exception:
24 - read_md = lambda f: open(f, 'r').read()
25 +#try:
26 +# raise Exception('Trying to load the markdown manually!')
27 +# from pypandoc import convert
28 +# read_md = lambda f: convert(f, 'rst')
29 +#except ImportError:
30 +# print("[!] pypandoc module not found, could not convert Markdown to RST")
31 +# read_md = lambda f: open(f, 'r').read()
32 +#except Exception:
33 +# read_md = lambda f: open(f, 'r').read()
34
35 # Reading the .md file
36 try:
37 @@ -149,49 +149,49 @@ setup(
20 @@ -113,52 +113,52 @@ setup(
3821 ############################
3922 ### Creating other files ###
4023 ############################
41 -print("[*] Changing permissions of the user folders...")
24 -print("[*] OSRFramework > Changing permissions of the user folders...")
4225 -try:
43 - configuration.changePermissionsRecursively(paths["appPath"], int(os.getenv('SUDO_UID')), int(os.getenv('SUDO_GID')))
26 - configuration.change_permissions_recursively(paths["appPath"], int(os.getenv('SUDO_UID')), int(os.getenv('SUDO_GID')))
4427 -except:
45 +#print("[*] Changing permissions of the user folders...")
28 +#print("[*] OSRFramework > Changing permissions of the user folders...")
4629 +#try:
47 +# configuration.changePermissionsRecursively(paths["appPath"], int(os.getenv('SUDO_UID')), int(os.getenv('SUDO_GID')))
30 +# configuration.change_permissions_recursively(paths["appPath"], int(os.getenv('SUDO_UID')), int(os.getenv('SUDO_GID')))
4831 +#except:
4932 # Something happened with the permissions... We omit this.
5033 - pass
51 +# pass
52
53 -print("[*] Copying relevant files...")
34 -
35 -print("[*] OSRFramework > Population OSRFramework's configuration folder...")
5436 -files_to_copy= {
5537 - paths["appPath"] : [
5638 - os.path.join("config", "browser.cfg"),
6446 - ],
6547 - paths["appPathWrappers"] : [
6648 - os.path.join("config", "plugins", "wrapper.py.sample"),
67 - ],
68 - paths["appPathPatterns"] : [
69 - os.path.join("config", "plugins", "pattern.py.sample"),
49 - os.path.join("config", "plugins", "wrapper_v2.py.sample"),
7050 - ]
7151 -}
72 +#print("[*] Copying relevant files...")
52 +# pass
53 +
54 +#print("[*] OSRFramework > Population OSRFramework's configuration folder...")
7355 +#files_to_copy= {
7456 +# paths["appPath"] : [
7557 +# os.path.join("config", "browser.cfg"),
8365 +# ],
8466 +# paths["appPathWrappers"] : [
8567 +# os.path.join("config", "plugins", "wrapper.py.sample"),
86 +# ],
87 +# paths["appPathPatterns"] : [
88 +# os.path.join("config", "plugins", "pattern.py.sample"),
68 +# os.path.join("config", "plugins", "wrapper_v2.py.sample"),
8969 +# ]
9070 +#}
9171
9272 # Iterating through all destinations to write the info
9373 -for destiny in files_to_copy.keys():
94 - # Grabbing each source file to be moved
95 - for sourceFile in files_to_copy[destiny]:
96 - fileToMove = os.path.join(HERE,sourceFile)
97 -
74 +#for destiny in files_to_copy.keys():
75 # Grabbing each source file to be moved
76 - for source_file in files_to_copy[destiny]:
77 - file_to_move = os.path.join(HERE, source_file)
9878 - cmd = ""
9979 - # Choosing the command depending on the SO
10080 - if sys.platform == 'win32':
101 - if os.path.isdir(fileToMove):
102 - cmd = "echo d | xcopy \"" + fileToMove + "\" \"" + destiny + "\" /s /e"
81 - if os.path.isdir(file_to_move):
82 - cmd = "echo d | xcopy \"" + file_to_move + "\" \"" + destiny + "\" /s /e"
10383 - else:
104 - cmd = "copy \"" + fileToMove + "\" \"" + destiny + "\""
105 - elif sys.platform == 'linux2' or sys.platform == 'darwin':
84 - cmd = "copy \"" + file_to_move + "\" \"" + destiny + "\""
85 - elif sys.platform == 'linux' or sys.platform == 'darwin':
10686 - if not os.geteuid() == 0:
107 - cmd = "cp -r -- \"" + fileToMove + "\" \"" + destiny + "\""
87 - cmd = "cp -r -- \"" + file_to_move + "\" \"" + destiny + "\""
10888 - else:
109 - cmd = "sudo cp -r -- \"" + fileToMove + "\" \"" + destiny + "\""
89 - cmd = "sudo cp -r -- \"" + file_to_move + "\" \"" + destiny + "\""
90 - else:
91 - print("File '{file_to_move}' could not be copied in a {sys.platform.title()} system.")
92 - continue
93 - print(f"\t> {cmd}")
11094 - output = os.popen(cmd).read()
111 +#for destiny in files_to_copy.keys():
112 +# # Grabbing each source file to be moved
113 +# for sourceFile in files_to_copy[destiny]:
114 +# fileToMove = os.path.join(HERE,sourceFile)
115 +#
95 -
96 -print("[*] OSRFramework > Installation ended. If you don't know where to start, run `osrf` to start working on it.")
97 +# for source_file in files_to_copy[destiny]:
98 +# file_to_move = os.path.join(HERE, source_file)
11699 +# cmd = ""
117100 +# # Choosing the command depending on the SO
118101 +# if sys.platform == 'win32':
119 +# if os.path.isdir(fileToMove):
120 +# cmd = "echo d | xcopy \"" + fileToMove + "\" \"" + destiny + "\" /s /e"
102 +# if os.path.isdir(file_to_move):
103 +# cmd = "echo d | xcopy \"" + file_to_move + "\" \"" + destiny + "\" /s /e"
121104 +# else:
122 +# cmd = "copy \"" + fileToMove + "\" \"" + destiny + "\""
123 +# elif sys.platform == 'linux2' or sys.platform == 'darwin':
105 +# cmd = "copy \"" + file_to_move + "\" \"" + destiny + "\""
106 +# elif sys.platform == 'linux' or sys.platform == 'darwin':
124107 +# if not os.geteuid() == 0:
125 +# cmd = "cp -r -- \"" + fileToMove + "\" \"" + destiny + "\""
108 +# cmd = "cp -r -- \"" + file_to_move + "\" \"" + destiny + "\""
126109 +# else:
127 +# cmd = "sudo cp -r -- \"" + fileToMove + "\" \"" + destiny + "\""
110 +# cmd = "sudo cp -r -- \"" + file_to_move + "\" \"" + destiny + "\""
111 +# else:
112 +# print("File '{file_to_move}' could not be copied in a {sys.platform.title()} system.")
113 +# continue
114 +# print(f"\t> {cmd}")
128115 +# output = os.popen(cmd).read()
116 +#
117 +#print("[*] OSRFramework > Installation ended. If you don't know where to start, run `osrf` to start working on it.")
+0
-30
debian/patches/dont-use-validate-email.patch less more
0 Description: Drop import validate_email
1 The module validate_email is only mandatory for windows because module
2 emailahoy doesn't work correctly. Drop the import validate_email in Kali
3 package.
4 Author: Sophie Brun <[email protected]>
5 Last-Update: 2017-08-25
6 ---
7 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
8 --- a/osrframework/mailfy.py
9 +++ b/osrframework/mailfy.py
10 @@ -33,7 +33,7 @@ import sys
11
12 # Email verification libraries
13 import emailahoy
14 -import validate_email
15 +#import validate_email
16
17 import osrframework
18 import osrframework.thirdparties.haveibeenpwned_com.hibp as hibp
19 --- a/setup.py
20 +++ b/setup.py
21 @@ -125,7 +125,7 @@ setup(
22 "tweepy",
23 "networkx",
24 "decorator",
25 - "validate_email",
26 +# "validate_email",
27 "pydns",
28 "tabulate",
29 "oauthlib>=1.0.0",
+0
-18
debian/patches/drop-explicit-need-of-importlib.patch less more
0 Description: Drop depends on importlib
1 We don't need to explicitly add importlib to Depends as it's a backport
2 of python2.7 and we already have Python 2.7
3 Author: Sophie Brun <[email protected]>
4 Last-Update: 2017-08-25
5 ---
6 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
7 --- a/setup.py
8 +++ b/setup.py
9 @@ -130,7 +130,7 @@ setup(
10 "tabulate",
11 "oauthlib>=1.0.0",
12 # Added to dinamically import wrappers:
13 - "importlib",
14 +# "importlib",
15 #"inspect",
16 #"pkgutil",
17 # Adding dependencies to avoid the InsecurePlatformWarning when calling Twitter API dealing with SSL: <http://stackoverflow.com/a/29202163>. Other options would require the user to upgrade to Python 2.7.9.
0 Description: Initialize the config directory and files
1 Upstream creates and initializes the ~/.config/OSRFramework in the
2 setup.py. We disable this for Kali and create a function
3 initialize_config_files to manage the creation and installation of all
4 the required files.
5 Author: Sophie Brun <[email protected]>
0 From: Sophie Brun <[email protected]>
1 Date: Thu, 23 Jan 2020 10:21:00 +0100
2 Subject: Initialize the config directory and files
3
4 Last-Update: 2017-09-18
5
6 Upstream creates and initializes the ~/.config/OSRFramework in the
7 setup.py. We disable this for Kali and create a function
8 initialize_config_files to manage the creation and installation of all
9 the required files.
610 Last-Update: 2017-09-18
711 ---
8 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
12 osrframework/utils/configuration.py | 41 ++++++++++++++++++++++++++++++++++---
13 1 file changed, 38 insertions(+), 3 deletions(-)
14
15 diff --git a/osrframework/utils/configuration.py b/osrframework/utils/configuration.py
916 --- a/osrframework/utils/configuration.py
1017 +++ b/osrframework/utils/configuration.py
11 @@ -23,9 +23,40 @@
12 import ConfigParser
18 @@ -19,12 +19,44 @@
19
1320 import os
1421 import sys
1522 +import shutil
1623 +import glob
24
25 from configparser import ConfigParser
26
1727 import osrframework.utils.errors as errors
1828
1929
2232 + Function to create and initialize the configuration files and
2333 + directories.
2434 + """
25 + LOCAL_CONFIG_DIR = getConfigPath()["appPath"]
26 +# LOCAL_CONFIG_TRANSFORMS_DIR = getConfigPath()["appPathTransforms"]
27 + INSTALL_PATH = '/usr/lib/python2.7/dist-packages/osrframework'
35 + LOCAL_CONFIG_DIR = get_config_path()["appPath"]
36 +# LOCAL_CONFIG_TRANSFORMS_DIR = get_config_path()["appPathTransforms"]
37 + INSTALL_PATH = '/usr/lib/python3/dist-packages/osrframework'
2838 +
2939 + # Copy default config file into osrframework local config
3040 + for dirconf in ["default", "plugins"]:
4656 + for f in ["browser.cfg", "general.cfg"]:
4757 + shutil.copy((os.path.join(getConfigPath()["appPathDefaults"], f)),LOCAL_CONFIG_DIR)
4858 +
49 def changePermissionsRecursively(path, uid, gid):
50 """
51 Function to recursively change the user id and group id.
52 @@ -92,9 +123,10 @@ def getConfigPath(configFileName = None)
59 +
60 def change_permissions_recursively(path, uid, gid):
61 """Function to recursively change the user id and group id
62
63 @@ -86,9 +118,10 @@ def get_config_path(config_file_name=None):
5364 }
5465
5566 # Creating them if they don't exist
6374
6475 return paths
6576
66 @@ -117,6 +149,8 @@ def returnListOfConfigurationValues(util
77 @@ -105,6 +138,8 @@ def get_configuration_values_for(util):
6778 """
6879
6980 VALUES = {}
7182 + initialize_config_files()
7283
7384 # If a api_keys.cfg has not been found, creating it by copying from default
74 configPath = os.path.join(getConfigPath()["appPath"], "general.cfg")
85 configPath = os.path.join(get_config_path()["appPath"], "general.cfg")
0 use-bs4-by-default.patch
10 cleanup-setup.patch
2 dont-use-validate-email.patch
3 drop-explicit-need-of-importlib.patch
41 upgrade-installation.patch
52 initalize-config.patch
63 add-script-config-upgrade.patch
0 Description: Improve installation
1 Upstream installs configuration files directly in the home user directory
2 but we can't / don't do that in packages.
3 Add a data_files in setup to manage the installation of config files in
4 /etc/osrframework. These files will be copied in the user directory at the
5 first launch.
6 Author: Sophie Brun <[email protected]>
7 Last-Update: 2017-09-04
0 From: Sophie Brun <[email protected]>
1 Date: Thu, 23 Jan 2020 10:21:00 +0100
2 Subject: Improve installation
3
4 Last-Update: 2020-01-23
5
6 Upstream installs configuration files directly in the home user directory
7 but we can't / don't do that in packages.
8 Add a data_files in setup to manage the installation of config files in
9 /etc/osrframework. These files will be copied in the user directory at the
10 first launch.
811 ---
9 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
12 setup.py | 7 ++++++-
13 1 file changed, 6 insertions(+), 1 deletion(-)
14
15 diff --git a/setup.py b/setup.py
16 index 8ed4965..716a9f5 100644
1017 --- a/setup.py
1118 +++ b/setup.py
12 @@ -23,6 +23,7 @@
19 @@ -20,7 +20,7 @@
1320
1421 import os
1522 import sys
23 -
1624 +import glob
1725 from setuptools import setup, find_packages
18 import shutil
19 import site
20 @@ -109,6 +110,11 @@ setup(
21 'Topic :: Text Processing :: Markup :: HTML'
22 ],
23 packages=find_packages(),
26
27 try:
28 @@ -108,6 +108,11 @@ setup(
29 long_description=read('README.md'),
30 long_description_content_type="text/markdown",
31 install_requires=requirements,
2432 + data_files=[
2533 + ("/etc/osrframework/default", glob.glob("config/*.cfg")),
26 + ("/etc/osrframework/plugins/patterns", ["config/plugins/pattern.py.sample"]),
27 + ("/etc/osrframework/plugins/wrappers", ["config/plugins/wrapper.py.sample"]),
34 + ("/etc/osrframework/plugins/patterns", ["config/plugins/wrapper.py.sample"]),
35 + ("/etc/osrframework/plugins/wrappers", ["config/plugins/wrapper_v2.py.sample"]),
2836 + ],
29 long_description=long_description,
30 install_requires=[
31 "setuptools",
37 )
38
39 ############################
+0
-18
debian/patches/use-bs4-by-default.patch less more
0 Description: Use bs4 by default
1 Mention beautifulsoup4 in setup so that pybuild generates a dependency on
2 bs4 and not on obsolete beautifulsoup
3 Author: Sophie Brun <[email protected]>
4 Last-Update: 2018-10-18
5 ---
6 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
7 --- a/setup.py
8 +++ b/setup.py
9 @@ -115,7 +115,7 @@ setup(
10 "mechanize",
11 "requests",
12 "python-emailahoy",
13 - "BeautifulSoup",
14 + "beautifulsoup4",
15 "pyexcel==0.2.1",
16 "pyexcel_ods==0.1.1",
17 "pyexcel_xls==0.1.0",