fuzzing.http.request

exception asdfuzz.http.request.NoContentError

Bases: ValueError

class asdfuzz.http.request.Request(request: bytes, port: int, disable_https: bool = False, add_header: str | None = None)

Bases: object

A single HTTP request. The HTTP request is interpreted and individual components can be modified for fuzzing. To generate a bytes request again, run .recreate.

add_header: str | None = None

Add an extra header to the request.

property colored_method

Colorized HTTP method.

property content_type

Content type of the request, as indicated in the Content-type header.

disable_all_fuzzing()

When called, recursively disables all fuzzing.

disable_https: bool = False

Whether to use HTTPS disable_https=False or HTTP disable_https=True.

classmethod from_fetch_nodejs(filename: Path, port: int, add_header: str | None = None) Request

Extracts a HTTP request from a file containing the content of “Copy as fetch (Node.js)” from the Network tab of Chrome DevTools. “Copy as fetch (Node.js)” is a low-effort way to copy a request from Chrome, since Chrome does not directly support extracting a raw HTTP request. Make sure that the “Copy as fetch (Node.js)” option is used, not the “Copy as fetch” option.

classmethod from_file(filename: Path, port: int, add_header: str | None = None) Request

Extracts a Request object from a file containing a raw HTTP request, indicated by filename. The file should not contain the response: only the request.

classmethod from_zap_message_export(filename: Path, port: int, add_header: str | None = None) List[Request]

Extracts HTTP requests from an OWASP ZAP message export. The ZAP message export can be downloaded by selecting messages in the history view and then selecting: Report - Export Messages To File. The filename of the resulting file should be the filename parameter. The responses in the ZAP message export are ignored.

property host: str

The host as indicated in the URL.

port: int

The port to use for the request.

recreate() bytes

Builds up the request from potentially modified components.

request: bytes

The raw request in bytes.