mirror of
https://github.com/ammaraskar/pyCraft.git
synced 2024-11-22 02:08:56 +01:00
Merge branch 'master' into nbt_exploit
This commit is contained in:
commit
88787e2568
@ -143,7 +143,7 @@ class Connection(object):
|
|||||||
# the server.
|
# the server.
|
||||||
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
self.socket.connect((self.options.address, self.options.port))
|
self.socket.connect((self.options.address, self.options.port))
|
||||||
self.file_object = self.socket.makefile()
|
self.file_object = self.socket.makefile("rb")
|
||||||
|
|
||||||
def _handshake(self, next_state=2):
|
def _handshake(self, next_state=2):
|
||||||
handshake = packets.HandShakePacket()
|
handshake = packets.HandShakePacket()
|
||||||
|
@ -35,7 +35,7 @@ def encrypt_token_and_secret(pubkey, verification_token, shared_secret):
|
|||||||
def generate_verification_hash(server_id, shared_secret, public_key):
|
def generate_verification_hash(server_id, shared_secret, public_key):
|
||||||
verification_hash = sha1()
|
verification_hash = sha1()
|
||||||
|
|
||||||
verification_hash.update(server_id)
|
verification_hash.update(server_id.encode('utf-8'))
|
||||||
verification_hash.update(shared_secret)
|
verification_hash.update(shared_secret)
|
||||||
verification_hash.update(public_key)
|
verification_hash.update(public_key)
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class Encryption(unittest.TestCase):
|
|||||||
|
|
||||||
def test_generate_hash(self):
|
def test_generate_hash(self):
|
||||||
verification_hash = generate_verification_hash(
|
verification_hash = generate_verification_hash(
|
||||||
b"", "secret".encode('utf-8'), self.public_key)
|
u"", "secret".encode('utf-8'), self.public_key)
|
||||||
self.assertEquals("1f142e737a84a974a5f2a22f6174a78d80fd97f5",
|
self.assertEquals("1f142e737a84a974a5f2a22f6174a78d80fd97f5",
|
||||||
verification_hash)
|
verification_hash)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user