fuzzing.http.json_data

class asdfuzz.http.json_data.JSONData(json_string: str)

Bases: object

Nested structure of JSON data. Can occur in the data section of the HTTP request, but also for example inside of base64-urlencoded cookies or parameters.

json_string: str

String representation of the JSON data. json_string is not automatically updated when the json_nodes are updated: use .to_json instead.

to_json()

After modifying the json_nodes, call .to_json to get a string representation of the JSON data. The json_string is not updated automatically.

class asdfuzz.http.json_data.Node(keys: List[NodeKey])

Bases: object

A single level in the nested JSON data.

classmethod from_object(json_object: Any) List[Node]

Given an object representing JSON data (the output of json.loads, e.g. a dict or list of any structure), return the Node objects representing the JSON data at this level. Since the outer level of JSON data can be a list, the return type is a list of Node objects, not a single Node.

fuzz = True

Whether to fuzz the keys in this JSON node.

keys: List[NodeKey]

Absolute keys of the JSON data in this level.

class asdfuzz.http.json_data.NodeKey(key_type: NodeType, key: Any)

Bases: object

Absolute key of a value in the JSON structure.

key: Any

Value of the JSON at this key. The type can be any JSON compatible value.

key_type: NodeType

The key type key_type of the node can represent either further nested structure (dict or list) or a leaf (any JSON compatible value).

class asdfuzz.http.json_data.NodeType(value)

Bases: Enum

The key type of the node can represent either further nested structure (dict or list) or a leaf (any JSON compatible value).

DICT = 1

Indicates that this key contains further nested structure: specifically, a dict.

LIST = 2

Indicates that this key contains further nested structure: specifically, a list.

VALUE = 3

Indicates that this key contains a leaf. The type can be any JSON compatible value.