@@ 660-728 (lines=69) @@ | ||
657 | cmd.add_element('copy', note_id) |
|
658 | return self._send_xml_command(cmd) |
|
659 | ||
660 | def create_override(self, text, nvt_oid, seconds_active=None, hosts=None, |
|
661 | port=None, result_id=None, severity=None, comment=None, |
|
662 | new_severity=None, task_id=None, threat=None, |
|
663 | new_threat=None): |
|
664 | """Create a new override |
|
665 | ||
666 | Arguments: |
|
667 | text (str): Text of the new override |
|
668 | nvt_id (str): OID of the nvt to which override applies |
|
669 | seconds_active (int, optional): Seconds override will be active. |
|
670 | -1 on always, 0 off |
|
671 | comment (str, optional): Comment for the override |
|
672 | hosts (list, optional): A list of host addresses |
|
673 | port (str, optional): Port to which the override applies |
|
674 | result_id (str, optional): UUID of a result to which override |
|
675 | applies |
|
676 | severity (decimal, optional): Severity to which override applies |
|
677 | new_severity (decimal, optional): New severity for result |
|
678 | task_id (str, optional): UUID of task to which override applies |
|
679 | threat (str, optional): Threat level to which override applies. Will |
|
680 | be converted to severity |
|
681 | new_threat (str, optional): New threat level for result, will be |
|
682 | converted to a new_severity |
|
683 | ||
684 | Returns: |
|
685 | The response. See :py:meth:`send_command` for details. |
|
686 | """ |
|
687 | if not text: |
|
688 | raise RequiredArgument('create_override requires a text argument') |
|
689 | ||
690 | if not nvt_oid: |
|
691 | raise RequiredArgument('create_override requires a nvt_oid ' |
|
692 | 'argument') |
|
693 | ||
694 | cmd = XmlCommand('create_override') |
|
695 | cmd.add_element('text', text) |
|
696 | cmd.add_element('nvt', attrs={'oid': nvt_oid}) |
|
697 | ||
698 | if not seconds_active is None: |
|
699 | cmd.add_element('active', str(seconds_active)) |
|
700 | ||
701 | if comment: |
|
702 | cmd.add_element('comment', comment) |
|
703 | ||
704 | if hosts: |
|
705 | cmd.add_element('hosts', ', '.join(hosts)) |
|
706 | ||
707 | if port: |
|
708 | cmd.add_element('port', port) |
|
709 | ||
710 | if result_id: |
|
711 | cmd.add_element('result', attrs={'id': result_id}) |
|
712 | ||
713 | if severity: |
|
714 | cmd.add_element('severity', severity) |
|
715 | ||
716 | if new_severity: |
|
717 | cmd.add_element('new_severity', new_severity) |
|
718 | ||
719 | if task_id: |
|
720 | cmd.add_element('task', attrs={'id': task_id}) |
|
721 | ||
722 | if threat: |
|
723 | cmd.add_element('threat', threat) |
|
724 | ||
725 | if new_threat: |
|
726 | cmd.add_element('new_threat', new_threat) |
|
727 | ||
728 | return self._send_xml_command(cmd) |
|
729 | ||
730 | def clone_override(self, override_id): |
|
731 | """Clone an existing override |
|
@@ 3557-3614 (lines=58) @@ | ||
3554 | ||
3555 | return self._send_xml_command(cmd) |
|
3556 | ||
3557 | def modify_override(self, override_id, text, seconds_active=None, |
|
3558 | hosts=None, port=None, result_id=None, severity=None, |
|
3559 | new_severity=None, task_id=None, threat=None, |
|
3560 | new_threat=None): |
|
3561 | """Modifies an existing override. |
|
3562 | ||
3563 | Arguments: |
|
3564 | override_id (str): UUID of override to modify. |
|
3565 | text (str): The text of the override. |
|
3566 | seconds_active (int, optional): Seconds override will be active. |
|
3567 | -1 on always, 0 off. |
|
3568 | hosts (list, optional): A list of host addresses |
|
3569 | port (str, optional): Port to which override applies. |
|
3570 | result_id (str, optional): Result to which override applies. |
|
3571 | severity (str, optional): Severity to which override applies. |
|
3572 | new_severity (str, optional): New severity score for result. |
|
3573 | task_id (str, optional): Task to which override applies. |
|
3574 | threat (str, optional): Threat level to which override applies. |
|
3575 | new_threat (str, optional): New threat level for results. |
|
3576 | ||
3577 | Returns: |
|
3578 | The response. See :py:meth:`send_command` for details. |
|
3579 | """ |
|
3580 | if not override_id: |
|
3581 | raise RequiredArgument('modify_override requires a override_id ' |
|
3582 | 'argument') |
|
3583 | if not text: |
|
3584 | raise RequiredArgument('modify_override requires a text argument') |
|
3585 | ||
3586 | cmd = XmlCommand('modify_override') |
|
3587 | cmd.set_attribute('override_id', override_id) |
|
3588 | cmd.add_element('text', text) |
|
3589 | ||
3590 | if not seconds_active is None: |
|
3591 | cmd.add_element('active', str(seconds_active)) |
|
3592 | ||
3593 | if hosts: |
|
3594 | cmd.add_element('hosts', ', '.join(hosts)) |
|
3595 | ||
3596 | if port: |
|
3597 | cmd.add_element('port', port) |
|
3598 | ||
3599 | if result_id: |
|
3600 | cmd.add_element('result', attrs={'id': result_id}) |
|
3601 | ||
3602 | if severity: |
|
3603 | cmd.add_element('severity', severity) |
|
3604 | ||
3605 | if new_severity: |
|
3606 | cmd.add_element('new_severity', new_severity) |
|
3607 | ||
3608 | if task_id: |
|
3609 | cmd.add_element('task', attrs={'id': task_id}) |
|
3610 | ||
3611 | if threat: |
|
3612 | cmd.add_element('threat', threat) |
|
3613 | ||
3614 | if new_threat: |
|
3615 | cmd.add_element('new_threat', new_threat) |
|
3616 | ||
3617 | return self._send_xml_command(cmd) |