コード例 #1
0
ファイル: users.py プロジェクト: wnormandin/pokeytools
def user_db_add(user):
	
	pokeylogger = logging.getLogger('pokeylogger')
	str_sql = 'INSERT INTO hgtools_users (user_ldap, user_level, user_group) '
	str_sql += 'VALUES ("{}", "{}", "{}");'.format(user, 'USER', 'NEW_USERS')
	dbsearch.hgt_query(str_sql)
	pokeylogger.info('[*] User {} added to hgtools_users'.format(user))
コード例 #2
0
ファイル: users.py プロジェクト: wnormandin/pokeytools
def user_db_log(msg, user):
	
	pokeylogger = logging.getLogger('pokeylogger')
	str_sql = 'INSERT INTO hgtools_log (log_type, log_text) '
	str_sql += 'VALUES ("{}", "{}");'.format(user, msg)
	dbsearch.hgt_query(str_sql) 
	pokeylogger.info('[*] DB Log Record Created > hgtools_log')
コード例 #3
0
ファイル: gui.py プロジェクト: wnormandin/pokeytools
	def hgt_button_exec(self, widget):
	# Execute hgtools search
		pokeylogger.debug("[*] MainWindow > Phrase Search clicked")

		if self.hgt_search_box.get_text():
			search_term=self.hgt_search_box.get_text()
			pokeylogger.debug("\t Search Term : {}".format(search_term))
			str_sql = 'SELECT hgt_code, hgt_text, hgt_desc FROM hgtools '
			str_sql += 'LEFT JOIN hgtools_codes ON hgt_code = hgtools_codes.code '
			str_sql += 'WHERE (hgt_text like "%{}%" OR hgt_code like "%{}%") GROUP BY hgt_code;'.format(search_term, search_term)
			outp=dbsearch.hgt_query(str_sql, 'phrases')

			# pokeylogger.debug("\t {}".format(outp))
			store = Gtk.ListStore(str, str, str)

			for line in outp.split('\n'):
				listed = line.split('\t')
				if listed != ['']:
					# pokeylogger.debug(listed)
					store.append(listed)

			if len(store)>0:
				search_win = SearchResultDialog(self, store)
				response = search_win.run()
				if response == Gtk.ResponseType.OK:
					pokeylogger.debug("\t Selected : {}".format(USER_SELECTION))
					search_win.destroy()
					try:
						if self.selected['hgt_dest'] == '2':
							dest = 'clipboard'
						else:
							dest = 'mouse'

						if self.selected['hgt_rtype'] == '1':
							src = 'Text'
							hgfix.hgfix_do_paste(USER_SELECTION, dest)
						else:
							src = 'HGFix URL'
							hgfix.hgfix_main(USER_SELECTION, dest)

						pokeylogger.debug("\t Response : {} - {} > {}".format(src, USER_SELECTION, dest))

					except Exception as e:
						raise
						# err_raise(e)
				else:
					pokeylogger.debug("\t User Cancelled Dialog")
					search_win.destroy()

			else:
				pokeylogger.debug("\t Term not found!")
				nf_win = InfoDialog(self, self.favicon, "Not Found", "No results for the specified search term!")
				response = nf_win.run()
				nf_win.destroy()

		else:
			pokeylogger.debug("\t No Term Specified")
			nf_win = InfoDialog(self, self.favicon, "No Term Specified", "Please enter a valid search term")
			response = nf_win.run()
			nf_win.destroy()
コード例 #4
0
ファイル: users.py プロジェクト: wnormandin/pokeytools
def user_first_logon(user):
	
	pokeylogger = logging.getLogger('pokeylogger')
	
	str_sql = 'SELECT user_level FROM hgtools_users '
	str_sql += 'WHERE user_ldap="{}"'.format(user)
	result = dbsearch.hgt_query(str_sql)
	
	try:
		pokeylogger.debug('\t User found! Access : {}'.format(result.strip('\n')))
		return False, result.strip('\n')
	except:
		return True, 'USER'