document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import socket
  2. import sys
  3.  
  4. s = socket.create_connection((\'leaveret.kr\', 14123))
  5.  
  6. def recv_until(t):
  7.     global s
  8.     d = \'\'
  9.     while t not in d:
  10.         c = s.recv(1)
  11.         sys.stdout.write(c)
  12.         d += c
  13.     return d
  14.  
  15. while True:
  16.     recv_until(\'STAGE\')
  17.     recv_until(\'\\n\')
  18.  
  19.     assembly = recv_until(\'What\')[:-5].strip()
  20.     assembly = """.intel_syntax noprefix
  21.     .globl main
  22.     main:
  23.     push rbp
  24.     mov rbp, rsp
  25.     """ + assembly + """
  26.     mov    rdi, offset format
  27.     mov    rsi, rax
  28.     call printf
  29.     call exit
  30.  
  31.     format: .asciz "%lu\\n"
  32.     """
  33.  
  34.     f = open(\'file.s\', \'wb\')
  35.     f.write(assembly)
  36.     f.close()
  37.     import os
  38.     os.system(\'gcc file.s -o file; ./file > output\')
  39.  
  40.     output = open(\'output\', \'rb\')
  41.     RAX = int(output.read())
  42.     output.close()
  43.     print \'RAX is\', RAX
  44.     s.send(str(RAX) + \'\\n\')
');