Exemple #1
0
    def login(self, e):
        username = self.usernameField.getText()
        password = self.passwordField.getText()

        fields = [username, password]

        if isFieldsEmpty(fields):
            dialog.improperInput('One or more fields are missing!', 'No Input')
        else:
            client.login(username, password)
            method = 'refresh'
            callMethod = getattr(TopPanel(), method)
Exemple #2
0
def login():
    if request.method != "POST":
        current_user = session.get('username')
        if current_user:
            flash("info 请勿重复登录! 您已登录,请勿重复登录")
            return redirect(url_for('main_page'))
        else:
            return render_template("login.html",
                                   user_id=None,
                                   username=None,
                                   privilege=None
                                   )

    else:
        element = ('user_id', 'password')

        for item in element:
            if item not in request.form:
                flash("danger 登录失败! 未知登录错误")
                return redirect(url_for('login'))

        res = client.login(request.form['user_id'], request.form['password'])
        if res == 1:
            flash("success 登录成功! 已自动跳转到首页")
            res = client.query_profile(request.form['user_id']).split(' ')
            session['username'] = res[0]
            session['user_id'] = int(request.form['user_id'])
            session['privilege'] = int(res[3])
            return redirect(url_for('main_page'))
        else:
            flash("danger 登录失败! 用户ID或密码错误")
            return redirect(url_for('login'))
Exemple #3
0
    def login(self):
        box = QtWidgets.QMessageBox()
        user_name = self.lineEdit.text()
        passwd = self.lineEdit_2.text()
        if not re.match("^[a-zA-Z0-9_]{0,8}$", user_name):
            box.warning(self, "提示", "用户名输入格式有误!")

        elif not re.match("^[a-zA-Z0-9_]{0,15}$", passwd):
            box.warning(self, "提示", "密码输入格式有误!")

        else:
            try:
                args = dict()
                passwd = client.passwd_md5(passwd)
                args["user_name"] = user_name
                args["password"] = passwd
                a = client.login(args)
                if a == 0:
                    self.ui1 = MyQtWidgets()
                    self.ui1.show()
                    self.close()

                elif a == 1:
                    box.warning(self, "提示", "用户名不存在!")

                elif a == 3:
                    box.warning(self, "提示", "您已登录,无需重复登录!")

                else:
                    box.warning(self, "提示", "密码错误!")

            except Exception as e:
                print(e)
Exemple #4
0
	def handle_request(self, req):
		if req.path() == "/comet/meta":
			msg = json.loads(req.read_body())
			if msg["type"] == "login":
				client.login(req, msg)
			elif msg["type"] == "chat":
				chat.broadcast(req, msg)	
			else:
				# push it into the right queue
				raise Exception("not yet implemented")

		elif req.path().startswith("/comet/client/"):
			client.handle(req)
		else:
			req.response(401)
			req.write("")
Exemple #5
0
def dispatch(env, start_response):
	path = env['PATH_INFO']

	if path == "/comet/meta":
		start_response('200 OK', [('Content-Type', 'text/plain')])
		body = env['wsgi.input'].read()
		msg = json.loads(body)
		if msg["type"] == "login":
			return [client.login(msg)]
		elif msg["type"] == "chat":
			chat.broadcast(msg)
		elif msg["type"] == "universe":
			msg["user"] = client.resolve(msg["uid"])
			del msg["uid"]
			chan.basic_publish(mq.msg(msg), exchange="ex", routing_key="universe")
		else:
			# push it into the right queue
			raise Exception("not yet implemented")

		return [""]	
	elif path.startswith("/comet/client/"):
		start_response('200 OK', [('Content-Type', 'text/plain')])
		return [client.handle(env)]
	else:
		return ["401"]
Exemple #6
0
def main():
    username = input('username: '******'password: '******'t know what to do with the whole get_conf() function
    headers = cli.get_headers()
    pwn_session = requests.session()
    pwn_url = "https://cse466.pwn.college"

    client.login(pwn_url, pwn_session, username, password)

    # use the config information with the session info to make the request
    #client.work_on_chal(pwn_url, pwn_session, 101, headers)
    # attempt to submit a flag
    client.submit_flag(
        pwn_url, pwn_session, 101,
        "pwn_college{MK9noUdT-C1gNN5Spyd6IqDUexB.dFDMxwCN4UzW}", headers)
Exemple #7
0
def action_login():
    if request.method == 'POST':
        para = ("userid", "password")

        for item in para:
            if not request.form.has_key(item):
                #print item
                return ""

        result = client.login(request.form['userid'], request.form['password'])
        #print(result, len(result))
        if result == "1\n":
            session['userid'] = request.form['userid']
            return "1"
        else:
            return "0"
    return "0"
Exemple #8
0
    def OnInit(self):
        if gdata.config.game.lastlogin != None:
            login = gdata.config.game.lastlogin
        else:
            login = ""
        if gdata.config.game.lastpasswordcrypted:
            password = binascii.a2b_base64(
                gdata.config.game.lastpasswordcrypted)
        else:
            password = ""
        if gdata.config.game.lastgameid != None:
            gameID = gdata.config.game.lastgameid
        else:
            gameID = 'Alpha'

        self.loginDlg = LoginDlg(None, -1, _("Login"), login, password, gameID)
        val = self.loginDlg.ShowModal()
        if val == wx.ID_OK:
            #game = str(self.loginDlg.game.GetValue())
            login = str(self.loginDlg.login.GetValue())
            password = str(self.loginDlg.password.GetValue())
            if client.login(gameID, login, password):
                client.updateDatabase()
                gdata.config.game.lastlogin = login
                # TODO: remove in 0.6
                gdata.config.game.lastpassword = None
                #
                gdata.config.game.lastpasswordcrypted = binascii.b2a_base64(
                    password).strip()
                gdata.config.game.lastgameid = gameID
                self.frame = Messager(None, -1, _("OuterSpace Message Reader"))
                self.frame.Show()
                self.SetTopWindow(self.frame)
                self.setTimer()
            else:
                dlg = wx.MessageDialog(None, _("Login failed"), _("Error"),
                                       wx.OK | wx.ICON_EXCLAMATION)
                dlg.ShowModal()
                dlg.Destroy()

        self.loginDlg.Destroy()
        return True
def main():
    while True:
        cookies = None
        loginSuccess = False
        writeLog("Log in...")
        while not loginSuccess:
            try:
                cookies = cli.login(config)
                loginSuccess = True
            except:
                writeLog("Login failed. Retry in " + str(config.retryDelay) + " seconds...")
                time.sleep(config.retryDelay)
        writeLog("Log in ok!")
        while True:
            writeLog("Start a scan...")
            try:
                cli.ipLogout(cookies, config)
            except:
                break
            time.sleep(config.interval)
Exemple #10
0
	def OnInit(self):
		if gdata.config.game.lastlogin != None:
			login = gdata.config.game.lastlogin
		else:
			login = ""
		if gdata.config.game.lastpasswordcrypted:
			password = binascii.a2b_base64(gdata.config.game.lastpasswordcrypted)
		else:
			password = ""
		if gdata.config.game.lastgameid != None:
			gameID = gdata.config.game.lastgameid
		else:
			gameID = 'Alpha'

		self.loginDlg = LoginDlg(None, -1, _("Login"), login, password, gameID)
		val = self.loginDlg.ShowModal()
		if val == wx.ID_OK:
			#game = str(self.loginDlg.game.GetValue())
			login = str(self.loginDlg.login.GetValue())
			password = str(self.loginDlg.password.GetValue())
			if client.login(gameID, login, password):
				client.updateDatabase()
				gdata.config.game.lastlogin = login
				# TODO: remove in 0.6
				gdata.config.game.lastpassword = None
				#
				gdata.config.game.lastpasswordcrypted = binascii.b2a_base64(password).strip()
				gdata.config.game.lastgameid = gameID
				self.frame = Messager(None, -1, _("OuterSpace Message Reader"))
				self.frame.Show()
				self.SetTopWindow(self.frame)
				self.setTimer()
			else:
				dlg = wx.MessageDialog(None, _("Login failed"), _("Error"), wx.OK | wx.ICON_EXCLAMATION)
				dlg.ShowModal()
				dlg.Destroy()

		self.loginDlg.Destroy()
		return True
Logging in as:

{0} {1} ({2}, {3})
""".format(
		args.fname,
		args.lname,
		args.anumber,
		args.alias,
	)
)

#start up a session
session = client.login(
	args.fname,
	args.lname,
	args.anumber,
	args.alias,
	args.endpoint
)


while(session.gamemgr == None):
	log.info("Requesting Game List")

	#get the game list
	session, games = client.game_list(session)

	if(games != None):
		log.info("Game List Received")
		log.debug(str(games))
		
import client as cli
import time
import config

while True:
	cookies = None
	loginSuccess = False
	print("\nLog in...")
	while not loginSuccess:
		try:
			cookies = cli.login(config)
			loginSuccess = True
		except:
			print("Login failed. Retry in " + str(config.retryDelay) + " seconds...")
			time.sleep(config.retryDelay)
	print("Log in ok!")
	while True:
		print("\nStart a scan >")
		try:
			cli.ipLogout(cookies, config)
		except:
			break
		time.sleep(config.interval)
	print("\n==============================================")
Exemple #13
0
def start_worker(iteration_handler):
    client.login()
    if client.world_id:
        print("Login success!")
        main_loop(iteration_handler)
Exemple #14
0
        # Check if project config file exists
        exists = os.path.exists('ele.vate')
        if not exists:
            log('[r]Couldn\'t find project config file \'ele.vate\' 🔍@')
            log('[rD]Make sure you are in the root directory of your project@')
            log('[rD]\nYou can create a new config with command:@')
            log('[rD]    elevate init@')
            sys.exit(1)
        # Try to parse the file
        with open('ele.vate', 'r') as file:
            text = file.read()
            config = Parser(text).get()
            client.clonePath(config, newnames)
            log('[g]\n<-- Connecting with remote Elevate -->@\n')
            s = client.connect(config['addr'], config['port'])
            client.login(s, data, config)
            log('[g]\n<-- Sending Project Files -->@\n')
            zipFile = os.path.join(newnames['local-root'], newnames['zip'])
            client.sendFiles(s, zipFile)
            log('[g]\n<-- Running Server Script -->@\n')
            client.waitForServer(s)

    if args.operation == 'serve':
        s = server.listen(data)
        while True:
            client, addr = s.accept()
            isAuth = server.auth(client, data)
            if not isAuth:
                continue
            server.recvFiles(client, data, newnames)
            server.unboxProject(client, data, newnames)
Exemple #15
0
y = random.randint(0,400)
#client.login(raw_input("Enter Username: "),x,y)


size = width, height = 800, 400
screen = pygame.display.set_mode(size)
level = Level.Level(32,32)
for w in range(level.width):
    for h in range(level.height):
        if level.getTile(w,h).getId() == Tile.start1.getId():
            x = h<<3
            y = w<<0
            

username = namepicker.getRandomName()
client.login(username,x,y)
level.player = Player.Player(level,username,x,y)


lastTime = time.time()
lastTimer = time.time()
delta = 0.0
FPS = 60.0
timepertick = 1./FPS
frames = 0
ticks = 0

while Keyboard.running:

    now = time.time()
    delta += (now - lastTime) / timepertick
Exemple #16
0
#!/usr/bin/python
import client as open_jub
import getpass
import mail_util
from expected_errors import *

if __name__ == '__main__':
  token = None

  while token == None:
    try:
      user = raw_input('Username: ')
      pwd = getpass.getpass()
      token = open_jub.login(user, pwd)
    except LoginException as e:
      print e

  print "Logged in! Token: %s" % token

  me = open_jub.get_user("kkafadarov")
  sender = "*****@*****.**"
  data = "Hey boo"
  title = "Test"

  print mail_util.send_mail(me, sender, data, title)
  print open_jub.is_authenticated(token)
Exemple #17
0
#!/usr/bin/python
import client as open_jub
import getpass
import mail_util
from expected_errors import *

if __name__ == '__main__':
    token = None

    while token == None:
        try:
            user = raw_input('Username: ')
            pwd = getpass.getpass()
            token = open_jub.login(user, pwd)
        except LoginException as e:
            print e

    print "Logged in! Token: %s" % token

    me = open_jub.current_user()
    sender = "*****@*****.**"
    data = "Hey boo"
    title = "Test"

    print mail_util.send_mail(me, sender, data, title)