tlsfuzzer.fuzzers module

Classes used for generating random (fuzzing) data

class tlsfuzzer.fuzzers.StructuredRandom(vals, rng=None)[source]

Bases: object

Random data with structure.

This class allows easy creation of random data that is structured, either by having a random bytes of specific length, or intermediate bytes that are constant.

vals is a list of tuples, the first element in the tuple specifies the length of the run and the second specifies the values of the bytes in the run. If the value is None, it means the bytes should be random.

thus a vals = [(16, 0)] will create a bytestring of length 16, with all bytes equal to zero and vals = [(4, None), (5, 6)] will create a bytestring that has 4 random bytes followed by 5 bytes of value 0x06.

property data

Generate the random string based on description in vals.

tlsfuzzer.fuzzers._normalise_groups(groups, sum_len, step)[source]

Make sure the sum of all lengths in groups is a multiple of step.

tlsfuzzer.fuzzers._pick_length(rng, group_min, group_max)[source]

Pick lengths of byte runs.

tlsfuzzer.fuzzers._pick_run_type(rng, length)[source]

Pick the payload of the runs with specified size.

tlsfuzzer.fuzzers.structured_random_iter(count=100, min_length=1, max_length=65536, step=1)[source]

Iterator that returns a random StructuredRandom object.

Useful as a payload for TLS message plaintext