Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

how to solve the problem ? if i m provided with admin cookie and user cookie on CTF server #!/usr/bin/python3 -u import os import json

how to solve the problem ? if i m provided with admin cookie and user cookie on CTF server
#!/usr/bin/python3 -u import os import json import sys import time from Crypto.Cipher import AES cookiefile = open("cookie", "r").read().strip() flag = open("flag", "r").read().strip() key = open("key", "r").read().strip() def encrypt(m): cipher = AES.new(bytes.fromhex(key), AES.MODE_ECB) return cipher.encrypt(m).hex() def decrypt(m): cipher = AES.new(bytes.fromhex(key), AES.MODE_ECB) return (cipher.decrypt(bytes.fromhex(m))).decode('utf-8') # flush output immediately print (welcome) print (len(cookiefile)) print ("Here is an admin cookie: " + encrypt(cookiefile)) print ("But here is yours: " + encrypt("I am not an administrator. This cookie expires 2022-05-01.......")) # Get their cookie print ("What is your cookie?") cookie2 = sys.stdin.readline() # decrypt, but remove the trailing newline first cookie2decoded = decrypt(cookie2[:-1]) print (cookie2decoded) if cookie2decoded.startswith('I am yes an admin'): exptime=time.strptime(cookie2decoded[47:57],'%Y-%m-%d') if exptime > time.localtime(): print ("Cookie is not expired") print ("The flag is: " + flag) else: print ("Cookie is expired") else: print ("No flag for you!") 

THATS ALL I GOT (ECB CTF problem)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago