Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- import struct #interpret strings as packed binary data
- import time
- nikkojames=socket.socket()
- nikkojames.connect(('172.30.73.143',1228))
- challenge1=nikkojames.recv(230).decode() #breaking up the challenge messages to specific bytes
- print(challenge1)
- challenge2=nikkojames.recv(198).decode()
- print(challenge2)
- input=nikkojames.recv(8) #capturing the 8 byte input
- print("Capture: "+str(input))
- bigEndian=struct.unpack('>LL',input) #unpack into two 32-bit unsigned integers in big endian
- print("Unpacked: "+str(bigEndian))
- bigEndian1=bigEndian[0]
- print("Part One: "+str(bigEndian1))
- bigEndian2=bigEndian[1]
- print("Part Two: "+str(bigEndian2))
- sum=0xFFFFFFFF & (bigEndian1+bigEndian2)
- print("Sum: "+str(sum))
- output=struct.pack('<Q',sum) #pack into one 32-bit unsigned integer in little endian
- print("Packed: "+str(output))
- nikkojames.sendall(output)
- time.sleep(3)
- flag1=nikkojames.recv(16).decode()
- print(flag1)
- flag2=nikkojames.recv(16).decode()
- print(flag2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement