ucdavis-ecs189m

[RADIOACTIVE] python exploits for uc davis class ecs189m
git clone git://git.figbert.com/ucdavis-ecs189m.git
Log | Files | Refs

binaryaddition.py (853B)


      1 # A CTF exploit by FIGBERT
      2 # for UC Davis class ECS189M
      3 # twinpeaks.cs.ucdavis.net:30002
      4 # Category: Linux and miscellaneous
      5 # Challenge: binaryaddition
      6 # 04/01/2020
      7 from pwn import *
      8 import struct
      9 
     10 # Connecting to the server
     11 connection = remote("twinpeaks.cs.ucdavis.edu", 30002)
     12 connection.recvuntil("Ready")
     13 for i in range(0,50):
     14     connection.recvuntil(" : ")
     15     # Arrive at the first number and unpack it
     16     num_one = struct.unpack("I", connection.recv(4))[0]
     17     connection.recvuntil(" + ")
     18     # Arrive at the second number and unpack it
     19     num_two = struct.unpack("I", connection.recv(4))[0]
     20     num_sum = num_one + num_two
     21     print("Equation %d: %d + %d = %d"%(i+1, num_one, num_two, num_sum))
     22     # Convert the added numbers and send them back
     23     num_sum = struct.pack("I", num_sum)
     24     connection.send(num_sum)
     25 connection.interactive()