scapy.volatile module
Fields that hold random numbers.
- class scapy.volatile.AutoTime(base: int | None = None, diff: float | None = None)[source]
Bases:
_AutoTime
[float
]
- class scapy.volatile.CorruptedBits(s: str, p: float = 0.01, n: Any | None = None)[source]
Bases:
CorruptedBytes
- class scapy.volatile.CorruptedBytes(s: str, p: float = 0.01, n: Any | None = None)[source]
Bases:
VolatileValue
[bytes
]
- class scapy.volatile.DelayedEval(expr: str)[source]
Bases:
VolatileValue
[Any
]Example of usage: DelayedEval(“time.time()”)
- class scapy.volatile.IncrementalValue(start: int = 0, step: int = 1, restart: int = -1)[source]
Bases:
VolatileValue
[int
]
- class scapy.volatile.IntAutoTime(base: int | None = None, diff: float | None = None)[source]
Bases:
_AutoTime
[int
]
- class scapy.volatile.RandBin(size: int | RandNum | None = None, chars: bytes = b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff')[source]
Bases:
_RandString
[bytes
]
- class scapy.volatile.RandEnum(min: int, max: int, seed: int | None = None)[source]
Bases:
RandNum
Instances evaluate to integer sampling without replacement from the given interval
- class scapy.volatile.RandEnumKeys(enum: Dict[Any, Any], seed: int | None = None)[source]
Bases:
RandEnum
Picks a random value from dict keys list.
- class scapy.volatile.RandField[source]
Bases:
VolatileValue
[_T
],Generic
[_T
]
- class scapy.volatile.RandNum(min: int, max: int)[source]
Bases:
_RandNumeral
[int
]Instances evaluate to random integers in selected range
- max = 0
- min = 0
- class scapy.volatile.RandOID(fmt: str | None = None, depth: ~scapy.volatile.RandNumExpo = <RandNumExpo>, idnum: ~scapy.volatile.RandNumExpo = <RandNumExpo>)[source]
Bases:
_RandString
[str
]
- class scapy.volatile.RandPool(*args: Tuple[VolatileValue[Any], int])[source]
Bases:
RandField
[VolatileValue
[Any
]]
- class scapy.volatile.RandRegExp(regexp: str, lambda_: float = 0.3)[source]
Bases:
RandField
[str
]- 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]'}
- class scapy.volatile.RandSingByte[source]
Bases:
RandSingNum
- class scapy.volatile.RandSingInt[source]
Bases:
RandSingNum
- class scapy.volatile.RandSingLong[source]
Bases:
RandSingNum
- class scapy.volatile.RandSingNum(mn: int, mx: int)[source]
Bases:
RandSingularity
- class scapy.volatile.RandSingSByte[source]
Bases:
RandSingNum
- class scapy.volatile.RandSingSInt[source]
Bases:
RandSingNum
- class scapy.volatile.RandSingSLong[source]
Bases:
RandSingNum
- class scapy.volatile.RandSingSShort[source]
Bases:
RandSingNum
- class scapy.volatile.RandSingShort[source]
Bases:
RandSingNum
- class scapy.volatile.RandSingString[source]
Bases:
RandSingularity
- class scapy.volatile.RandSingularity(*args: Any)[source]
Bases:
RandChoice
- class scapy.volatile.RandString(size: int | RandNum | None = None, chars: str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789')[source]
Bases:
_RandString
[str
]
- class scapy.volatile.RandUUID(template: Any | None = None, node: int | None = None, clock_seq: int | None = None, namespace: UUID | None = None, name: str | None = None, version: Any | None = None)[source]
Bases:
RandField
[UUID
]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: int, sup: int, seed: int | None = None, forever: int = 1, renewkeys: int = 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