scapy.volatile

Fields that hold random numbers.

class scapy.volatile.AutoTime(base=None, diff=None)[source]

Bases: scapy.volatile._RandNumeral

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

Bases: scapy.volatile.CorruptedBytes

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

Bases: scapy.volatile.VolatileValue

class scapy.volatile.DelayedEval(expr)[source]

Bases: scapy.volatile.VolatileValue

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

class scapy.volatile.GeneralizedTime(diff=0)[source]

Bases: scapy.volatile.AutoTime

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

Bases: scapy.volatile.VolatileValue

class scapy.volatile.IntAutoTime(base=None, diff=None)[source]

Bases: scapy.volatile.AutoTime

class scapy.volatile.RandBin(size=None)[source]

Bases: scapy.volatile.RandString

class scapy.volatile.RandBinFloat(min, max)[source]

Bases: scapy.volatile.RandNum

class scapy.volatile.RandByte[source]

Bases: scapy.volatile.RandNum

class scapy.volatile.RandChoice(*args)[source]

Bases: scapy.volatile.RandField

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

Bases: scapy.volatile.RandNum

Instances evaluate to integer sampling without replacement from the given interval

class scapy.volatile.RandEnumByte[source]

Bases: scapy.volatile.RandEnum

class scapy.volatile.RandEnumInt[source]

Bases: scapy.volatile.RandEnum

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

Bases: scapy.volatile.RandEnum

Picks a random value from dict keys list.

class scapy.volatile.RandEnumLong[source]

Bases: scapy.volatile.RandEnum

class scapy.volatile.RandEnumSByte[source]

Bases: scapy.volatile.RandEnum

class scapy.volatile.RandEnumSInt[source]

Bases: scapy.volatile.RandEnum

class scapy.volatile.RandEnumSLong[source]

Bases: scapy.volatile.RandEnum

class scapy.volatile.RandEnumSShort[source]

Bases: scapy.volatile.RandEnum

class scapy.volatile.RandEnumShort[source]

Bases: scapy.volatile.RandEnum

class scapy.volatile.RandField[source]

Bases: scapy.volatile.VolatileValue

class scapy.volatile.RandFloat(min, max)[source]

Bases: scapy.volatile.RandNum

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

Bases: scapy.volatile.RandString

class scapy.volatile.RandIP6(ip6template='**')[source]

Bases: scapy.volatile.RandString

class scapy.volatile.RandInt[source]

Bases: scapy.volatile.RandNum

class scapy.volatile.RandLong[source]

Bases: scapy.volatile.RandNum

class scapy.volatile.RandMAC(template='*')[source]

Bases: scapy.volatile.RandString

class scapy.volatile.RandNum(min, max)[source]

Bases: scapy.volatile._RandNumeral

Instances evaluate to random integers in selected range

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

Bases: scapy.volatile._RandNumeral

class scapy.volatile.RandNumGamma(alpha, beta)[source]

Bases: scapy.volatile._RandNumeral

class scapy.volatile.RandNumGauss(mu, sigma)[source]

Bases: scapy.volatile._RandNumeral

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

Bases: scapy.volatile.RandString

class scapy.volatile.RandPool(*args)[source]

Bases: scapy.volatile.RandField

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

Bases: scapy.volatile.RandField

static choice_expand(s)[source]
special_sets = {'[:alnum:]': '[a-zA-Z0-9]', '[:alpha:]': '[a-zA-Z]', '[:ascii:]': '[\x00-\x7f]', '[:blank:]': '[ \t]', '[:cntrl:]': '[\x00-\x1f\x7f]', '[:digit:]': '[0-9]', '[:graph:]': '[!-~]', '[:lower:]': '[a-z]', '[:print:]': '[ -~]', '[:punct:]': '[!"\\#$%&\'()*+,\\-./:;<=>?@\\[\\\\\\]^_{|}~]', '[:space:]': '[ \t\r\n\x0b\x0c]', '[:upper:]': '[A-Z]', '[:word:]': '[A-Za-z0-9_]', '[:xdigit:]': '[A-Fa-f0-9]'}
static stack_fix(lst, index)[source]
class scapy.volatile.RandSByte[source]

Bases: scapy.volatile.RandNum

class scapy.volatile.RandSInt[source]

Bases: scapy.volatile.RandNum

class scapy.volatile.RandSLong[source]

Bases: scapy.volatile.RandNum

class scapy.volatile.RandSShort[source]

Bases: scapy.volatile.RandNum

class scapy.volatile.RandShort[source]

Bases: scapy.volatile.RandNum

class scapy.volatile.RandSingByte[source]

Bases: scapy.volatile.RandSingNum

class scapy.volatile.RandSingInt[source]

Bases: scapy.volatile.RandSingNum

class scapy.volatile.RandSingLong[source]

Bases: scapy.volatile.RandSingNum

class scapy.volatile.RandSingNum(mn, mx)[source]

Bases: scapy.volatile.RandSingularity

static make_power_of_two(end)[source]
class scapy.volatile.RandSingSByte[source]

Bases: scapy.volatile.RandSingNum

class scapy.volatile.RandSingSInt[source]

Bases: scapy.volatile.RandSingNum

class scapy.volatile.RandSingSLong[source]

Bases: scapy.volatile.RandSingNum

class scapy.volatile.RandSingSShort[source]

Bases: scapy.volatile.RandSingNum

class scapy.volatile.RandSingShort[source]

Bases: scapy.volatile.RandSingNum

class scapy.volatile.RandSingString[source]

Bases: scapy.volatile.RandSingularity

class scapy.volatile.RandSingularity(*args)[source]

Bases: scapy.volatile.RandChoice

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

Bases: scapy.volatile.RandField

class scapy.volatile.RandTermString(size, term)[source]

Bases: scapy.volatile.RandBin

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

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)[source]

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()[source]
class scapy.volatile.VolatileValue[source]

Bases: object

command()[source]
copy()[source]
class scapy.volatile.ZuluTime(diff=0)[source]

Bases: scapy.volatile.AutoTime