Reference

API

nuclei.api.main.create_session()[source]

Initialising session object to call the NUCLEI endpoints. Provide the user token from https://nuclei.cemsbv.io/#/personal-access-tokens to upon request or set as environment variable.

Return type:

Session

Client

class nuclei.client.main.NucleiClient[source]
property applications: List[str]

Provide available API’s in the Nuclei landscape.

Returns:

out – Names of the API’s

Return type:

list[str]

call_endpoint(app, endpoint, methode='auto', schema=None, return_response=False)[source]

Calls an API in the nuclei landscape.

Note

The provided schema is serialized by the utils.serialize_jsonifyable_object. For get request the payload is passed to the params parameter of request.get function. For post request the payload is passed to the json parameter of request.post function. This has an effect on the request content type.

Parameters:
  • app (str) – Name of the API. call get_applications to obtain a list with all applications.

  • endpoint (str) – Name of the API’s endpoint. call get_endpoints to obtain a list with all applications for a given API.

  • methode (str) – default is auto HTTP methode used to call endpoint. When auto methode is selected the HTTP methode is obtained from the openapi docs.

  • schema (dict or json-string, optional) – Default is None The parameter schema for the API. Take a look at the API documentation.

  • return_response (bool, optional) – Default is False Return the requests response instead of the parsed data object.

Return type:

Any

Returns:

  • json (dict) – json response

  • text (str) – text response

  • content (bytes) – content response

  • out (Response) – requests response object

  • figure (Image) – IPython display Image object

Raises:
  • RuntimeError: – Thrown when response is between 400 and 600 to see if there was a client error or a server error.

  • NotImplementedError: – HTTP methode not get or post request

  • ConnectionError: – Application not available

  • TypeError: – Wrong type for an argument

  • ValueError: – Wrong value for an argument

get_application_version(app)[source]

Provide version of the API in the Nuclei landscape.

Parameters:

app (str) – Name of the API.

Returns:

out – Semantic Version of the API

Return type:

str

Raises:
  • ConnectionError: – Application not available

  • TypeError: – Wrong type for app argument

  • ValueError: – Wrong value for app argument

get_endpoint_type(app, endpoint)[source]
Parameters:
  • app (str) – name of the app

  • endpoint (str) – url of the endpoint.

Return type:

“get” | “post”

Raises:
  • ConnectionError: – Application not available

  • TypeError: – Wrong type for an argument

  • ValueError: – Wrong value for an argument

get_endpoints(app)[source]

Get available endpoints of single API.

Parameters:

app (str) – Name of the API.

Returns:

out – Endpoint urls.

Return type:

list[str]

Raises:
  • ConnectionError: – Application not available

  • TypeError: – Wrong type for app argument

  • ValueError: – Wrong value for app argument

get_url(app)[source]

Get API’s url

Parameters:

app (str) – Application name

Returns:

url

Return type:

str

Raises:
  • TypeError: – Wrong type for app argument

  • ValueError: – Wrong value for app argument

property user_permissions: List[str | None]

Provide the user permissions of your token.

Returns:

out – Names of the API’s

Return type:

list[str]

Utils

nuclei.client.utils.serialize_jsonifyable_object(obj)[source]

Takes an object and converts it to a JSON-serializable object. Uses orjson.dumps() to do the heavy lifting.

Serializable objects are (amongst others):
  • python natives

  • dataclasses

  • datetime objects

  • numpy objects

Some known objects that are not serializable:
  • numpy.float16

  • numpy.float128

Parameters:

obj (Any) – The object to serialize

Returns:

json-string – a JSON string

Return type:

str

nuclei.client.utils.serialize_json_string(obj)[source]

Takes an object and converts it to a JSON-string. Uses orjson.dumps() to do the heavy lifting.

Serializable objects are (amongst others):
  • python natives

  • dataclasses

  • datetime objects

  • numpy objects

Some known objects that are not serializable:
  • numpy.float16

  • numpy.float128

Parameters:

obj (Any) – The object to serialize

Returns:

json-string – a JSON string

Return type:

str

nuclei.client.utils.serialize_json_bytes(obj)[source]

Takes an object and converts it to a JSON-bytes-string. Uses orjson.dumps() to do the heavy lifting.

Serializable objects are (amongst others):
  • python natives

  • dataclasses

  • datetime objects

  • numpy objects

Some known objects that are not serializable:
  • numpy.float16

  • numpy.float128

Options:
  • Serialize datetime.datetime objects without a tzinfo as UTC. This has no effect on datetime.datetime objects that have tzinfo set.

  • Serialize a UTC timezone on datetime.datetime instances as Z instead of +00:00

  • Serialize numpy.ndarray instances. For more, see numpy.

Parameters:

obj (Any) – The object to serialize

Returns:

json-string – a JSON bytes-string

Return type:

bytes