def buildProtocol(self, addr): p = self.protocol() p.factory = self if config.daphn3.yaml_file: steps = read_yaml(config.daphn3.yaml_file) elif config.daphn3.pcap_file: steps = read_pcap(config.daphn3.pcap_file) else: print "Error! No PCAP, nor YAML file provided." steps = None p.factory.steps = steps if addr.host not in self.mutations: self.mutations[addr.host] = Mutator(p.steps) else: print "Moving on to next mutation" if not self.mutations[addr.host].next(): self.mutations.pop(addr.host) try: p.mutator = self.mutations[addr.host] p.current_state = p.mutator.state() except: pass return p
def initialize(self): if not self.local_options: self.end() return self.factory = Daphn3ClientFactory() self.factory.test = self if self.local_options['pcap']: self.tool = True elif self.local_options['yaml']: self.steps = daphn3.read_yaml(self.local_options['yaml']) else: log.msg("Not enough inputs specified to the test") self.end()