Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- import hashlib
- def md5(n):
- return bytes(hashlib.md5(bytes(str(n), 'utf-8')).hexdigest(),'utf-8')
- def sha512(n):
- return bytes(hashlib.sha512(bytes(str(n), 'utf-8')).hexdigest(),'utf-8')
- if __name__ == '__main__':
- # Create a TCP/IP socket
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- BufferSize = 1024
- # Connect the socket to the port where the server is listening
- server_address = ('35.204.90.89', 5555)
- sock.connect(server_address)
- question = sock.recv(BufferSize)[:-2]
- print(question)
- for i in range(1, 100000):
- hashValue = md5(i)
- if hashValue == question:
- sock.send(sha512(i + 1) + b'\r\n')
- break
- autorith = sock.recv(BufferSize)
- print(autorith)
- sock.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement