コード例 #1
0
def gen_8092_pkt():
    SRC='08:11:96:50:3a:1c';
    DST='08:11:96:50:3a:1c';

    # Craft ethernet packet
    pkt = Ether();
    pkt.src=SRC;
    pkt.dst=DST;
    pkt.type=0x8092;

    # Generate prbs9
    gen = PCAPReader.prbs9()


    data = b'\x00'+b'\x00'+b'\x00'+b'\x01'; # Will hold 996 bytes prbs9 data
    # Start off with the 4 bytes of sequence number

    # Only want 996 bytes of prbs9
    i=1;
    for d in gen:
        if i > 996:
            break;

        data += struct.pack('>B', d);

        i += 1;

    b = pkt/data

    #print len(b);
    #hexdump(b);
    return b;
コード例 #2
0
def main():

    # Test 0x8091 packet processing


    # Test 0x8092 packet processing
    print "Begin 0x8092 Good Test";
    pkt = gen_8092_pkt();

    values = PCAPReader.parse_8092_packet(pkt);

    print "Number of bit errors: " + str(values[0]);
    print "Bit error positions: ", values[1];



    print "Begin 0x8092 Bad Test";
    pkt = gen_bad_8092_pkt();

    values = PCAPReader.parse_8092_packet(pkt);

    print "Number of bit errors: " + str(values[0]);
    print "Bit error positions: ", values[1];
コード例 #3
0
def main():

    # Test 0x8091 packet processing


    # Test 0x8092 packet processing
    print "Begin 0x8092 Good Test";
    pkt = gen_8092_pkt();

    values = PCAPReader.parse_8092_packet(pkt);

    print "Number of bit errors: " + str(values[0]);
    print "Bit error positions: ", values[1];



    print "Begin 0x8092 Bad Test";
    pkt = gen_bad_8092_pkt();

    values = PCAPReader.parse_8092_packet(pkt);

    print "Number of bit errors: " + str(values[0]);
    print "Bit error positions: ", values[1];


    """
    print "Begin Output to file test";
    dataContainer = PCAPReader.DataContainer();
    dataContainer.fillPktInfo_8091(PCAPReader.parse_8091_packet(gen_8091_pkt()));
    dataContainer.fillPktInfo_8092(PCAPReader.parse_8092_packet(gen_bad_8092_pkt()));
    dataContainer.writeToFile('Iteration1.csv');
    print "Done."
    """


    #PCAPReader.RunPCAPRead(filename);
    PCAPReader.RunTrial(1000, 'eth7', "Iteration1.pcap");