summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/doc_stl/api/scapy_builder.rst
blob: 2c5790bfe81563710f4aafdbb96bcf5e45394513 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Packet builder modules 
=======================

The packet builder module is used for building a template packet for a stream, and creating a Field Engine program to change fields in the packet.

**Examples:**

* Build a IP/UDP/DNS packet with a src_ip range of 10.0.0.1 to 10.0.0.255
* Build IP/UDP packets in IMIX sizes 


For example, this snippet creates a SYN attack::

    # create attack from random src_ip from 16.0.0.0-18.0.0.254 and random src_port 1025-65000    
    # attack 48.0.0.1 server 
        
    def create_stream (self):

        
        # TCP SYN
        base_pkt  = Ether()/IP(dst="48.0.0.1")/TCP(dport=80,flags="S")

        pkt = STLPktBuilder(pkt = base_pkt)

        return STLStream(packet = pkt,    #<<<<< set packet builder inside the stream 
                         mode = STLTXCont())




STLPktBuilder  class
--------------------

Aggregate a raw instructions objects 

.. autoclass:: trex_stl_lib.trex_stl_packet_builder_scapy.STLPktBuilder
    :members: 
    :member-order: bysource