예제 #1
0
파일: acts.py 프로젝트: cnnrshd/webapp
def act_4():
    """
	act_4:	runs the required acts to get the act 4 flag
		then prints out the flag
	It gets a security token, makes a request to create an
		account, gets a password, and sends all three
		in another POST request for the forth flag
	:return: Nothing
	"""
    print("Act 4")
    token = get_security_token(HOST, PORT)
    agent = CAgent(HOST, PORT)
    agent.set_body(("token=%s&username=%s" % (token, USERNAME)))
    agent.create_socket()
    agent.make_header(method="POST", uri="/createAccount")
    response = agent.request()
    password = response.split("password is ")[1]
    agent.set_body(("token=%s&username=%s&password=%s" %
                    (token, USERNAME, urllib.parse.quote(password))))
    agent.make_header(method="POST", uri="/login")
    response_2 = agent.request()
    print(response_2.split('"')[1])
예제 #2
0
파일: acts.py 프로젝트: cnnrshd/webapp
def act_3():
    """
	act_3:	runs the required acts to get the act 3 flag
		then prints out the flag
	It gets a security token, puts that token in the body,
		makes a request for a captcha, solves the captcha,
		then returns the token and the solution in
		another POST request
	:return: Nothing
	"""
    print("Act 3")
    token = get_security_token(HOST, PORT)
    agent = CAgent(HOST, PORT)
    agent.set_body(("token=%s" % token))
    agent.make_header(method="POST", uri="/getFlag3Challenge")
    agent.create_socket()
    response = agent.request()
    challenge = (response.split("solve the following: ")[1]).strip('"')
    answer = eval(challenge)
    agent.set_body("token=%s&solution=%d" % (token, answer))
    agent.make_header(method="POST", uri="/getFlag3Challenge")
    response_2 = agent.request()
    agent.socket.close()
    print(response_2.split('"')[1])