commit a4243d9840bd241d2c6ffd2e546385aca2ee9b12
parent 7ed358acfa68daecdb0d902d4decbad88ab08cc9
Author: therealFIGBERT <figbertwelner@gmail.com>
Date: Sat, 4 Jan 2020 19:26:51 -0800
Update second_flag.py for ECS189M class
Diffstat:
2 files changed, 26 insertions(+), 24 deletions(-)
diff --git a/linux_and_misc/binaryaddition.py b/linux_and_misc/binaryaddition.py
@@ -0,0 +1,26 @@
+# A CTF exploit by FIGBERT
+# for UC Davis class ECS189M
+# twinpeaks.cs.ucdavis.net:30002
+# Category: Linux and miscellaneous
+# Challenge: binaryaddition
+# 04/01/2020
+from pwn import *
+import struct
+
+#Connecting to the server
+connection = remote("twinpeaks.cs.ucdavis.edu", 30002)
+connection.recvuntil("Ready")
+for i in range(0,50):
+ connection.recvuntil("Question")
+ connection.recvuntil(" : ")
+ #Arrive at the first number and unpack it
+ num_one = struct.unpack("I", connection.recv(4))[0]
+ connection.recvuntil(" + ")
+ #Arrive at the second number and unpack it
+ num_two = struct.unpack("I", connection.recv(4))[0]
+ num_sum = num_one + num_two
+ print("Equation %d: %d + %d = %d"%(i+1, num_one, num_two, num_sum))
+ #Convert the added numbers and send them back
+ num_sum = struct.pack("I", num_sum)
+ connection.send(num_sum)
+connection.interactive()
diff --git a/second_flag.py b/second_flag.py
@@ -1,24 +0,0 @@
-# A CTF exploit by Benjamin Welner
-# for the Davis Cyber Security Club server
-# at daviscybersec.ddns.net:1338
-# 29/09/2019
-from pwn import *
-import struct
-
-#Connecting to the server
-connection = remote("daviscybersec.ddns.net", 1338)
-connection.recvuntil("Ready")
-for i in range(0,50):
- connection.recvuntil("Question")
- connection.recvuntil(" : ")
- #Arrive at the first number and unpack it
- num_one = struct.unpack("I", connection.recv(4))[0]
- connection.recvuntil(" + ")
- #Arrive at the second number and unpack it
- num_two = struct.unpack("I", connection.recv(4))[0]
- num_sum = num_one + num_two
- print("Equation %d: %d + %d = %d"%(i+1, num_one, num_two, num_sum))
- #Convert the added numbers and send them back
- num_sum = struct.pack("I", num_sum)
- connection.send(num_sum)
-connection.interactive()