def main(conf=None): """Creates the window repator, initializing the databases and the git repository.""" tab_lst = OrderedDict() tab_lst["Mission"] = copy(MISSION) tab_lst["Auditors"] = dict( lst=copy(PEOPLE), db=DBHandler.auditors(), add_fct=add_people) tab_lst["Clients"] = dict( lst=copy(PEOPLE), db=DBHandler.clients(), add_fct=add_people) tab_lst["Vulns"] = dict(vulns={"class": Vulns, "arg": ( copy(VULNS), DBHandler.vulns(), add_vuln)}) copyfile(DB_VULNS, DB_VULNS_INITIAL) # as we don't use arguments, I prefer to use python-fire app = QApplication([]) window = Window('Repator', tab_lst) Git() # this allows us to have a directory for every mission with a file that can # be automatically configured # then, just use repator.py --conf=path or repator.py path (or nothing to # use default) if conf is not None: if path.exists(conf): config = ConfigParser() config.optionxform = str config.read(conf) window.load_dict({s: dict(config.items(s)) for s in config.sections()}) else: window.load_dict({}) window.showMaximized() app.exec_()
def init_tab(self): self.tabw = QTabWidget() tab_lst = copy(VULNS_INITIAL), DBHandler.vulns(), DBHandler.vulns_git( ), add_vuln_initial obj = ObjectsGit("vulns", tab_lst, self) self.tabw.addTab(obj, "Vulns") tab_lst = copy(AUDITORS_INITIAL), DBHandler.auditors( ), DBHandler.auditors_git(), add_auditor_initial obj = ObjectsGit("auditors", tab_lst, self) self.tabw.addTab(obj, "Auditors") tab_lst = copy(AUDITORS_INITIAL), DBHandler.clients( ), DBHandler.clients_git(), add_auditor_initial obj = ObjectsGit("clients", tab_lst, self) self.tabw.addTab(obj, "Clients")
def main(args): """Main process.""" clean_db(DBHandler.auditors(), DB_AUDITORS_DEFAULT) clean_db(DBHandler.clients(), DB_CLIENTS_DEFAULT) clean_db(DBHandler.vulns(), DB_VULNS_DEFAULT, LANGUAGES)