#!/usr/bin/python3
#
# RuCTFe 2014 Exploit Template
# by patrikf
#

# Which sub-IP-address is this service running on?
SUBSERVICE = 2

import ctfutil

# Implement your exploit here.
#
# The following utility functions are there for you:
#   self.socket
#   self.recv_fix(len)
#   self.recv_until(magic_str)
#   self.recv_all()
#   self.send(data)
#   self.submit_flag(flag)
#
class Exploit(ctfutil.ExploitBase):
    def exploit(self):
        self.logger.debug(self.recv_until(': '))
        self.submit_flag(self.recv_all().decode('ascii').strip())


if __name__ == '__main__':
    ctfutil.AttackTool(Exploit, subservice=SUBSERVICE).run()
