def user_login(self): self.fname = request.form['fname'] self.lname = request.form['lname'] self.gmail = request.form['gmail'] self.gender = request.form['gender'] self.fpassword = request.form['fpassword'] self.lpassword = request.form['lpassword'] self.loginOrSigin = 'login' if self.fpassword != self.lpassword: self.error = self.errors['eynideyil'] return redirect(url_for('user')) elif (self.gmail, ) in sql.Sql().select(select='gmail'): self.error = self.errors['gmailzanit'] return redirect(url_for('user')) else: sql.Sql().insert(column="fName, lName, gender, gmail, password", value=(self.fname, self.lname, self.gender, self.gmail, self.fpassword)) self.resp = make_response(redirect(url_for('form'))) self.resp.set_cookie('gmail', self.gmail) self.resp.set_cookie('password', self.fpassword) session['gmail'] = self.gmail session['password'] = self.fpassword self.inUser = sql.Sql().select( where= f"gmail = '{self.gmail}' and password = '******'") return self.resp
def admin(self): self.users = sql.Sql().select() self.notReady = sql.Sql(tableName="notReady").select() self.ready = sql.Sql(tableName="ready").select() return render_template("admin.html", users=self.users, notReady=self.notReady, ready=self.ready)
def setCookies(self): if self.inUser == []: self.gmail = request.cookies.get('gmail') self.password = request.cookies.get('password') if (self.gmail, self.password) in sql.Sql().select( select='gmail, password'): self.inUser = sql.Sql().select( where= f"gmail = '{self.gmail}' and password = '******'")
def contents(self, statusId): self.setCookies() self.statusId = statusId self.title = sql.Sql(tableName='ready').select( where=f"id = '{self.statusId}'") self.contents = sql.Sql(tableName='contents').select( where=f"statusId = '{self.statusId}'") return render_template("contents.html", titles=self.title, contents=self.contents, userName=self.inUser[0][1])
def notReadySend(self): self.id = request.form['id'] self.userId = request.form['userId'] self.userName = request.form['userName'] self.title = request.form['title'] self.thema = request.form['thema'] self.content = request.form['content'] sql.Sql(tableName='ready').insert( column="usersId, userName, title, thema, content", value=(self.userId, self.userName, self.title, self.thema, self.content)) sql.Sql(tableName='notReady').delete('id', self.id) return '0'
def add(self): self.fname = request.form['fname'] self.lname = request.form['lname'] self.gender = request.form['gender'] self.gmail = request.form['gmail'] self.password = request.form['password'] self.status = request.form['userStatus'] sql.Sql().insert( column="fName, lName, gender, gmail, password, status", value=(self.fname, self.lname, self.gender, self.gmail, self.password, self.status)) userId = sql.Sql().select(select='Id', where=f"gmail = '{self.gmail}'") return str(userId[0][0])
def __init__(self,email='',password='',pid=''): #设置log文件 self.logger=logging.getLogger() handler=logging.FileHandler("renren.log") formatter = logging.Formatter('%(asctime)s %(lineno)d %(message)s') handler.setFormatter(formatter) self.logger.addHandler(handler) self.logger.setLevel(logging.ERROR) self.email=email; self.password=password; self.session=requests.session(); self.session.headers.update({'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4 ( .NET CLR 3.5.30729; .NET4.0C)' # ,'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' # ,'Accept-Language':'zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3' # ,'Accept-Encoding':'gzip, deflate' # ,'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8' # ,'X-Requested-With':'XMLHttpRequest' # ,'Referer':' http://www.renren.com/' ,'Connection':'keep-alive'}) self.token = {} self.data=[] self.pid=pid self.cookie='cookie_'+self.pid self.sq=sql.Sql() self.hj=0
def __init__(self): super().__init__() self.ui = newMatchMain() self.ui.setupUi(self) self.stadiums = list() self.setWindowTitle("Создание матча") self.ui.backButton.clicked.connect(self.backButton_clicked) self.ui.createButton.clicked.connect(self.createButton_clicked) self.ui.teamCombo.currentIndexChanged.connect(self.teamComboHandler) self.db = sql.Sql("football_club") self.ui.teamCombo.clear() self.ui.teamCombo.addItem("") self.ui.date.setDate(QtCore.QDate.currentDate()) self.ui.date.setMinimumDate(QtCore.QDate.currentDate()) self.stadiums = list() self.stadiums.append("") self.db.cursor.execute( "SELECT Команда, ID_стадиона FROM Команды where Команда != 'Манчестер Юнайтед' order by Команда ASC" ) row = self.db.cursor.fetchone() while (row is not None): self.ui.teamCombo.addItem(row[0].rstrip()) self.stadiums.append(row[1]) row = self.db.cursor.fetchone() self.ui.stadiumCombo.clear() for elem in self.stadiums: if elem == "": self.ui.stadiumCombo.addItem(elem) continue self.db.cursor.execute( "SELECT Название from Стадионы where ID_стадиона =" + str(elem)) row = self.db.cursor.fetchone() val = row[0] self.ui.stadiumCombo.addItem(val)
def __init__(self): super().__init__() self.ui = Doc_lk() self.ui.setupUi(self) self.setWindowTitle("Medical Clinic -- для врача") if user_info.admin: self.ui.admin_menu_button.clicked.connect( self.admin_menu_button_clicked) else: self.ui.admin_menu_button.setVisible(False) self.db = sql.Sql() self.setInitialValues() self.ui.change_nummer_button.clicked.connect( self.change_nummer_button_clicked) self.ui.exit_button.clicked.connect(self.exit_button_clicked) self.ui.add_record_Button.clicked.connect( self.add_record_Button_clicked) self.ui.patients_comboBox.currentIndexChanged.connect( self.patients_change) self.ui.form_queue_button.clicked.connect( self.form_queue_button_clicked) self.ui.show_all_med_record_button.clicked.connect( self.show_all_med_records) self.ui.change_med_record_button.clicked.connect( self.change_med_record) self.ui.date_med_record_button.clicked.connect(self.show_by_date) self.show()
def __init__(self, config): self._sql = sql.Sql(config['host'], config['port'], config['user'], config['pwd'], config['db']) self._sql.connect_sql() self._client = PushClient(config['clinet_ip'], config['push_port'], config['req_port']) self._last_voucher_no = 0
def __init__(self): super().__init__() self.ui = teacher_lk() self.ui.setupUi(self) self.setWindowTitle("Teacher window") # if user_info.admin : # self.ui.admin_menu_button.clicked.connect(self.admin_menu_button_clicked) # else: # self.ui.admin_menu_button.setVisible(False) self.db = sql.Sql() self.setInitialValues() self.ui.numGroupsWIthMarksButton.clicked.connect( self.numGroupsWIthMarksClicked) self.ui.addUserPushButton.clicked.connect(self.addUserClicked) self.ui.studentNameComboBox.currentIndexChanged.connect( self.studentName_changed) self.ui.teacherNameComboBox.currentIndexChanged.connect( self.studentName_changed) self.ui.SubjectComboBox.currentIndexChanged.connect( self.studentName_changed) self.ui.addMarkPushButton.clicked.connect(self.addMarkClicked) self.ui.copyGroupButton.clicked.connect(self.copyGroupClicked) self.ui.turnGroupBackButton.clicked.connect(self.turnGroupBackClicked) self.ui.yearComboBox.currentIndexChanged.connect(self.yearChanged) self.ui.avgMarksInIntervalButton.clicked.connect( self.avgMarksInIntervalClicked) self.ui.saveIntervalButton.clicked.connect(self.saveIntervalClicked) self.ui.groupComboBox.currentIndexChanged.connect( self.groupComboBox_changed) self.ui.minAvgMarkFromTeacherButton.clicked.connect( self.minAvgMarkFromTeacherClicked) self.ui.newNameForSubjectButton.clicked.connect( self.newNameForSubjectClicked) self.ui.getPerfomanceButton.clicked.connect(self.getPerfomanceClicked) self.ui.savePerfomanceButton.clicked.connect( self.savePerfomanceClicked) self.ui.deleteStudentWithSmallMarksButton.clicked.connect( self.deleteStudentWithSmallMarksClicked) self.ui.deleteSmallMarkGroupButton.clicked.connect( self.deleteSmallMarkGroupClicked) self.ui.notdeletingGroupIfTheyHave3SubjectsButton.clicked.connect( self.notdeletingGroupIfTheyHave3SubjectClicked) self.ui.changeAndDeleteSubjectButton.clicked.connect( self.changeAndDeleteSubjectClicked) self.ui.deleteStudentButton.clicked.connect(self.deleteStudentClicked) self.ui.groupComboBox1.currentIndexChanged.connect( self.subjectWithSmallestAvgMarkClicked) self.ui.changeNameOfGroupButton.clicked.connect( self.changeNameOfGroupClicked) self.ui.avoidDeletingTeachersButton.clicked.connect( self.avoidDeletingTeachersChanged) self.show()
def enterButton_clicked(self): l = self.ui.loginLine.text() p = self.ui.passwordLine.text() if (l.strip() == ''): message = "Поле логина пустое! Введите логин!" error_message = QtWidgets.QErrorMessage(self) error_message.setModal(True) error_message.setWindowTitle("Ошибка входа") error_message.showMessage(message) if len(l) != 0: self.ui.loginLine.clear() self.ui.passwordLine.clear() elif (p.strip() == ''): message = "Поле пароля пустое! Введите пароль!" error_message = QtWidgets.QErrorMessage(self) error_message.setModal(True) error_message.setWindowTitle("Ошибка входа") error_message.showMessage(message) if len(p) != 0: self.ui.passwordLine.clear() elif (l.find(' ') != -1): message = "Недопустимый символ в поле логина. Проверьте правильность данных и повторите вход." error_message = QtWidgets.QErrorMessage(self) error_message.setModal(True) error_message.setWindowTitle("Ошибка входа") error_message.showMessage(message) self.ui.loginLine.clear() self.ui.passwordLine.clear() elif (p.find(' ') != -1): message = "Данного пользователя не существует или введен неверный пароль! Проверьте правильность данных и повторите вход." error_message = QtWidgets.QErrorMessage(self) error_message.setModal(True) error_message.setWindowTitle("Ошибка входа") error_message.showMessage(message) self.ui.passwordLine.clear() else: self.db = sql.Sql("football_club") status, role, id = self.db.checkPassword(l, p) self.db.cnxn.close() if (status == False): message = "Данного пользователя не существует или введен неверный пароль! Проверьте правильность данных и повторите вход." error_message = QtWidgets.QErrorMessage(self) error_message.setModal(True) error_message.setWindowTitle("Ошибка входа") error_message.showMessage(message) self.ui.passwordLine.clear() else: properties.current_role = role properties.current_userID = id if properties.current_role == 1: self.menu = managerMenuWindow.managerMenuWindow() elif properties.current_role == 2: self.menu = coachMenuWindow.coachMenuWindow() elif properties.current_role == 3: self.menu = playerMenuWindow.playerMenuWindow() elif properties.current_role == 4: self.menu = menuFanWindow.menuFanWindow() self.menu.show() self.close()
def yoxla(self): self.icerik = request.form.get('icerik') sql.Sql(tableName='contents').insert( column= 'statusId, userId, userName, userGender, userStatus, content', value=(self.statusId, self.inUser[0][0], self.inUser[0][1], self.inUser[0][4], self.inUser[0][5], self.icerik)) return 'True'
def showPassword_pressed(self): self.db = sql.Sql("football_club") self.db.cursor.execute( "SELECT Пароль FROM Пользователи where ID_пользователя =" + str(properties.current_userID)) row = self.db.cursor.fetchone() p = self.cipher.decrypt(str.encode(row[0])).decode('utf8') self.ui.passwordLabel.setText(p) self.db.cnxn.close()
def __init__(self): super().__init__() self.ui = contractMain() self.ui.setupUi(self) self.fid = 0 self.setWindowTitle("Контракт") self.ui.backButton.clicked.connect(self.backButton_clicked) self.ui.createAccountButton.clicked.connect(self.create_clicked) self.db = sql.Sql("football_club")
def LockModulOnly(self, cfg): send = sendMessage.sendMessage() send.setConfig(cfg.token, cfg.chatId, cfg.sleepTime, cfg.newMessageAfter) while 1 == 1: Sql = sql.Sql() create = createMessage.createMessage() Sql.startSQL(cfg, "lockmodul", "lure_expiration") create.create(Sql, "lockmodul", cfg.hours) send.sendMessageLockmodul(create.message)
def rocketStopsOnly(self, cfg): send = sendMessage.sendMessage() send.setConfig(cfg.token, cfg.chatId, cfg.sleepTime, cfg.newMessageAfter) while 1 == 1: Sql = sql.Sql() create = createMessage.createMessage() Sql.startSQL(cfg, "rocket", "incident_expiration") create.create(Sql, "rocket", cfg.hours) send.sendMessageRocket(create.message)
def __init__(self): super().__init__() self.ui = loginmain() self.ui.setupUi(self) self.setWindowTitle("Вход") self.ui.sign_in_button.clicked.connect(self.sign_in_button_clicked) self.ui.sign_up_button.clicked.connect(self.sign_up_button_clicked) self.ui.password_lineEdit.setEchoMode(QLineEdit.Password) self.db = sql.Sql()
def __init__(self): super().__init__() self.ui = knowledgesMain() self.ui.setupUi(self) header = self.ui.teamsTable.horizontalHeader() header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents) header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents) header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) header.setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeToContents) header.setSectionResizeMode(5, QtWidgets.QHeaderView.ResizeToContents) header.setSectionResizeMode(6, QtWidgets.QHeaderView.ResizeToContents) header = self.ui.coachesTable.horizontalHeader() header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch) header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents) header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) header.setSectionResizeMode(3, QtWidgets.QHeaderView.Stretch) header = self.ui.ownersTable.horizontalHeader() header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch) header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents) header.setSectionResizeMode(2, QtWidgets.QHeaderView.Stretch) header = self.ui.stadiumsTable.horizontalHeader() header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents) header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents) header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents) header.setSectionResizeMode(3, QtWidgets.QHeaderView.ResizeToContents) header.setSectionResizeMode(4, QtWidgets.QHeaderView.ResizeToContents) header.setSectionResizeMode(5, QtWidgets.QHeaderView.ResizeToContents) self.setWindowTitle("База знаний") self.ui.tabWidget.setCurrentIndex(0) self.ui.backButton.clicked.connect(self.backButton_clicked) self.ui.tabWidget.currentChanged.connect(self.tabChangedHandler) self.db = sql.Sql("football_club") self.db.cursor.execute( "SELECT k.Команда, k.Страна, k.Город, s.Название, t.ФИО, v.ФИО, k.Контакты FROM Команды k " "join Стадионы s on s.ID_стадиона = k.ID_стадиона " "left join Тренеры_и_персонал t on t.ID_специалиста= k.ID_главного_тренера " "left join Руководство v on v.ID_владельца = k.ID_владельца") row = self.db.cursor.fetchone() i = 0 while (row is not None): self.ui.teamsTable.setRowCount(self.ui.teamsTable.rowCount() + 1) item = QtWidgets.QTableWidgetItem() self.ui.teamsTable.setVerticalHeaderItem(i, item) for j in range(7): if (row[j] is None): self.ui.teamsTable.setItem(i, j, QtWidgets.QTableWidgetItem("-")) elif (((j == 5) or (j == 4)) and row[j].rstrip() == "Другой"): self.ui.teamsTable.setItem(i, j, QtWidgets.QTableWidgetItem("-")) else: self.ui.teamsTable.setItem(i, j, QtWidgets.QTableWidgetItem(str(row[j]).rstrip())) self.ui.teamsTable.item(i, j).setFlags(QtCore.Qt.NoItemFlags) row = self.db.cursor.fetchone() i += 1
def notready(self): self.konu = request.form['konu'] self.thema = request.form['thema'] self.icerik = request.form['icerik'] sql.Sql(tableName='notReady').insert( column="usersId, userName, title, thema, content", value=(self.inUser[0][0], self.inUser[0][1], self.konu, self.thema, self.icerik)) return redirect(url_for('form'))
def nuller(self, cfg, gmt): send = sendMessage.sendMessage() send.setConfig(cfg.token, cfg.ivchatId, cfg.chatId, cfg.areaName) sys.stdout.write("\x1b]2;%s\x07" % cfg.areaName) while 1 == 1: Sql = sql.Sql() Sql.startSQL(cfg, "0er") send.clearOutputList(Sql.encounter_id) create = createMessage.createMessage() create.create(Sql, send, cfg.sleepTime, cfg, gmt) time.sleep(int(cfg.sleepTime))
def full(self, cfg): send = sendMessage.sendMessage() send.setConfig(cfg.token, cfg.chatId, cfg.sleepTime, cfg.newMessageAfter) while 1 == 1: Sql = sql.Sql() create = createMessage.createMessage() Sql.startSQL(cfg, "rocket", "incident_expiration") create.create(Sql, "rocket", cfg.hours) Sql.startSQL(cfg, "lockmodul", "lure_expiration") create.create(Sql, "lockmodul", cfg.hours) send.sendMessageFull(create)
def enter_button_clicked(self): l = self.ui.login_line.text() p = self.ui.password_line.text() if (l.strip() == ''): message = "Поле логина пустое! Введите логин!" error_message = QtWidgets.QErrorMessage(self) error_message.setModal(True) error_message.setWindowTitle("Ошибка входа") error_message.showMessage(message) if len(l) != 0: self.ui.login_line.clear() self.ui.password_line.clear() elif (p.strip() == ''): message = "Поле пароля пустое! Введите пароль!" error_message = QtWidgets.QErrorMessage(self) error_message.setModal(True) error_message.setWindowTitle("Ошибка входа") error_message.showMessage(message) if len(p) != 0: self.ui.password_line.clear() elif (l.find(' ') != -1): message = "Недопустимый символ в поле логина. Проверьте правильность данных и повторите вход." error_message = QtWidgets.QErrorMessage(self) error_message.setModal(True) error_message.setWindowTitle("Ошибка входа") error_message.showMessage(message) self.ui.login_line.clear() self.ui.password_line.clear() elif (p.find(' ') != -1): message = "Данного пользователя не существует или введен неверный пароль! " \ "Проверьте правильность данных и повторите вход." error_message = QtWidgets.QErrorMessage(self) error_message.setModal(True) error_message.setWindowTitle("Ошибка входа") error_message.showMessage(message) self.ui.password_line.clear() else: self.db = sql.Sql() status, id, login = self.db.check_password(l, p) self.db.cnxn.close() if (status == False): message = "Данного пользователя не существует или введен неверный пароль! Проверьте правильность данных и повторите вход." error_message = QtWidgets.QErrorMessage(self) error_message.setModal(True) error_message.setWindowTitle("Ошибка входа") error_message.showMessage(message) self.ui.password_line.clear() else: properties.current_userID = id properties.current_login = login self.menu = menu.Menu() self.menu.show() self.close()
def __init__(self): super().__init__() self.ui = sign_up() self.ui.setupUi(self) self.setWindowTitle("Регистрация нового пациента") self.db = sql.Sql() self.ui.password_lineEdit.setEchoMode(QLineEdit.Password) self.ui.check_password_lineEdit.setEchoMode(QLineEdit.Password) self.ui.back_button.clicked.connect(self.back_button_clicked) self.ui.sign_up_button.clicked.connect(self.sign_up_button_clicked)
def user_sigin(self): self.gmail = request.form['gmail'] self.password = request.form['password'] if (self.gmail, self.password) in sql.Sql().select(select='gmail, password'): self.inUser = sql.Sql().select( where=f"gmail = '{self.gmail}' and password = '******'" ) session['gmail'] = self.gmail session['password'] = self.password self.resp = make_response(redirect(url_for('form'), code=307)) self.resp.set_cookie('gmail', self.gmail) self.resp.set_cookie('password', self.password) return self.resp self.error = self.errors["sigin"] self.loginOrSigin = 'sigin' return redirect(url_for('user'))
def form(self): self.setCookies() if self.inUser == []: return redirect(url_for('user')) self.error = self.errors['true'] self.content = sql.Sql(tableName="ready").select() self.content.reverse() return render_template("form.html", content=self.content, user=self.inUser)
def __init__(self, conn=None): #pass in conn for testing purposes try: with open('config.json', 'r') as f: self.config = json.load(f, encoding='utf8') if not conn: self.conn = sql.Sql(self.config['database']['name']) else: self.conn = conn if not self.conn.get_one( "SELECT name FROM sqlite_master WHERE type='table';"): self.init_db() except Exception as e: raise Exception("can not setup service") from e
def __init__(self): super().__init__() self.ui = newCoachMain() self.ui.setupUi(self) self.setWindowTitle("Добавление нового работника") self.ui.backButton.clicked.connect(self.backButton_clicked) self.ui.myTeamCheckBox.stateChanged.connect(self.myTeamCheckHandler) self.ui.showPasswordCheckBox.stateChanged.connect(self.checkboxHandler) self.ui.enterButton.clicked.connect(self.enterButton_clicked) self.ui.dontCreateCheckBox.stateChanged.connect(self.dontCreateHandler) self.db = sql.Sql("football_club") self.ui.teamCombo.clear() self.ui.teamCombo.addItem("Манчестер Юнайтед")
def edit(self): self.id = request.form['id'] self.fname = request.form['fname'] self.lname = request.form['lname'] self.gender = request.form['gender'] self.gmail = request.form['gmail'] self.password = request.form['password'] self.status = request.form['userStatus'] sql.Sql().update(SET=( f"Id = '{self.id}', fName = '{self.fname}', lName = '{self.lname}', gender = '{self.gender}', gmail = '{self.gmail}', password = '******', status = '{self.status}'" ), WHERE=f"Id = '{self.id}'") return '0'
def run(self): if '--verbose' in sys.argv: self.output.test('Injection Attacks...') try: rfi.Rfi(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, links=self.links, cookie=self.cookie).run() xss.Xss(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, links=self.links, cookie=self.cookie).run() php.PHP(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, links=self.links, cookie=self.cookie).run() sql.Sql(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, links=self.links, cookie=self.cookie).run() ldap.Ldap(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, links=self.links, cookie=self.cookie).run() html.Html(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, links=self.links, cookie=self.cookie).run() xpath.Xpath(agent=self.agent, proxy=self.proxy, redirect=self.redirect, timeout=self.timeout, links=self.links, cookie=self.cookie).run() except Exception, e: pass