@@ 825-893 (lines=69) @@ | ||
822 | XML = 'a994b278-1f62-11e1-96ac-406186ea4fc5' |
|
823 | ||
824 | ||
825 | def get_report_format_id_from_string( |
|
826 | report_format: Optional[str], |
|
827 | ) -> Optional[ReportFormatType]: |
|
828 | """Convert an report format name into a ReportFormatType instance""" |
|
829 | if not report_format: |
|
830 | return None |
|
831 | ||
832 | report_format = report_format.lower() |
|
833 | ||
834 | if report_format == 'anonymous xml': |
|
835 | return ReportFormatType.ANONYMOUS_XML |
|
836 | ||
837 | if report_format == 'arf': |
|
838 | return ReportFormatType.ARF |
|
839 | ||
840 | if report_format == 'cpe': |
|
841 | return ReportFormatType.CPE |
|
842 | ||
843 | if report_format == 'csv hosts': |
|
844 | return ReportFormatType.CSV_HOSTS |
|
845 | ||
846 | if report_format == 'csv results': |
|
847 | return ReportFormatType.CSV_RESULTS |
|
848 | ||
849 | if report_format == 'gcr pdf': |
|
850 | return ReportFormatType.GCR_PDF |
|
851 | ||
852 | if report_format == 'gsr html': |
|
853 | return ReportFormatType.GSR_HTML |
|
854 | ||
855 | if report_format == 'gsr pdf': |
|
856 | return ReportFormatType.GSR_PDF |
|
857 | ||
858 | if report_format == 'gxcr pdf': |
|
859 | return ReportFormatType.GXCR_PDF |
|
860 | ||
861 | if report_format == 'gxr pdf': |
|
862 | return ReportFormatType.GXR_PDF |
|
863 | ||
864 | if report_format == 'itg': |
|
865 | return ReportFormatType.ITG |
|
866 | ||
867 | if report_format == 'latex': |
|
868 | return ReportFormatType.LATEX |
|
869 | ||
870 | if report_format == 'nbe': |
|
871 | return ReportFormatType.NBE |
|
872 | ||
873 | if report_format == 'pdf': |
|
874 | return ReportFormatType.PDF |
|
875 | ||
876 | if report_format == 'svg': |
|
877 | return ReportFormatType.SVG |
|
878 | ||
879 | if report_format == 'txt': |
|
880 | return ReportFormatType.TXT |
|
881 | ||
882 | if report_format == 'verinice ism': |
|
883 | return ReportFormatType.VERINICE_ISM |
|
884 | ||
885 | if report_format == 'verinice itg': |
|
886 | return ReportFormatType.VERINICE_ITG |
|
887 | ||
888 | if report_format == 'xml': |
|
889 | return ReportFormatType.XML |
|
890 | ||
891 | raise InvalidArgument( |
|
892 | argument='report_format', |
|
893 | function=get_report_format_id_from_string.__name__, |
|
894 | ) |
|
895 | ||
896 |
@@ 593-661 (lines=69) @@ | ||
590 | XML = 'a994b278-1f62-11e1-96ac-406186ea4fc5' |
|
591 | ||
592 | ||
593 | def get_report_format_id_from_string( |
|
594 | report_format: Optional[str], |
|
595 | ) -> Optional[ReportFormatType]: |
|
596 | """Convert an report format name into a ReportFormatType instance""" |
|
597 | if not report_format: |
|
598 | return None |
|
599 | ||
600 | report_format = report_format.lower() |
|
601 | ||
602 | if report_format == 'anonymous xml': |
|
603 | return ReportFormatType.ANONYMOUS_XML |
|
604 | ||
605 | if report_format == 'arf': |
|
606 | return ReportFormatType.ARF |
|
607 | ||
608 | if report_format == 'cpe': |
|
609 | return ReportFormatType.CPE |
|
610 | ||
611 | if report_format == 'csv hosts': |
|
612 | return ReportFormatType.CSV_HOSTS |
|
613 | ||
614 | if report_format == 'csv results': |
|
615 | return ReportFormatType.CSV_RESULTS |
|
616 | ||
617 | if report_format == 'gcr pdf': |
|
618 | return ReportFormatType.GCR_PDF |
|
619 | ||
620 | if report_format == 'gsr html': |
|
621 | return ReportFormatType.GSR_HTML |
|
622 | ||
623 | if report_format == 'gsr pdf': |
|
624 | return ReportFormatType.GSR_PDF |
|
625 | ||
626 | if report_format == 'gxcr pdf': |
|
627 | return ReportFormatType.GXCR_PDF |
|
628 | ||
629 | if report_format == 'gxr pdf': |
|
630 | return ReportFormatType.GXR_PDF |
|
631 | ||
632 | if report_format == 'itg': |
|
633 | return ReportFormatType.ITG |
|
634 | ||
635 | if report_format == 'latex': |
|
636 | return ReportFormatType.LATEX |
|
637 | ||
638 | if report_format == 'nbe': |
|
639 | return ReportFormatType.NBE |
|
640 | ||
641 | if report_format == 'pdf': |
|
642 | return ReportFormatType.PDF |
|
643 | ||
644 | if report_format == 'svg': |
|
645 | return ReportFormatType.SVG |
|
646 | ||
647 | if report_format == 'txt': |
|
648 | return ReportFormatType.TXT |
|
649 | ||
650 | if report_format == 'verinice ism': |
|
651 | return ReportFormatType.VERINICE_ISM |
|
652 | ||
653 | if report_format == 'verinice itg': |
|
654 | return ReportFormatType.VERINICE_ITG |
|
655 | ||
656 | if report_format == 'xml': |
|
657 | return ReportFormatType.XML |
|
658 | ||
659 | raise InvalidArgument( |
|
660 | argument='report_format', |
|
661 | function=get_report_format_id_from_string.__name__, |
|
662 | ) |
|
663 | ||
664 |