Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. import socket
  2. import struct #interpret strings as packed binary data
  3. import time
  4.  
  5. nikkojames=socket.socket()
  6. nikkojames.connect(('172.30.73.143',1228))
  7.  
  8. challenge1=nikkojames.recv(230).decode() #breaking up the challenge messages to specific bytes
  9. print(challenge1)
  10. challenge2=nikkojames.recv(198).decode()
  11. print(challenge2)
  12. input=nikkojames.recv(8) #capturing the 8 byte input
  13. print("Capture: "+str(input))
  14. bigEndian=struct.unpack('>LL',input) #unpack into two 32-bit unsigned integers in big endian
  15. print("Unpacked: "+str(bigEndian))
  16. bigEndian1=bigEndian[0]
  17. print("Part One: "+str(bigEndian1))
  18. bigEndian2=bigEndian[1]
  19. print("Part Two: "+str(bigEndian2))
  20. sum=0xFFFFFFFF & (bigEndian1+bigEndian2)
  21. print("Sum: "+str(sum))
  22. output=struct.pack('<Q',sum) #pack into one 32-bit unsigned integer in little endian
  23. print("Packed: "+str(output))
  24. nikkojames.sendall(output)
  25. time.sleep(3)
  26.  
  27. flag1=nikkojames.recv(16).decode()
  28. print(flag1)
  29. flag2=nikkojames.recv(16).decode()
  30. print(flag2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement