insight-plugin 1.3.0__tar.gz → 1.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/PKG-INFO +18 -1
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/README.md +17 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/__init__.py +1 -1
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/__main__.py +1 -10
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/__pycache__/__init__.cpython-39.pyc +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/common/builder.py +6 -1
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/common/plugin_spec_util.py +0 -1
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/common/schema_util.py +3 -1
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/create/controller.py +1 -10
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/create/help/constants.py +1 -1
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/create/help/help_util.py +1 -1
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/create/plugin_to_helpmd.py +10 -4
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/export/controller.py +28 -7
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin.egg-info/PKG-INFO +18 -1
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin.egg-info/SOURCES.txt +0 -5
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin.egg-info/requires.txt +1 -1
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/setup.py +1 -1
- insight_plugin-1.3.0/insight_plugin/features/interactive/controller.py +0 -247
- insight_plugin-1.3.0/insight_plugin/features/interactive/util/util.py +0 -227
- insight_plugin-1.3.0/tests/resources/export_test_base64/__init__.py +0 -0
- insight_plugin-1.3.0/tests/resources/export_test_base64/unit_test/__init__.py +0 -0
- insight_plugin-1.3.0/tests/test_interactive.py +0 -91
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/LICENSE +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/constants.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/analysis/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/analysis/controller.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/common/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/common/checksum_util.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/common/command_line_util.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/common/common_feature.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/common/docker_util.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/common/dockerspec.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/common/exceptions.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/common/logging_util.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/common/temp_file_util.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/common/template_util.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/create/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/create/help/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/create/help/components.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/create/help/connection_help.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/create/help/input_output_helpers.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/create/json_generation_util.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/create/util.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/export/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/export/util/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/export/util/util.py +0 -0
- {insight_plugin-1.3.0/insight_plugin/features/interactive → insight_plugin-1.5.0/insight_plugin/features/linter}/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/linter/controller.py +0 -0
- {insight_plugin-1.3.0/insight_plugin/features/interactive/util → insight_plugin-1.5.0/insight_plugin/features/refresh}/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/refresh/controller.py +0 -0
- {insight_plugin-1.3.0/insight_plugin/features/linter → insight_plugin-1.5.0/insight_plugin/features/run}/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/run/bash_controller.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/run/run_controller.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/run/server_controller.py +0 -0
- {insight_plugin-1.3.0/insight_plugin/features/refresh → insight_plugin-1.5.0/insight_plugin/features/samples}/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/samples/controller.py +0 -0
- {insight_plugin-1.3.0/insight_plugin/features/run → insight_plugin-1.5.0/insight_plugin/features/samples/util}/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/samples/util/constants.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/samples/util/util.py +0 -0
- {insight_plugin-1.3.0/insight_plugin/features/samples → insight_plugin-1.5.0/insight_plugin/features/validate}/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/validate/controller.py +0 -0
- {insight_plugin-1.3.0/insight_plugin/features/samples/util → insight_plugin-1.5.0/insight_plugin/features/version}/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/version/controller.py +0 -0
- {insight_plugin-1.3.0/insight_plugin/features/validate → insight_plugin-1.5.0/insight_plugin/features/version/util}/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/version/util/helpmd_util.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/version/util/input_util.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/version/util/version_util.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/version/util/yaml_util.py +0 -0
- {insight_plugin-1.3.0/insight_plugin/features/version → insight_plugin-1.5.0/insight_plugin/features/view}/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/view/controller.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/.dockerignore.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/Dockerfile.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/Makefile.jinja +0 -0
- {insight_plugin-1.3.0/insight_plugin/features/version/util → insight_plugin-1.5.0/insight_plugin/templates}/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/assessment/assessment.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/bin/plugin.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/__init__.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/actions/__init__.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/actions/action/__init__.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/actions/action/action.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/actions/action/schema.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/connection/__init__.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/connection/connection.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/connection/schema.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/tasks/__init__.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/tasks/task/__init__.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/tasks/task/schema.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/tasks/task/task.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/triggers/__init__.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/triggers/trigger/__init__.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/triggers/trigger/schema.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/triggers/trigger/trigger.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/plugin/util/__init__.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/requirements.txt.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/setup.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/unit_test/__init__.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/templates/unit_test/test_action.py.jinja +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin.egg-info/dependency_links.txt +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin.egg-info/entry_points.txt +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin.egg-info/top_level.txt +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/pyproject.toml +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/setup.cfg +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/__init__.py +0 -0
- {insight_plugin-1.3.0/insight_plugin/features/view → insight_plugin-1.5.0/tests/resources}/__init__.py +0 -0
- {insight_plugin-1.3.0/insight_plugin/templates → insight_plugin-1.5.0/tests/resources/export_test_base64}/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/resources/export_test_base64/komand_base64/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/resources/export_test_base64/komand_base64/actions/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/resources/export_test_base64/komand_base64/actions/decode/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/resources/export_test_base64/komand_base64/actions/decode/action.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/resources/export_test_base64/komand_base64/actions/decode/schema.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/resources/export_test_base64/komand_base64/actions/encode/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/resources/export_test_base64/komand_base64/actions/encode/action.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/resources/export_test_base64/komand_base64/actions/encode/schema.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/resources/export_test_base64/komand_base64/connection/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/resources/export_test_base64/komand_base64/connection/connection.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/resources/export_test_base64/komand_base64/connection/schema.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/resources/export_test_base64/komand_base64/triggers/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/resources/export_test_base64/komand_base64/util/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/resources/export_test_base64/setup.py +0 -0
- {insight_plugin-1.3.0/tests/resources → insight_plugin-1.5.0/tests/resources/export_test_base64/unit_test}/__init__.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/resources/export_test_base64/unit_test/test_encode.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/test.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/test_checksum.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/test_create.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/test_export.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/test_gen_samples.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/test_help_creation.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/test_json_generate.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/test_refresh.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/test_run.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/test_schema.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/test_semver.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/test_spec_order.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/test_temp_file_util.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/test_validate.py +0 -0
- {insight_plugin-1.3.0 → insight_plugin-1.5.0}/tests/util.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: insight_plugin
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: Plugin tooling for the Rapid7 Insight platform
|
|
5
5
|
Home-page: https://github.com/rapid7/insight-plugin
|
|
6
6
|
Author: Rapid7 Integrations Alliance
|
|
@@ -20,6 +20,23 @@ License-File: LICENSE
|
|
|
20
20
|
|
|
21
21
|
## Commands
|
|
22
22
|
|
|
23
|
+
### Analysis
|
|
24
|
+
Run Static Code Analysis on the plugin.
|
|
25
|
+
|
|
26
|
+
This command will run the static code analysis check on the plugin.
|
|
27
|
+
|
|
28
|
+
### Linter
|
|
29
|
+
Run the linter check on the plugin.
|
|
30
|
+
|
|
31
|
+
This command will run the `black` linter on the plugin and return any
|
|
32
|
+
formatting issues with the plugin.
|
|
33
|
+
|
|
34
|
+
### Checks
|
|
35
|
+
Run analysis, linter and validate on the plugin.
|
|
36
|
+
|
|
37
|
+
This will allow you to recreate, locally, all the github checks that get run
|
|
38
|
+
on plugins.
|
|
39
|
+
|
|
23
40
|
### Create
|
|
24
41
|
Create a new plugin.
|
|
25
42
|
|
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
## Commands
|
|
4
4
|
|
|
5
|
+
### Analysis
|
|
6
|
+
Run Static Code Analysis on the plugin.
|
|
7
|
+
|
|
8
|
+
This command will run the static code analysis check on the plugin.
|
|
9
|
+
|
|
10
|
+
### Linter
|
|
11
|
+
Run the linter check on the plugin.
|
|
12
|
+
|
|
13
|
+
This command will run the `black` linter on the plugin and return any
|
|
14
|
+
formatting issues with the plugin.
|
|
15
|
+
|
|
16
|
+
### Checks
|
|
17
|
+
Run analysis, linter and validate on the plugin.
|
|
18
|
+
|
|
19
|
+
This will allow you to recreate, locally, all the github checks that get run
|
|
20
|
+
on plugins.
|
|
21
|
+
|
|
5
22
|
### Create
|
|
6
23
|
Create a new plugin.
|
|
7
24
|
|
|
@@ -16,7 +16,6 @@ from insight_plugin.features.run.run_controller import RunController
|
|
|
16
16
|
from insight_plugin.features.validate.controller import ValidateController
|
|
17
17
|
from insight_plugin.features.run.server_controller import RunServerController
|
|
18
18
|
from insight_plugin.features.run.bash_controller import RunShellController
|
|
19
|
-
from insight_plugin.features.interactive.controller import InteractiveController
|
|
20
19
|
from insight_plugin.features.common.exceptions import InsightException
|
|
21
20
|
from insight_plugin.features.version.controller import VersionController
|
|
22
21
|
from insight_plugin.features.view.controller import ViewController
|
|
@@ -99,7 +98,7 @@ def main():
|
|
|
99
98
|
except InsightException as error:
|
|
100
99
|
logging.exception(error)
|
|
101
100
|
except AttributeError:
|
|
102
|
-
|
|
101
|
+
print("try 'insight-plugin --help' for more information")
|
|
103
102
|
|
|
104
103
|
|
|
105
104
|
def create_argparse(subparsers, parsers_list: List) -> None:
|
|
@@ -175,14 +174,6 @@ def export(args: Namespace) -> None:
|
|
|
175
174
|
controller.export()
|
|
176
175
|
|
|
177
176
|
|
|
178
|
-
def interactive() -> None:
|
|
179
|
-
"""
|
|
180
|
-
Start a general interactive session with the user
|
|
181
|
-
:return: None
|
|
182
|
-
"""
|
|
183
|
-
InteractiveController.prompt_menu()
|
|
184
|
-
|
|
185
|
-
|
|
186
177
|
def refresh_argparse(subparsers, parsers_list: List) -> None:
|
|
187
178
|
"""
|
|
188
179
|
Handle the arg-parsing for the refresh subcommand
|
{insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/__pycache__/__init__.cpython-39.pyc
RENAMED
|
Binary file
|
|
@@ -4,6 +4,8 @@ from insight_plugin.features.common.exceptions import InsightException
|
|
|
4
4
|
from insight_plugin.features.common.plugin_spec_util import PluginSpecUtil
|
|
5
5
|
from enum import Enum
|
|
6
6
|
|
|
7
|
+
# TODO - Move to export Util, its not a common util
|
|
8
|
+
|
|
7
9
|
|
|
8
10
|
class BuilderOperation(Enum):
|
|
9
11
|
TARBALL = "tarball"
|
|
@@ -63,7 +65,6 @@ class Builder(BaseLoggingFeature):
|
|
|
63
65
|
# TODO from icon-plugin: cleanup dir?
|
|
64
66
|
|
|
65
67
|
# Run Docker build
|
|
66
|
-
args = []
|
|
67
68
|
plugin_name = PluginSpecUtil.get_docker_name(spec)
|
|
68
69
|
self._image_name = plugin_name
|
|
69
70
|
if self._no_pull:
|
|
@@ -73,7 +74,9 @@ class Builder(BaseLoggingFeature):
|
|
|
73
74
|
args = ["build", "-t", plugin_name, self._target_dir]
|
|
74
75
|
else:
|
|
75
76
|
args = ["build", "--pull", "-t", plugin_name, self._target_dir]
|
|
77
|
+
|
|
76
78
|
self.logger.info(f"Running build command : {cmd} {args}")
|
|
79
|
+
|
|
77
80
|
err = CommandLineUtil.run_command(cmd, args)
|
|
78
81
|
if err:
|
|
79
82
|
self.logger.error(err)
|
|
@@ -84,7 +87,9 @@ class Builder(BaseLoggingFeature):
|
|
|
84
87
|
|
|
85
88
|
# Run Docker tag
|
|
86
89
|
plugin_tag = f"{spec['vendor']}/{spec['name']}:latest"
|
|
90
|
+
|
|
87
91
|
self.logger.info("Tagging docker image")
|
|
92
|
+
|
|
88
93
|
args = ["tag", plugin_name, plugin_tag]
|
|
89
94
|
err = CommandLineUtil.run_command(cmd, args)
|
|
90
95
|
if err:
|
|
@@ -441,7 +441,9 @@ class SchemaUtil:
|
|
|
441
441
|
# Set the current parameter default if one exists.
|
|
442
442
|
SchemaUtil.try_add(PluginSpecConstants.DEFAULT, items, parent_object[key])
|
|
443
443
|
# Set placeholder
|
|
444
|
-
SchemaUtil.try_add(
|
|
444
|
+
SchemaUtil.try_add(
|
|
445
|
+
PluginSpecConstants.PLACEHOLDER, items, parent_object[key]
|
|
446
|
+
)
|
|
445
447
|
# Set tooltip
|
|
446
448
|
SchemaUtil.try_add(PluginSpecConstants.TOOLTIP, items, parent_object[key])
|
|
447
449
|
# If the current parameter is an array (it has items contents), set the items object dict.
|
|
@@ -38,14 +38,6 @@ class CreateController(CommonFeature):
|
|
|
38
38
|
kwargs.get("target_dir"),
|
|
39
39
|
)
|
|
40
40
|
|
|
41
|
-
def interactive_prompt_spec(self) -> PluginSpecTypes.Spec:
|
|
42
|
-
# TODO: Implement interactive create
|
|
43
|
-
self.logger.warning(
|
|
44
|
-
"Creating a plugin spec interactively is not yet supported. "
|
|
45
|
-
"Please create a plugin.spec.yaml"
|
|
46
|
-
)
|
|
47
|
-
return {"": ""}
|
|
48
|
-
|
|
49
41
|
def spec_to_file(self, spec: PluginSpecTypes.Spec, plugin_dir: str):
|
|
50
42
|
with open(
|
|
51
43
|
os.path.join(plugin_dir, "plugin.spec.yaml"), "w", encoding=FILE_ENCODING
|
|
@@ -75,8 +67,7 @@ class CreateController(CommonFeature):
|
|
|
75
67
|
spec = PluginSpecUtil.get_spec_file(self._spec_path)
|
|
76
68
|
else:
|
|
77
69
|
# TODO
|
|
78
|
-
|
|
79
|
-
spec = self.interactive_prompt_spec()
|
|
70
|
+
print("No spec file provided")
|
|
80
71
|
|
|
81
72
|
# The target directory will CONTAIN the top-level directory containing all plugin content.
|
|
82
73
|
# The target directory IS NOT the top-level plugin directory itself.
|
{insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/create/help/help_util.py
RENAMED
|
@@ -50,7 +50,7 @@ class HelpUtil:
|
|
|
50
50
|
item.get(PluginSpecConstants.ENUM, "None"),
|
|
51
51
|
item.get(PluginSpecConstants.EXAMPLE, "None"),
|
|
52
52
|
item.get(PluginSpecConstants.PLACEHOLDER, "None"),
|
|
53
|
-
item.get(PluginSpecConstants.TOOLTIP, "None")
|
|
53
|
+
item.get(PluginSpecConstants.TOOLTIP, "None"),
|
|
54
54
|
]
|
|
55
55
|
elif table_type == TableHeaders.OUTPUT_HEADERS:
|
|
56
56
|
next_row = [
|
{insight_plugin-1.3.0 → insight_plugin-1.5.0}/insight_plugin/features/create/plugin_to_helpmd.py
RENAMED
|
@@ -61,6 +61,11 @@ class ConvertPluginToHelp(BaseLoggingFeature):
|
|
|
61
61
|
:param spec: dictionary of the plugin
|
|
62
62
|
:return: format string with components place holder where needed
|
|
63
63
|
"""
|
|
64
|
+
|
|
65
|
+
# Not really markdown related but it's nice to bundle with the others
|
|
66
|
+
self.check_if_not_in_spec("sdk")
|
|
67
|
+
self.check_if_not_in_spec("connection_version")
|
|
68
|
+
|
|
64
69
|
# Plugin Description
|
|
65
70
|
self.build_markdown_meta_helper(
|
|
66
71
|
PluginSpecConstants.PLUGIN_DESCRIPTION,
|
|
@@ -109,12 +114,12 @@ class ConvertPluginToHelp(BaseLoggingFeature):
|
|
|
109
114
|
markdown_obj = ConvertPluginToHelp.add_any_custom_types(spec, markdown_obj)
|
|
110
115
|
|
|
111
116
|
# Plugin-wide troubleshooting
|
|
112
|
-
|
|
117
|
+
self.build_markdown_meta_helper(
|
|
118
|
+
PluginSpecConstants.PLUGIN_TROUBLESHOOTING,
|
|
119
|
+
ConvertPluginToHelp.add_text,
|
|
120
|
+
1,
|
|
113
121
|
markdown_obj,
|
|
114
|
-
2,
|
|
115
|
-
HelpMappings.SECTION_TITLES[PluginSpecConstants.PLUGIN_TROUBLESHOOTING],
|
|
116
122
|
)
|
|
117
|
-
self.add_troubleshooting(components, markdown_obj)
|
|
118
123
|
|
|
119
124
|
# Version History
|
|
120
125
|
self.build_markdown_meta_helper(
|
|
@@ -199,6 +204,7 @@ class ConvertPluginToHelp(BaseLoggingFeature):
|
|
|
199
204
|
def add_troubleshooting(
|
|
200
205
|
self, components: [Tuple[PluginComponent, dict]], markdown_obj: MdUtils
|
|
201
206
|
):
|
|
207
|
+
# TODO - This doesn't work!! - I think we can just delete this / seems like its for connection/component specific troubleshooting which we dont do
|
|
202
208
|
"""
|
|
203
209
|
Adds troubleshooting info for connections and components
|
|
204
210
|
:param components: components in this spec
|
|
@@ -52,14 +52,35 @@ class ExportController(CommonFeature):
|
|
|
52
52
|
|
|
53
53
|
# first build the base image
|
|
54
54
|
print("Beginning export.. ")
|
|
55
|
-
self.logger.info("Starting Build Sequence")
|
|
55
|
+
self.logger.info("Starting Build Sequence / Building docker image")
|
|
56
56
|
self._build_image()
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
if self.check_for_existing_plg(self.target_dir):
|
|
59
|
+
SafeTempDirectory.execute_safe_dir(self._safe_export, self.target_dir, True)
|
|
60
|
+
print("Export process complete!")
|
|
61
|
+
else:
|
|
62
|
+
print("Export process failed!")
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
def check_for_existing_plg(self, plugin_dir: str) -> bool:
|
|
65
|
+
"""
|
|
66
|
+
Simple helper method to check if a .plg already exists in the current plugin dir
|
|
67
|
+
|
|
68
|
+
:param plugin_dir: Name of the plugin dir
|
|
61
69
|
|
|
62
|
-
|
|
70
|
+
:return: False if file exists, else True
|
|
71
|
+
"""
|
|
72
|
+
# List contents in plugin directory
|
|
73
|
+
dir_contents = os.listdir(plugin_dir)
|
|
74
|
+
for file in dir_contents:
|
|
75
|
+
if file.endswith(".plg"):
|
|
76
|
+
self.logger.critical(
|
|
77
|
+
"A .plg exists in the current directory, please delete old .plg file before running export"
|
|
78
|
+
)
|
|
79
|
+
return False
|
|
80
|
+
|
|
81
|
+
return True
|
|
82
|
+
|
|
83
|
+
def _safe_export(self, tmpdirname: str) -> None:
|
|
63
84
|
"""
|
|
64
85
|
|
|
65
86
|
:param tmpdirname: temporary directory name to save files in while exporting
|
|
@@ -95,7 +116,7 @@ class ExportController(CommonFeature):
|
|
|
95
116
|
troubleshooting="Verify write permissions for the target directory.",
|
|
96
117
|
) from error
|
|
97
118
|
|
|
98
|
-
def _build_plugin_tarball(self, dest_name: str, cmd: str):
|
|
119
|
+
def _build_plugin_tarball(self, dest_name: str, cmd: str) -> None:
|
|
99
120
|
"""
|
|
100
121
|
Build a plugin tarball from an existing image
|
|
101
122
|
:param dest_name: filename for the resulting tarball
|
|
@@ -112,7 +133,7 @@ class ExportController(CommonFeature):
|
|
|
112
133
|
troubleshooting="Check the log for details",
|
|
113
134
|
)
|
|
114
135
|
|
|
115
|
-
def _compress_file(self, src_name: str, dest_name: str):
|
|
136
|
+
def _compress_file(self, src_name: str, dest_name: str) -> None:
|
|
116
137
|
"""
|
|
117
138
|
Compress a file with gzip
|
|
118
139
|
:param src_name: filename to be compressed
|
|
@@ -123,7 +144,7 @@ class ExportController(CommonFeature):
|
|
|
123
144
|
with gzip.open(dest_name, "wb", compresslevel=6) as f_out:
|
|
124
145
|
shutil.copyfileobj(f_in, f_out)
|
|
125
146
|
|
|
126
|
-
def _build_image(self):
|
|
147
|
+
def _build_image(self) -> None:
|
|
127
148
|
# simply a short function to break export down into smaller steps
|
|
128
149
|
self._builder = Builder.new_from_cli(
|
|
129
150
|
BuilderOperation.TARBALL,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: insight-plugin
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: Plugin tooling for the Rapid7 Insight platform
|
|
5
5
|
Home-page: https://github.com/rapid7/insight-plugin
|
|
6
6
|
Author: Rapid7 Integrations Alliance
|
|
@@ -20,6 +20,23 @@ License-File: LICENSE
|
|
|
20
20
|
|
|
21
21
|
## Commands
|
|
22
22
|
|
|
23
|
+
### Analysis
|
|
24
|
+
Run Static Code Analysis on the plugin.
|
|
25
|
+
|
|
26
|
+
This command will run the static code analysis check on the plugin.
|
|
27
|
+
|
|
28
|
+
### Linter
|
|
29
|
+
Run the linter check on the plugin.
|
|
30
|
+
|
|
31
|
+
This command will run the `black` linter on the plugin and return any
|
|
32
|
+
formatting issues with the plugin.
|
|
33
|
+
|
|
34
|
+
### Checks
|
|
35
|
+
Run analysis, linter and validate on the plugin.
|
|
36
|
+
|
|
37
|
+
This will allow you to recreate, locally, all the github checks that get run
|
|
38
|
+
on plugins.
|
|
39
|
+
|
|
23
40
|
### Create
|
|
24
41
|
Create a new plugin.
|
|
25
42
|
|
|
@@ -43,10 +43,6 @@ insight_plugin/features/export/__init__.py
|
|
|
43
43
|
insight_plugin/features/export/controller.py
|
|
44
44
|
insight_plugin/features/export/util/__init__.py
|
|
45
45
|
insight_plugin/features/export/util/util.py
|
|
46
|
-
insight_plugin/features/interactive/__init__.py
|
|
47
|
-
insight_plugin/features/interactive/controller.py
|
|
48
|
-
insight_plugin/features/interactive/util/__init__.py
|
|
49
|
-
insight_plugin/features/interactive/util/util.py
|
|
50
46
|
insight_plugin/features/linter/__init__.py
|
|
51
47
|
insight_plugin/features/linter/controller.py
|
|
52
48
|
insight_plugin/features/refresh/__init__.py
|
|
@@ -105,7 +101,6 @@ tests/test_create.py
|
|
|
105
101
|
tests/test_export.py
|
|
106
102
|
tests/test_gen_samples.py
|
|
107
103
|
tests/test_help_creation.py
|
|
108
|
-
tests/test_interactive.py
|
|
109
104
|
tests/test_json_generate.py
|
|
110
105
|
tests/test_refresh.py
|
|
111
106
|
tests/test_run.py
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
from insight_plugin import VERSION
|
|
2
|
-
import sys
|
|
3
|
-
from insight_plugin.features.create.controller import CreateController
|
|
4
|
-
from insight_plugin.features.validate.controller import ValidateController
|
|
5
|
-
from insight_plugin.features.refresh.controller import RefreshController
|
|
6
|
-
from insight_plugin.features.run.run_controller import RunController
|
|
7
|
-
from insight_plugin.features.export.controller import ExportController
|
|
8
|
-
from typing import Tuple, Optional, Union
|
|
9
|
-
from insight_plugin.constants import SubcommandDescriptions
|
|
10
|
-
from insight_plugin.features.interactive.util.util import (
|
|
11
|
-
retrieve_bool_input,
|
|
12
|
-
retrieve_path_input,
|
|
13
|
-
retrieve_jq_input,
|
|
14
|
-
create_and_refresh_cli_controller,
|
|
15
|
-
export_cli_controller,
|
|
16
|
-
run_cli_controller,
|
|
17
|
-
validate_cli_controller,
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class _Option(object):
|
|
22
|
-
def __init__(self, title: str, description: str):
|
|
23
|
-
self.title = title
|
|
24
|
-
self.description = description
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
# TODO: Make this dynamic instead of hardcoded
|
|
28
|
-
_OPTIONS = [
|
|
29
|
-
# 1
|
|
30
|
-
_Option(title="Create", description=SubcommandDescriptions.CREATE_DESCRIPTION),
|
|
31
|
-
# 2
|
|
32
|
-
_Option(title="Refresh", description=SubcommandDescriptions.REFRESH_DESCRIPTION),
|
|
33
|
-
# 3
|
|
34
|
-
_Option(title="Run", description=SubcommandDescriptions.RUN_DESCRIPTION),
|
|
35
|
-
# 4
|
|
36
|
-
_Option(title="Validate", description=SubcommandDescriptions.VALIDATE_DESCRIPTION),
|
|
37
|
-
# 5
|
|
38
|
-
_Option(title="Export", description=SubcommandDescriptions.EXPORT_DESCRIPTION),
|
|
39
|
-
]
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
class InteractiveController(object):
|
|
43
|
-
@staticmethod
|
|
44
|
-
def prompt_menu():
|
|
45
|
-
"""
|
|
46
|
-
This function handles the main functionality of printing
|
|
47
|
-
the menu and retrieving the user input
|
|
48
|
-
:return:
|
|
49
|
-
"""
|
|
50
|
-
print(InteractiveController._get_interactive_menu_text())
|
|
51
|
-
|
|
52
|
-
selection = None
|
|
53
|
-
try:
|
|
54
|
-
selection = int(input())
|
|
55
|
-
except ValueError:
|
|
56
|
-
sys.exit(1)
|
|
57
|
-
|
|
58
|
-
InteractiveController._route_selection(selection=selection)
|
|
59
|
-
|
|
60
|
-
@staticmethod
|
|
61
|
-
def _route_selection(selection: int):
|
|
62
|
-
"""
|
|
63
|
-
Handles the routing based on the user input
|
|
64
|
-
:param selection: The users selection.
|
|
65
|
-
:return:
|
|
66
|
-
"""
|
|
67
|
-
if selection == 1:
|
|
68
|
-
(
|
|
69
|
-
path_to_spec,
|
|
70
|
-
target_dir,
|
|
71
|
-
verbose,
|
|
72
|
-
) = InteractiveController._get_create_refresh_controller_menu()
|
|
73
|
-
|
|
74
|
-
controller = create_and_refresh_cli_controller(
|
|
75
|
-
controller_name=CreateController,
|
|
76
|
-
path_to_spec=path_to_spec,
|
|
77
|
-
verbose=verbose,
|
|
78
|
-
target_dir=target_dir,
|
|
79
|
-
)
|
|
80
|
-
controller.create()
|
|
81
|
-
|
|
82
|
-
if selection == 2:
|
|
83
|
-
(
|
|
84
|
-
path_to_spec,
|
|
85
|
-
target_dir,
|
|
86
|
-
verbose,
|
|
87
|
-
) = InteractiveController._get_create_refresh_controller_menu()
|
|
88
|
-
|
|
89
|
-
controller = create_and_refresh_cli_controller(
|
|
90
|
-
controller_name=RefreshController,
|
|
91
|
-
path_to_spec=path_to_spec,
|
|
92
|
-
verbose=verbose,
|
|
93
|
-
target_dir=target_dir,
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
controller.refresh()
|
|
97
|
-
|
|
98
|
-
if selection == 3:
|
|
99
|
-
(
|
|
100
|
-
json_target,
|
|
101
|
-
target_dir,
|
|
102
|
-
verbose,
|
|
103
|
-
assessment,
|
|
104
|
-
is_test,
|
|
105
|
-
jq,
|
|
106
|
-
) = InteractiveController._get_run_controller_menu()
|
|
107
|
-
|
|
108
|
-
controller = run_cli_controller(
|
|
109
|
-
controller_name=RunController,
|
|
110
|
-
verbose=verbose,
|
|
111
|
-
target_dir=target_dir,
|
|
112
|
-
assessment=assessment,
|
|
113
|
-
test=is_test,
|
|
114
|
-
jq=jq,
|
|
115
|
-
json_files=json_target,
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
controller.run()
|
|
119
|
-
|
|
120
|
-
if selection == 4:
|
|
121
|
-
path_to_spec = InteractiveController._get_validate_controller_menu()
|
|
122
|
-
|
|
123
|
-
controller = validate_cli_controller(
|
|
124
|
-
controller_name=ValidateController, path_to_spec=path_to_spec
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
controller.validate()
|
|
128
|
-
|
|
129
|
-
if selection == 5:
|
|
130
|
-
(
|
|
131
|
-
no_pull,
|
|
132
|
-
verbose,
|
|
133
|
-
target_dir,
|
|
134
|
-
) = InteractiveController._get_export_controller_menu()
|
|
135
|
-
|
|
136
|
-
controller = export_cli_controller(
|
|
137
|
-
controller_name=ExportController,
|
|
138
|
-
target_dir=target_dir,
|
|
139
|
-
no_pull=no_pull,
|
|
140
|
-
verbose=verbose,
|
|
141
|
-
)
|
|
142
|
-
|
|
143
|
-
controller.export()
|
|
144
|
-
|
|
145
|
-
else:
|
|
146
|
-
sys.exit(1)
|
|
147
|
-
|
|
148
|
-
@staticmethod
|
|
149
|
-
def _get_interactive_menu_text() -> str:
|
|
150
|
-
"""
|
|
151
|
-
This method generates the initial interactive menu text.
|
|
152
|
-
It produces a welcome statement and iterates through all
|
|
153
|
-
potential options for the user.
|
|
154
|
-
:return: The welcome menu
|
|
155
|
-
:rtype: str
|
|
156
|
-
"""
|
|
157
|
-
menu = f"Welcome to insight-plugin {VERSION}!\n\nWhat would you like to do?\n"
|
|
158
|
-
|
|
159
|
-
for num, option in enumerate(_OPTIONS, start=1):
|
|
160
|
-
menu += f"{num}. [{option.title}] - {option.description}\n"
|
|
161
|
-
|
|
162
|
-
menu += "\nChoose a menu item from above or press any other key to exit: "
|
|
163
|
-
|
|
164
|
-
return menu
|
|
165
|
-
|
|
166
|
-
@staticmethod
|
|
167
|
-
def _get_create_refresh_controller_menu() -> Tuple[str, Union[str, None], bool]:
|
|
168
|
-
"""
|
|
169
|
-
A function to prompt the user to provide a path to the plugin spec
|
|
170
|
-
file, target directory & verbose for the create & refresh subcommand.
|
|
171
|
-
:return: Tuple containing path to spec file, target directory & verbose boolean.
|
|
172
|
-
"""
|
|
173
|
-
|
|
174
|
-
# Handle path to spec file input
|
|
175
|
-
path_to_spec = retrieve_path_input("plugin.spec.yaml")
|
|
176
|
-
|
|
177
|
-
# Handle target directory input
|
|
178
|
-
target_dir = retrieve_path_input("target directory")
|
|
179
|
-
|
|
180
|
-
# Handle verbose input
|
|
181
|
-
verbose = retrieve_bool_input("verbose")
|
|
182
|
-
|
|
183
|
-
return path_to_spec, target_dir, verbose
|
|
184
|
-
|
|
185
|
-
@staticmethod
|
|
186
|
-
def _get_validate_controller_menu() -> str:
|
|
187
|
-
"""
|
|
188
|
-
Method to handle inputs for the validate command.
|
|
189
|
-
:return: Path to the plugin.spec.yaml file
|
|
190
|
-
"""
|
|
191
|
-
|
|
192
|
-
# Handle path to spec file input
|
|
193
|
-
path_to_spec = retrieve_path_input("plugin.spec.yaml")
|
|
194
|
-
|
|
195
|
-
return path_to_spec
|
|
196
|
-
|
|
197
|
-
@staticmethod
|
|
198
|
-
def _get_run_controller_menu() -> Tuple[
|
|
199
|
-
str,
|
|
200
|
-
Union[str, None],
|
|
201
|
-
bool,
|
|
202
|
-
bool,
|
|
203
|
-
bool,
|
|
204
|
-
Optional[str],
|
|
205
|
-
]:
|
|
206
|
-
"""
|
|
207
|
-
Method to handle the run subcommand inputs.
|
|
208
|
-
:return: User inputs for verbose, target_dir, assessment, is_test, jq & json_target
|
|
209
|
-
"""
|
|
210
|
-
|
|
211
|
-
# Handle json_files input
|
|
212
|
-
json_target = retrieve_path_input("json_files")
|
|
213
|
-
|
|
214
|
-
# Handle target directory input
|
|
215
|
-
target_dir = retrieve_path_input("target directory")
|
|
216
|
-
|
|
217
|
-
# Handle verbose input
|
|
218
|
-
verbose = retrieve_bool_input("verbose")
|
|
219
|
-
|
|
220
|
-
# Handle assessment input
|
|
221
|
-
assessment = retrieve_bool_input("assessment")
|
|
222
|
-
|
|
223
|
-
# Handle is_test input
|
|
224
|
-
is_test = retrieve_bool_input("is_test")
|
|
225
|
-
|
|
226
|
-
# Handle jq input
|
|
227
|
-
jq = retrieve_jq_input(switch=retrieve_bool_input("jq"))
|
|
228
|
-
|
|
229
|
-
return json_target, target_dir, verbose, assessment, is_test, jq
|
|
230
|
-
|
|
231
|
-
@staticmethod
|
|
232
|
-
def _get_export_controller_menu() -> Tuple[bool, bool, Union[str, None]]:
|
|
233
|
-
"""
|
|
234
|
-
Method to handle the export subcommand inputs.
|
|
235
|
-
:return: User inputs for no_pull, verbose & target directory
|
|
236
|
-
"""
|
|
237
|
-
|
|
238
|
-
# Handle target directory input
|
|
239
|
-
target_dir = retrieve_path_input("target directory")
|
|
240
|
-
|
|
241
|
-
# Handle verbose input
|
|
242
|
-
verbose = retrieve_bool_input("verbose")
|
|
243
|
-
|
|
244
|
-
# Handle no pull input
|
|
245
|
-
no_pull = retrieve_bool_input("--no-pull")
|
|
246
|
-
|
|
247
|
-
return no_pull, verbose, target_dir
|