示例#1
0
    def negotiate_protocol(self):
        # read until newline
        buf = self.read_newline()

        if "NETLOG" in buf:
            self.protocol = NetlogParser(self)
        elif "FILE" in buf:
            self.protocol = FileUpload(self)
        elif "LOG" in buf:
            self.protocol = LogHandler(self)
        else:
            raise CuckooOperationalError(
                "Netlog failure, unknown protocol requested.")
 def parse_first_and_reset(self):
     self.fd = open(self._log_path, "rb")
     self.parser = NetlogParser(self)
     self.parser.read_next_message()
     self.fd.seek(0)