@@ 726-794 (lines=69) @@ | ||
723 | cmd.add_element('copy', note_id) |
|
724 | return self._send_xml_command(cmd) |
|
725 | ||
726 | def create_override(self, text, nvt_oid, *, seconds_active=None, hosts=None, |
|
727 | port=None, result_id=None, severity=None, comment=None, |
|
728 | new_severity=None, task_id=None, threat=None, |
|
729 | new_threat=None): |
|
730 | """Create a new override |
|
731 | ||
732 | Arguments: |
|
733 | text (str): Text of the new override |
|
734 | nvt_id (str): OID of the nvt to which override applies |
|
735 | seconds_active (int, optional): Seconds override will be active. |
|
736 | -1 on always, 0 off |
|
737 | comment (str, optional): Comment for the override |
|
738 | hosts (list, optional): A list of host addresses |
|
739 | port (str, optional): Port to which the override applies |
|
740 | result_id (str, optional): UUID of a result to which override |
|
741 | applies |
|
742 | severity (decimal, optional): Severity to which override applies |
|
743 | new_severity (decimal, optional): New severity for result |
|
744 | task_id (str, optional): UUID of task to which override applies |
|
745 | threat (str, optional): Threat level to which override applies. Will |
|
746 | be converted to severity |
|
747 | new_threat (str, optional): New threat level for result, will be |
|
748 | converted to a new_severity |
|
749 | ||
750 | Returns: |
|
751 | The response. See :py:meth:`send_command` for details. |
|
752 | """ |
|
753 | if not text: |
|
754 | raise RequiredArgument('create_override requires a text argument') |
|
755 | ||
756 | if not nvt_oid: |
|
757 | raise RequiredArgument('create_override requires a nvt_oid ' |
|
758 | 'argument') |
|
759 | ||
760 | cmd = XmlCommand('create_override') |
|
761 | cmd.add_element('text', text) |
|
762 | cmd.add_element('nvt', attrs={'oid': nvt_oid}) |
|
763 | ||
764 | if not seconds_active is None: |
|
765 | cmd.add_element('active', str(seconds_active)) |
|
766 | ||
767 | if comment: |
|
768 | cmd.add_element('comment', comment) |
|
769 | ||
770 | if hosts: |
|
771 | cmd.add_element('hosts', ', '.join(hosts)) |
|
772 | ||
773 | if port: |
|
774 | cmd.add_element('port', port) |
|
775 | ||
776 | if result_id: |
|
777 | cmd.add_element('result', attrs={'id': result_id}) |
|
778 | ||
779 | if severity: |
|
780 | cmd.add_element('severity', severity) |
|
781 | ||
782 | if new_severity: |
|
783 | cmd.add_element('new_severity', new_severity) |
|
784 | ||
785 | if task_id: |
|
786 | cmd.add_element('task', attrs={'id': task_id}) |
|
787 | ||
788 | if threat: |
|
789 | cmd.add_element('threat', threat) |
|
790 | ||
791 | if new_threat: |
|
792 | cmd.add_element('new_threat', new_threat) |
|
793 | ||
794 | return self._send_xml_command(cmd) |
|
795 | ||
796 | def clone_override(self, override_id): |
|
797 | """Clone an existing override |
|
@@ 3675-3732 (lines=58) @@ | ||
3672 | ||
3673 | return self._send_xml_command(cmd) |
|
3674 | ||
3675 | def modify_override(self, override_id, text, *, seconds_active=None, |
|
3676 | hosts=None, port=None, result_id=None, severity=None, |
|
3677 | new_severity=None, task_id=None, threat=None, |
|
3678 | new_threat=None): |
|
3679 | """Modifies an existing override. |
|
3680 | ||
3681 | Arguments: |
|
3682 | override_id (str): UUID of override to modify. |
|
3683 | text (str): The text of the override. |
|
3684 | seconds_active (int, optional): Seconds override will be active. |
|
3685 | -1 on always, 0 off. |
|
3686 | hosts (list, optional): A list of host addresses |
|
3687 | port (str, optional): Port to which override applies. |
|
3688 | result_id (str, optional): Result to which override applies. |
|
3689 | severity (str, optional): Severity to which override applies. |
|
3690 | new_severity (str, optional): New severity score for result. |
|
3691 | task_id (str, optional): Task to which override applies. |
|
3692 | threat (str, optional): Threat level to which override applies. |
|
3693 | new_threat (str, optional): New threat level for results. |
|
3694 | ||
3695 | Returns: |
|
3696 | The response. See :py:meth:`send_command` for details. |
|
3697 | """ |
|
3698 | if not override_id: |
|
3699 | raise RequiredArgument('modify_override requires a override_id ' |
|
3700 | 'argument') |
|
3701 | if not text: |
|
3702 | raise RequiredArgument('modify_override requires a text argument') |
|
3703 | ||
3704 | cmd = XmlCommand('modify_override') |
|
3705 | cmd.set_attribute('override_id', override_id) |
|
3706 | cmd.add_element('text', text) |
|
3707 | ||
3708 | if not seconds_active is None: |
|
3709 | cmd.add_element('active', str(seconds_active)) |
|
3710 | ||
3711 | if hosts: |
|
3712 | cmd.add_element('hosts', ', '.join(hosts)) |
|
3713 | ||
3714 | if port: |
|
3715 | cmd.add_element('port', port) |
|
3716 | ||
3717 | if result_id: |
|
3718 | cmd.add_element('result', attrs={'id': result_id}) |
|
3719 | ||
3720 | if severity: |
|
3721 | cmd.add_element('severity', severity) |
|
3722 | ||
3723 | if new_severity: |
|
3724 | cmd.add_element('new_severity', new_severity) |
|
3725 | ||
3726 | if task_id: |
|
3727 | cmd.add_element('task', attrs={'id': task_id}) |
|
3728 | ||
3729 | if threat: |
|
3730 | cmd.add_element('threat', threat) |
|
3731 | ||
3732 | if new_threat: |
|
3733 | cmd.add_element('new_threat', new_threat) |
|
3734 | ||
3735 | return self._send_xml_command(cmd) |