示例#1
0
文件: client.py 项目: Mikeses/aiotfm
	async def login(self, username, password, encrypted=True, room='1'):
		"""|coro|
		Log in the game.

		:param username: :class:`str` the client username.
		:param password: :class:`str` the client password.
		:param encrypted: Optional[:class:`bool`] whether the password is already encrypted or not.
		:param room: Optional[:class:`str`] the room where the client will be logged in.
		"""
		if not encrypted:
			password = shakikoo(password)

		packet = Packet.new(26, 8).writeString(username).writeString(password)
		packet.writeString("app:/TransformiceAIR.swf/[[DYNAMIC]]/2/[[DYNAMIC]]/4")
		packet.writeString(room).write32(self.authkey ^ self.keys.auth).write8(0).writeString('')
		packet.cipher(self.keys.identification).write8(0)

		await self.main.send(packet)
示例#2
0
	async def login(self, user, password, encrypted=True):
		"""Logs in with the specified user."""
		if self.logged:
			raise Exception("Already logged in.")

		if not encrypted:
			password = shakikoo(password).decode()

		response = await self.perform_action({
			"rester_connecte": "on",
			"id": user,
			"pass": password,
			"redirect": self.link[:-1]
		}, "identification", "login")
		data = json.loads(await response.read())

		if "supprime" in data and data["supprime"] == "*":
			self.logged = True
			return True
		return False
示例#3
0
def test_shakikoo():
	shakikoo('password123') == b'VWVXKV+t6UtkQta9b5b4C8ZY26cAC2tEV6IKct+noTg='