Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import re
- import socket
- import hashlib
- SERVER_IP = '54.71.128.194'
- SERVER_PORT = 99
- BUFFER = 1024
- AMOUNT_OF_LOCATIONS = 10
- KEY_PATTERN = r"0(\d\d)(.+)?$"
- LOCATION_DATA_PATTERN = r"^location data \d{1,2}\/10: (.+)$"
- def main():
- sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
- server_address = (SERVER_IP, SERVER_PORT)
- sock.connect(server_address)
- count = 0
- sock.sendall("ENT000Jupiter".encode())
- sock.recv(BUFFER)
- code = ""
- while count < AMOUNT_OF_LOCATIONS:
- ans = sock.recv(BUFFER).decode()
- decrypted = decrypt(ans)
- print(decrypted)
- if "location data" in decrypted:
- location_data = re.search(LOCATION_DATA_PATTERN, decrypted).group(1)
- print(f"---{location_data}")
- code += location_data
- count += 1
- print(code)
- print(f"FLY000location_md5={hashlib.md5(code.encode()).hexdigest()},airport=nevada25.84,time=15:52,lane=earth.jup,vehicle=2554,fly")
- sock.sendall(f"FLY000location_md5={hashlib.md5(code.encode()).hexdigest()},airport=nevada25.84,time=15:52,lane=earth.jup,vehicle=2554,fly".encode())
- print(sock.recv(BUFFER).decode())
- sock.close()
- def decrypt(data):
- matches = re.search(KEY_PATTERN, data)
- key = int(matches.group(1)) # Getting key from the data
- input_str = xstr(matches.group(2)).lower() # Data (without the key) and lower()
- builder = ""
- for num, ch in enumerate(input_str):
- if not ch.isalpha() or num % 2 != 0:
- builder += ch
- else:
- builder += str(chr((ord(ch) - 97 - key) % 26 + 97))
- num += 1
- return builder
- def xstr(s):
- return '' if s is None else str(s)
- if __name__ == '__main__':
- main()
Add Comment
Please, Sign In to add comment