def check_duplicate(self): # Appends a number if vector with the same name exists s = search_object("Name", self.data.get("Name"), "Vector") while s is not None: if self.data.get("Name").split(' ')[-1].isdigit(): new = self.data.get("Name").rsplit(' ', 1) self.data["Name"] = new[0] + " " + str(int(new[1]) + 1) else: self.data["Name"] = self.data.get("Name") + " 1" s = search_object("Name", self.data.get("Name"), "Vector")
def __init__(self, name=None, description=None, start_time=None, end_time=None, root_directory=None, red_team_folder=None, white_team_folder=None, blue_team_folder=None, lead_status=None, lead_ip_address=None, connections=None): super().__init__() # Search event configuration in Database s = search_object("Event Name", "event configuration", "EventConfiguration") # If it doesn't exist in database, add it to Database. Else, instantiate object with data from search result if s is None: self.data = { "Event Name": name, "Description": description, "Event Start Time": start_time, "Event End Time": end_time, "Root Directory": root_directory, "Red Team Folder": red_team_folder, "White Team Folder": white_team_folder, "Blue Team Folder": blue_team_folder, "Lead Status": lead_status, "Lead IP Address": lead_ip_address, "Connections": connections } add_object(self.data, "EventConfiguration") else: self.data = s
def __init__(self, _id=None, name=None): super().__init__() self.signal = pyqtSignal() if _id is not None: self.data = search_object("_id", _id, "Vector") elif name is not None: self.data = search_object("Name", name, "Vector") else: self.data = { "Name": "untitled", "Description": "", "Graph ID": "", "Significant Log Entries": [] } # self.create_graph() self.add()
def __init__(self, filepath, _id=None): super().__init__() self.signal = pyqtSignal() if _id is not None: self.data = search_object("_id", _id, "LogFile") else: s = search_object("Filepath", filepath, "LogFile") if s is not None: self.data = s else: self.data = { "Filename": filepath.split('/')[-1], "Filepath": filepath, "Cleanse_Flag": False, "Validation_Flag": False, "Ingestion_Flag": False, "Acknowledgement_Flag": False, } self.add()
def add(self): add_object(self.data, "Graph") self.data = search_object("Name", self.data.get("Name"), "Graph")
def add(self): add_object(self.data, "LogFile") self.data = search_object("Name", self.data.get("Filename"), "LogFile")
def add(self): self.create_graph() self.check_duplicate() add_object(self.data, "Vector") self.data = search_object("Name", self.data.get("Name"), "Vector")