def Connections(Complete_File, Input, Plugin_Name, Link, Domain, Result_Type, Task_ID, DB_Title, Concat_Plugin_Name, **kwargs): try: Plugin_Name = str(Plugin_Name) Complete_File = str(Complete_File) Input = str(Input) if "Dump_Types" in kwargs: Dump_Types = kwargs["Dump_Types"] Title = "Data for input: " + Input + ", found by Scrummage plugin " + Plugin_Name + ".\nData types include: " + ", ".join( Dump_Types) + ".\nAll data is stored in " + Complete_File + "." Ticket_Subject = "Scrummage " + Plugin_Name + " results for query " + Input + "." Ticket_Text = "Results were identified for the search " + Input + " performed by the Scrummage plugin " + Plugin_Name + ".\nThe following types of sensitive data were found:\n - " + "\n - ".join( Dump_Types ) + ". Please ensure these results do not pose a threat to your organisation, and take the appropriate action necessary if they pose a security risk. The result data is stored in a file located at " + Complete_File + "." else: Title = "Data for input: " + Input + ", found by Scrummage plugin " + Plugin_Name + ".\nAll data is stored in " + Complete_File + "." Ticket_Subject = "Scrummage " + Plugin_Name + " results for query " + Input + "." Ticket_Text = "Results were identified for the search " + Input + " performed by the Scrummage plugin " + Plugin_Name + ". Please ensure these results do not pose a threat to your organisation, and take the appropriate action necessary if they pose a security risk. The result data is stored in a file located at " + Complete_File + "." except: logging.warning(Date() + " Error setting variables.") Connectors.Scumblr_Main(Input, DB_Title, Title) Connectors.RTIR_Main(Ticket_Subject, Ticket_Text) Connectors.JIRA_Main(Ticket_Subject, Ticket_Text) Connectors.Email_Main(Ticket_Subject, Ticket_Text) Connectors.Slack_Main(Ticket_Text) Relative_File = Complete_File.replace( os.path.dirname(os.path.realpath('__file__')), "") logging.info(Date() + " Adding item to Scrummage database.") if DB_Title: Connectors.Main_Database_Insert(DB_Title, Plugin_Name, Domain, Link, Result_Type, Relative_File, Task_ID) Connectors.Elasticsearch_Main(DB_Title, Plugin_Name, Domain, Link, Result_Type, Relative_File, Task_ID, Concat_Plugin_Name) Connectors.CSV_Output(DB_Title, Plugin_Name, Domain, Link, Result_Type, Relative_File, Task_ID) Connectors.DOCX_Output(DB_Title, Plugin_Name, Domain, Link, Result_Type, Relative_File, Task_ID) Connectors.Defect_Dojo_Output(DB_Title, Ticket_Text) else: Connectors.Main_Database_Insert(Plugin_Name, Plugin_Name, Domain, Link, Result_Type, Relative_File, Task_ID) Connectors.Elasticsearch_Main(Plugin_Name, Plugin_Name, Domain, Link, Result_Type, Relative_File, Task_ID, Concat_Plugin_Name) Connectors.CSV_Output(Plugin_Name, Plugin_Name, Domain, Link, Result_Type, Relative_File, Task_ID) Connectors.DOCX_Output(Plugin_Name, Plugin_Name, Domain, Link, Result_Type, Relative_File, Task_ID) Connectors.Defect_Dojo_Output(Plugin_Name, Ticket_Text)
def Output(self, Complete_File_List, Link, DB_Title, Directory_Plugin_Name, **kwargs): try: Text_Complete_Files = "\n- ".join(Complete_File_List) if kwargs.get("Dump_Types"): self.Dump_Types = kwargs["Dump_Types"] Joined_Dump_Types = ", ".join(Dump_Types) self.Title = f"Data for input: {self.Input}, found by Scrummage plugin {self.Plugin_Name}.\nData types include: {Joined_Dump_Types}.\nAll data is stored in\n- {Text_Complete_Files}." self.Ticket_Subject = f"Scrummage {self.Plugin_Name} results for query {self.Input}." NL_Joined_Dump_Types = "\n- ".join(Dump_Types) self.Ticket_Text = f"Results were identified for the search {self.Input} performed by the Scrummage plugin {self.Plugin_Name}.\nThe following types of sensitive data were found:\n- {NL_Joined_Dump_Types}. Please ensure these results do not pose a threat to your organisation, and take the appropriate action necessary if they pose a security risk.\n\nResult data can be found in the following output files:\n- {Text_Complete_Files}." else: self.Title = f"Data for input: {self.Input}, found by Scrummage plugin {self.Plugin_Name}.\nAll data is stored in the files:\n- {Text_Complete_Files}." self.Ticket_Subject = f"Scrummage {self.Plugin_Name} results for query {self.Input}." self.Ticket_Text = f"Results were identified for the search {self.Input} performed by the Scrummage plugin {self.Plugin_Name}. Please ensure these results do not pose a threat to your organisation, and take the appropriate action necessary if they pose a security risk.\n\nResult data can be found in the following output files:\n- {Text_Complete_Files}." except: logging.warning( f"{Date()} General Library - Error setting unique variables.") logging.info( f"{Date()} General Library - Adding item to Scrummage database and other configured outputs." ) CSV_File = Connectors.CSV_Output(DB_Title, self.Plugin_Name, self.Domain, Link, self.Result_Type, ", ".join(Complete_File_List), self.Task_ID, Directory_Plugin_Name) DOCX_File = Connectors.DOCX_Output(DB_Title, self.Plugin_Name, self.Domain, Link, self.Result_Type, "\n".join(Complete_File_List), self.Task_ID, Directory_Plugin_Name) if CSV_File: Complete_File_List.append(CSV_File) if DOCX_File: Complete_File_List.append(DOCX_File) Relative_File_List = [] for File in Complete_File_List: Relative_File = File.replace( os.path.dirname(os.path.realpath('__file__')), "") Relative_File_List.append(Relative_File) Connectors.Main_Database_Insert(DB_Title, self.Plugin_Name, self.Domain, Link, self.Result_Type, ", ".join(Relative_File_List), self.Task_ID) Connectors.Elasticsearch_Main(DB_Title, self.Plugin_Name, self.Domain, Link, self.Result_Type, ", ".join(Complete_File_List), self.Task_ID, self.Concat_Plugin_Name) Connectors.Defect_Dojo_Output(DB_Title, self.Ticket_Text) Connectors.Scumblr_Main(self.Input, DB_Title, self.Title) Connectors.RTIR_Main(self.Ticket_Subject, self.Ticket_Text) Connectors.JIRA_Main(self.Ticket_Subject, self.Ticket_Text) Connectors.Email_Main(self.Ticket_Subject, self.Ticket_Text) Connectors.Slack_Main(self.Ticket_Text)