def inputProcessor(self, filename): """ step_idx is the step in the packet exchange ex. [.X.] are packets sent by a client or a server client: [.1.] [.3.] [.4.] server: [.2.] [.5.] mutation_idx: is the sub index of the packet as in the byte of the packet at the step_idx that is to be mutated """ if self.localOptions['pcap']: daphn3Steps = daphn3.read_pcap(filename) else: daphn3Steps = daphn3.read_yaml(filename) log.debug("Loaded these steps %s" % daphn3Steps) yield daphn3Steps
class TCPEchoProtocol(Protocol): def dataReceived(self, data): self.transport.write(data) class TCPEchoHelper(Factory): """ A very simple echo protocol implementation """ protocol = TCPEchoProtocol if config.helpers.daphn3.yaml_file: daphn3Steps = read_pcap(config.helpers.daphn3.yaml_file) elif config.helpers.daphn3.pcap_file: daphn3Steps = read_yaml(config.helpers.daphn3.pcap_file) else: daphn3Steps = [{'client': 'client_packet'}, {'server': 'server_packet'}] class Daphn3ServerProtocol(Daphn3Protocol): def nextStep(self): log.debug("Moving on to next step in the state walk") self.current_data_received = 0 # Python why? if self.current_step >= (len(self.steps) - 1): log.msg("Reached the end of the state machine") log.msg("Censorship fingerpint bisected!") step_idx, mutation_idx = self.factory.mutation log.msg("step_idx: %s | mutation_id: %s" % (step_idx, mutation_idx))
def dataReceived(self, data): self.transport.write(data) class TCPEchoHelper(Factory): """ A very simple echo protocol implementation """ protocol = TCPEchoProtocol if config.helpers.daphn3.yaml_file: daphn3Steps = read_pcap(config.helpers.daphn3.yaml_file) elif config.helpers.daphn3.pcap_file: daphn3Steps = read_yaml(config.helpers.daphn3.pcap_file) else: daphn3Steps = [{'client': 'client_packet'}, {'server': 'server_packet'}] class Daphn3ServerProtocol(Daphn3Protocol): def nextStep(self): log.debug("Moving on to next step in the state walk") self.current_data_received = 0 # Python why? if self.current_step >= (len(self.steps) - 1): log.msg("Reached the end of the state machine") log.msg("Censorship fingerpint bisected!") step_idx, mutation_idx = self.factory.mutation log.msg("step_idx: %s | mutation_id: %s" %