Code Duplication    Length = 60-60 lines in 2 locations

gvm/protocols/gmpv7/gmpv7.py 1 location

@@ 3368-3427 (lines=60) @@
3365
        cmd.set_attribute("details", "1")
3366
        return self._send_xml_command(cmd)
3367
3368
    def get_nvts(
3369
        self,
3370
        *,
3371
        details: Optional[bool] = None,
3372
        preferences: Optional[bool] = None,
3373
        preference_count: Optional[bool] = None,
3374
        timeout: Optional[bool] = None,
3375
        config_id: Optional[str] = None,
3376
        preferences_config_id: Optional[str] = None,
3377
        family: Optional[str] = None,
3378
        sort_order: Optional[str] = None,
3379
        sort_field: Optional[str] = None,
3380
    ):
3381
        """Request a list of nvts
3382
3383
        Arguments:
3384
            details: Whether to include full details
3385
            preferences: Whether to include nvt preferences
3386
            preference_count: Whether to include preference count
3387
            timeout: Whether to include the special timeout preference
3388
            config_id: UUID of scan config to which to limit the NVT listing
3389
            preferences_config_id: UUID of scan config to use for preference
3390
                values
3391
            family: Family to which to limit NVT listing
3392
            sort_order: Sort order
3393
            sort_field: Sort field
3394
3395
        Returns:
3396
            The response. See :py:meth:`send_command` for details.
3397
        """
3398
        cmd = XmlCommand("get_nvts")
3399
3400
        if details is not None:
3401
            cmd.set_attribute("details", _to_bool(details))
3402
3403
        if preferences is not None:
3404
            cmd.set_attribute("preferences", _to_bool(preferences))
3405
3406
        if preference_count is not None:
3407
            cmd.set_attribute("preference_count", _to_bool(preference_count))
3408
3409
        if timeout is not None:
3410
            cmd.set_attribute("timeout", _to_bool(timeout))
3411
3412
        if config_id:
3413
            cmd.set_attribute("config_id", config_id)
3414
3415
        if preferences_config_id:
3416
            cmd.set_attribute("preferences_config_id", preferences_config_id)
3417
3418
        if family:
3419
            cmd.set_attribute("family", family)
3420
3421
        if sort_order:
3422
            cmd.set_attribute("sort_order", sort_order)
3423
3424
        if sort_field:
3425
            cmd.set_attribute("sort_field", sort_field)
3426
3427
        return self._send_xml_command(cmd)
3428
3429
    def get_nvt(self, nvt_oid: str):
3430
        """Request a single nvt

gvm/protocols/gmpv208/gmpv208.py 1 location

@@ 5034-5093 (lines=60) @@
5031
        cmd.set_attribute("details", "1")
5032
        return self._send_xml_command(cmd)
5033
5034
    def get_nvts(
5035
        self,
5036
        *,
5037
        details: Optional[bool] = None,
5038
        preferences: Optional[bool] = None,
5039
        preference_count: Optional[bool] = None,
5040
        timeout: Optional[bool] = None,
5041
        config_id: Optional[str] = None,
5042
        preferences_config_id: Optional[str] = None,
5043
        family: Optional[str] = None,
5044
        sort_order: Optional[str] = None,
5045
        sort_field: Optional[str] = None,
5046
    ):
5047
        """Request a list of nvts
5048
5049
        Arguments:
5050
            details: Whether to include full details
5051
            preferences: Whether to include nvt preferences
5052
            preference_count: Whether to include preference count
5053
            timeout: Whether to include the special timeout preference
5054
            config_id: UUID of scan config to which to limit the NVT listing
5055
            preferences_config_id: UUID of scan config to use for preference
5056
                values
5057
            family: Family to which to limit NVT listing
5058
            sort_order: Sort order
5059
            sort_field: Sort field
5060
5061
        Returns:
5062
            The response. See :py:meth:`send_command` for details.
5063
        """
5064
        cmd = XmlCommand("get_nvts")
5065
5066
        if details is not None:
5067
            cmd.set_attribute("details", _to_bool(details))
5068
5069
        if preferences is not None:
5070
            cmd.set_attribute("preferences", _to_bool(preferences))
5071
5072
        if preference_count is not None:
5073
            cmd.set_attribute("preference_count", _to_bool(preference_count))
5074
5075
        if timeout is not None:
5076
            cmd.set_attribute("timeout", _to_bool(timeout))
5077
5078
        if config_id:
5079
            cmd.set_attribute("config_id", config_id)
5080
5081
        if preferences_config_id:
5082
            cmd.set_attribute("preferences_config_id", preferences_config_id)
5083
5084
        if family:
5085
            cmd.set_attribute("family", family)
5086
5087
        if sort_order:
5088
            cmd.set_attribute("sort_order", sort_order)
5089
5090
        if sort_field:
5091
            cmd.set_attribute("sort_field", sort_field)
5092
5093
        return self._send_xml_command(cmd)
5094
5095
    def get_nvt(self, nvt_oid: str):
5096
        """Request a single nvt