From cbced2da049be5d43644134575cacdfdb8986356 Mon Sep 17 00:00:00 2001 From: RichardSchwabe Date: Mon, 17 Jul 2023 20:35:01 +0300 Subject: [PATCH] updated docs --- reptor/api/models.py | 36 ++++++++++++++++++++++++++-------- reptor/plugins/core/Conf.py | 4 ++-- reptor/plugins/core/Plugins.py | 4 ++-- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/reptor/api/models.py b/reptor/api/models.py index dccb299..0ec5553 100644 --- a/reptor/api/models.py +++ b/reptor/api/models.py @@ -70,7 +70,7 @@ def _fill_from_api(self, data: typing.Dict): cls = getattr(sys.modules[__name__], model_class) self.__setattr__(attr[0], list()) for k, v in data[attr[0]].items(): - v['name'] = k + v["name"] = k self.__getattribute__(attr[0]).append(cls(v)) else: # Fill each attribute @@ -158,6 +158,7 @@ class FindingData(BaseModel): retest_status: evidence: """ + title: str = "" cvss: str = "" summary: str = "" @@ -273,6 +274,23 @@ class ProjectFieldTypes(enum.Enum): class ProjectDesignField(BaseModel): + """ + + Attributes: + name: + type: + label: + origin: + default: + required: + spellcheck: + + properties: "ProjectDesignField" + choices: + items: + suggestions: + """ + name: str = "" type: ProjectFieldTypes = None label: str = "" @@ -288,14 +306,14 @@ class ProjectDesignField(BaseModel): suggestions: typing.List[str] = [] def _fill_from_api(self, data: typing.Dict): - if data['type'] == ProjectFieldTypes.list.value: - data['items'] = ProjectDesignField(data['items']) - elif data['type'] == ProjectFieldTypes.object.value: + if data["type"] == ProjectFieldTypes.list.value: + data["items"] = ProjectDesignField(data["items"]) + elif data["type"] == ProjectFieldTypes.object.value: properties = list() - for name, field in data['properties'].items(): - field['name'] = name + for name, field in data["properties"].items(): + field["name"] = name properties.append(ProjectDesignField(field)) - data['properties'] = properties + data["properties"] = properties attrs = typing.get_type_hints(self).keys() for key, value in data.items(): @@ -327,9 +345,10 @@ class FindingDataField(BaseModel): Finding data holds values only and does not contain type definitions. Most data types cannot be differentiated (like strings and enums). - This model joins finding data values from an acutal report with project + This model joins finding data values from an acutal report with project design field definitions. """ + value: typing.Union[ str, # cvss, string, markdown, enum, user, combobox, date typing.List, # list @@ -361,6 +380,7 @@ class FindingDataJoined(BaseModel): retest_status: evidence: """ + title: FindingDataField cvss: FindingDataField summary: FindingDataField diff --git a/reptor/plugins/core/Conf.py b/reptor/plugins/core/Conf.py index e1c4408..af7164a 100644 --- a/reptor/plugins/core/Conf.py +++ b/reptor/plugins/core/Conf.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# ------------------------------------------------------------------------------- +# --------------------------------------------------------- # Name: Conf # Purpose: Show configuration or set configuration # Author: # Created: 2022-07-18 -# ------------------------------------------------------------------------------- +# --------------------------------------------------------- from reptor.lib.plugins.ConfBase import ConfBase diff --git a/reptor/plugins/core/Plugins.py b/reptor/plugins/core/Plugins.py index 7685cdc..fb90cbc 100644 --- a/reptor/plugins/core/Plugins.py +++ b/reptor/plugins/core/Plugins.py @@ -18,14 +18,14 @@ class Plugins(Base): Create a new plugin from a template for the community or yourself. - # Arguments: + # Arguments * --search Allows you to search for a specific plugin by name and tag * --copy PLUGINNAME Copies a plugin to your local folder for development * --new PLUGINNAME Creates a new plugin based off a template and your input * --verbose Provides more information about a plugin - # Developer Notes: + # Developer Notes You can modify the `_list` method to change the output for search as well as the default output. """