Adding padding to the packets
Christof Jugel edited this page 6 years ago

The library class /ID2TLib/Botnet/Generator.py contains two functions, that are used to extend the packet with a padding containing a random payload. It is possible to both extend a single package and to equal the length of a set of packets and extends them after that with a random amount of bytes, if needed. Therefore there are multiple parameters.

Functions

add_padding

This function extends a single packet by a given amount of bytes between 0 and 100 or, if intended, by random amount of bytes, that is divisible by four and between 0 and the given amount of bytes.

Parameters

  • packet
    The packet, that is going to be extended.

  • bytes_padding
    The amount of bytes, that will be appended on to the packet. Zero by default.

  • user_padding
    True, if the function is called from another class and the amount of bytes are set manually. True by default.

  • rnd
    If true, the extended number of bytes will be a random number between zero and bytes_padding, that is divisible by four.

equal_length

Equals the length of a given set of packets on the given length. If the given length is smaller than the largest packet, all the other packets are extended to the largest packet's length. There is also the possibility to append some extra padding onto the packets afterwards, so it seems more realistic.

Parameters

  • list_of_packets
    A list of packets, that will extended.

  • length
    The length all packets should be extended to. If zero, all packets are equaled on the length of the largest packet.

  • padding
    If this is nonzero, all packets are extended by an additional payload with a number of bytes, that is between zero and paddingand is divisible by four.