scapy.volatile

Fields that hold random numbers.

class scapy.volatile.AutoTime(base=None)

Bases: scapy.volatile.RandNum

class scapy.volatile.CorruptedBits(s, p=0.01, n=None)

Bases: scapy.volatile.CorruptedBytes

class scapy.volatile.CorruptedBytes(s, p=0.01, n=None)

Bases: scapy.volatile.VolatileValue

class scapy.volatile.DelayedEval(expr)

Bases: scapy.volatile.VolatileValue

Example of usage: DelayedEval(“time.time()”)

class scapy.volatile.GeneralizedTime(diff=0)

Bases: scapy.volatile.AutoTime

class scapy.volatile.IncrementalValue(start=0, step=1, restart=-1)

Bases: scapy.volatile.VolatileValue

class scapy.volatile.IntAutoTime(base=None)

Bases: scapy.volatile.AutoTime

class scapy.volatile.RandBin(size=None)

Bases: scapy.volatile.RandString

class scapy.volatile.RandBinFloat(min, max)

Bases: scapy.volatile.RandNum

class scapy.volatile.RandByte

Bases: scapy.volatile.RandNum

class scapy.volatile.RandChoice(*args)

Bases: scapy.volatile.RandField

class scapy.volatile.RandEnum(min, max, seed=None)

Bases: scapy.volatile.RandNum

Instances evaluate to integer sampling without replacement from the given interval

class scapy.volatile.RandEnumByte

Bases: scapy.volatile.RandEnum

class scapy.volatile.RandEnumInt

Bases: scapy.volatile.RandEnum

class scapy.volatile.RandEnumKeys(enum, seed=None)

Bases: scapy.volatile.RandEnum

Picks a random value from dict keys list.

class scapy.volatile.RandEnumLong

Bases: scapy.volatile.RandEnum

class scapy.volatile.RandEnumSByte

Bases: scapy.volatile.RandEnum

class scapy.volatile.RandEnumSInt

Bases: scapy.volatile.RandEnum

class scapy.volatile.RandEnumSLong

Bases: scapy.volatile.RandEnum

class scapy.volatile.RandEnumSShort

Bases: scapy.volatile.RandEnum

class scapy.volatile.RandEnumShort

Bases: scapy.volatile.RandEnum

class scapy.volatile.RandField

Bases: scapy.volatile.VolatileValue

class scapy.volatile.RandFloat(min, max)

Bases: scapy.volatile.RandNum

class scapy.volatile.RandIP(iptemplate='0.0.0.0/0')

Bases: scapy.volatile.RandString

class scapy.volatile.RandIP6(ip6template='**')

Bases: scapy.volatile.RandString

class scapy.volatile.RandInt

Bases: scapy.volatile.RandNum

class scapy.volatile.RandLong

Bases: scapy.volatile.RandNum

class scapy.volatile.RandMAC(template='*')

Bases: scapy.volatile.RandString

class scapy.volatile.RandNum(min, max)

Bases: scapy.volatile.RandField

Instances evaluate to random integers in selected range

max = 0
min = 0
class scapy.volatile.RandNumExpo(lambd, base=0)

Bases: scapy.volatile.RandNum

class scapy.volatile.RandNumGamma(alpha, beta)

Bases: scapy.volatile.RandNum

class scapy.volatile.RandNumGauss(mu, sigma)

Bases: scapy.volatile.RandNum

class scapy.volatile.RandOID(fmt=None, depth=<RandNumExpo>, idnum=<RandNumExpo>)

Bases: scapy.volatile.RandString

class scapy.volatile.RandPool(*args)

Bases: scapy.volatile.RandField

class scapy.volatile.RandRegExp(regexp, lambda_=0.3)

Bases: scapy.volatile.RandField

static choice_expand(s)
static stack_fix(lst, index)
class scapy.volatile.RandSByte

Bases: scapy.volatile.RandNum

class scapy.volatile.RandSInt

Bases: scapy.volatile.RandNum

class scapy.volatile.RandSLong

Bases: scapy.volatile.RandNum

class scapy.volatile.RandSShort

Bases: scapy.volatile.RandNum

class scapy.volatile.RandShort

Bases: scapy.volatile.RandNum

class scapy.volatile.RandSingByte

Bases: scapy.volatile.RandSingNum

class scapy.volatile.RandSingInt

Bases: scapy.volatile.RandSingNum

class scapy.volatile.RandSingLong

Bases: scapy.volatile.RandSingNum

class scapy.volatile.RandSingNum(mn, mx)

Bases: scapy.volatile.RandSingularity

static make_power_of_two(end)
class scapy.volatile.RandSingSByte

Bases: scapy.volatile.RandSingNum

class scapy.volatile.RandSingSInt

Bases: scapy.volatile.RandSingNum

class scapy.volatile.RandSingSLong

Bases: scapy.volatile.RandSingNum

class scapy.volatile.RandSingSShort

Bases: scapy.volatile.RandSingNum

class scapy.volatile.RandSingShort

Bases: scapy.volatile.RandSingNum

class scapy.volatile.RandSingString

Bases: scapy.volatile.RandSingularity

class scapy.volatile.RandSingularity(*args)

Bases: scapy.volatile.RandChoice

class scapy.volatile.RandString(size=None, chars=b'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789')

Bases: scapy.volatile.RandField

class scapy.volatile.RandTermString(size, term)

Bases: scapy.volatile.RandBin

class scapy.volatile.RandUUID(template=None, node=None, clock_seq=None, namespace=None, name=None, version=None)

Bases: scapy.volatile.RandField

Generates a random UUID.

By default, this generates a RFC 4122 version 4 UUID (totally random).

See Python’s uuid module documentation for more information.

Parameters
  • template (optional) – A template to build the UUID from. Not valid with any other option.

  • node (optional) – A 48-bit Host ID. Only valid for version 1 (where it is optional).

  • clock_seq (optional) – An integer of up to 14-bits for the sequence number. Only valid for version 1 (where it is optional).

  • namespace – A namespace identifier, which is also a UUID. Required for versions 3 and 5, must be omitted otherwise.

  • name – string, required for versions 3 and 5, must be omitted otherwise.

  • version – Version of UUID to use (1, 3, 4 or 5). If omitted, attempts to guess which version to generate, defaulting to version 4 (totally random).

Raises

ValueError – on invalid constructor arguments

VERSIONS = [1, 3, 4, 5]
class scapy.volatile.RandomEnumeration(inf, sup, seed=None, forever=1, renewkeys=0)

Bases: object

iterate through a sequence in random order. When all the values have been drawn, if forever=1, the drawing is done again. # noqa: E501 If renewkeys=0, the draw will be in the same order, guaranteeing that the same # noqa: E501 number will be drawn in not less than the number of integers of the sequence

next()
class scapy.volatile.VolatileValue

Bases: object

copy()
class scapy.volatile.ZuluTime(diff=0)

Bases: scapy.volatile.AutoTime