def start_fwbuilder(self): self.logger = Syslogger("FWBUILDER-AHTAPOT", '%(name)s %(levelname)s %(message)s', "/dev/log", self.current_user) self.filelogger = Filelogger( "FWBUILDER-AHTAPOT", '%(asctime)s %(name)s %(levelname)s %(message)s', "/var/log/ahtapot/gdys-gui.log", "a", self.current_user) self.lbl_error_start.setText("<p></p>") if start_fw.check_if_runs() == False: with open(self.full_path + "current_user.dmr", "w") as current_user: current_user.write(self.current_user) fw_path = CP.get_configs()["fw_path"] start_fw.start_fwbuilder(self.git) self.logger.send_log( "info", " Firewall Builder Started with Local settings") self.filelogger.send_log( "info", " Firewall Builder Started with Local settings") else: self.warn_if_fw_runs() subprocess.call([ "xdotool search --name \"Firewall Builder\" windowactivate windowsize 90\% 90\%" ], shell=True)
def load_new_rules(self): self.logger = Syslogger("FWBUILDER-AHTAPOT", '%(name)s %(levelname)s %(message)s', "/dev/log", self.current_user) self.filelogger = Filelogger( "FWBUILDER-AHTAPOT", '%(asctime)s %(name)s %(levelname)s %(message)s', "/var/log/ahtapot/gdys-gui.log", "a", self.current_user) self.lbl_error_start.setText("<p></p>") if start_fw.check_if_runs() is True: self.warn_if_fw_runs() else: self.progressBar.setVisible(True) self.centralwidget.setEnabled(False) self.set_progressbar() abs_path = os.path.abspath(__file__) path_list = abs_path.split("/") del path_list[-1] path_name = "/".join(path_list) full_path = path_name + "/" self.pull_repo() self.logger.send_log( "warning", " Rule Settings pulled from Master and Firewall Builder Started" ) self.filelogger.send_log( "warning", " Rule Settings pulled from Master and Firewall Builder Started" ) self.centralwidget.setEnabled(True) self.progressBar.setValue(0) self.progressBar.setVisible(False)
def warn_if_fw_runs(self): if start_fw.check_if_runs() == True: with open(self.full_path + "current_user.dmr", "r") as active_user: self.active_user = active_user.readline() self.lbl_error_start.setText( u"<b>UYARI:</b> Şuan kullanılan başka bir Firewall Builder mevcut.<br/><b>Kullanıcı : </b>" + self.active_user) self.btn_kill_fw.setEnabled(True) self.btn_con_set.setEnabled(False) else: self.btn_kill_fw.setEnabled(False)
def load_new_rules(self): self.logger = Syslogger("FWBUILDER-AHTAPOT", '%(name)s %(levelname)s %(message)s', "/dev/log", self.current_user) self.filelogger = Filelogger( "FWBUILDER-AHTAPOT", '%(asctime)s %(name)s %(levelname)s %(message)s', "/var/log/ahtapot/gdys-gui.log", "a", self.current_user) self.lbl_error_start.setText("<p></p>") if GC.check_mergerequest( self.git, CP.get_configs()["gitlab_project_id"]) == False: self.refresh_method() elif start_fw.check_if_runs() is True: self.warn_if_fw_runs() else: self.progressBar.setVisible(True) self.centralwidget.setEnabled(False) self.set_progressbar() abs_path = os.path.abspath(__file__) path_list = abs_path.split("/") del path_list[-1] path_name = "/".join(path_list) full_path = path_name + "/" if os.path.exists(full_path + "onay.dmr"): os.remove(full_path + "onay.dmr") self.pull_repo() self.logger.send_log( "warning", " Rule Settings pulled from Master and Firewall Builder Started" ) self.filelogger.send_log( "warning", " Rule Settings pulled from Master and Firewall Builder Started" ) self.lbl_merge_control.setText(u"<p></p>") self.centralwidget.setEnabled(True) self.progressBar.setValue(0) self.progressBar.setVisible(False)
app = QtGui.QApplication(sys.argv) abs_path = os.path.abspath(__file__) path_list = abs_path.split("/") del path_list[-1] path_name = "/".join(path_list) full_path = path_name + "/" app.setWindowIcon(QtGui.QIcon(full_path + "img/" + 'ahtapot_icon.png')) movie = QtGui.QMovie(full_path + "img/" + "splash.gif") splash = MovieSplashScreen(movie) splash.show() #app.aboutToQuit.connect(start_fw.kill_fw) #for commit message if start_fw.check_if_runs() is False: with open(full_path + "current_user.dmr", "w") as current_user: current_user.write(active_user) FwStartWindow = QtGui.QMainWindow() ui_start = fwstart.Ui_FwStartWindow() ui_start.setupUi(FwStartWindow) FwStartDefWindow = QtGui.QMainWindow() ui_start_def = fwstartdef.Ui_Form() ui_start_def.setupUi(FwStartDefWindow) FwAboutWindow = QtGui.QMainWindow() ui_about = fwabout.Ui_Form() ui_about.setupUi(FwAboutWindow)