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
Example #2
0
    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
Example #3
0
from ooni.utils import log
from ooni.kit.daphn3 import Daphn3Protocol
from ooni.kit.daphn3 import read_pcap, read_yaml

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")
Example #4
0

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")