Search the docs
Menu
Updated Edit on GitHub

Console: toolkit

Copy as Markdown

These routes are on the console, port 3375. They take an API token as Authorization: Bearer ndt_...; see API tokens.

Small network and text tools.

POST /api/toolkit/base64

Encode a text in base64 or decode it.

Decoding skips characters that are not base64 and takes the URL-safe alphabet too.

Needs device.connect. neodesk toolkit base64 calls it.

Request body, application/json:

Field Type Required What it is
text string yes At most 1 MB
mode string, one of encode, decode encode when not given

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.result string yes
data.mode string yes The mode as given, encode when none was
Error When
400 The request is not valid
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

POST /api/toolkit/hash

Hash a text.

Needs device.connect. neodesk toolkit hash calls it.

Request body, application/json:

Field Type Required What it is
text string yes At most 1 MB
algorithm string, one of md5, sha1, sha256, sha512 sha256 for any other value; default "sha256"

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.algorithm string, one of md5, sha1, sha256, sha512 yes
data.hash string yes Lower-case hex of the UTF-8 text's digest
Error When
400 The request is not valid
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

POST /api/toolkit/jwt-decode

Decode a JWT without checking its signature.

Needs device.connect. neodesk toolkit jwt-decode calls it.

Request body, application/json:

Field Type Required
token string yes

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.header yes The decoded header
data.payload yes The decoded payload
data.expiry object or null yes From the exp claim, null without one
data.expiry.date string (date-time)
data.expiry.expired boolean
data.expiry.remainingSeconds integer
data.hasSig boolean yes Whether the token has a third part
Error When
400 The token is missing, or its header or payload is not base64 JSON
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

POST /api/toolkit/password

Generate a password.

With every character set turned off, the password takes lower-case letters and digits.

Needs device.connect. neodesk toolkit password calls it.

Request body, application/json:

Field Type What it is
length integer or string Held between 4 and 128; default 16, at least 4, at most 128
uppercase boolean or string or integer true, "true", "1" or 1; false, "false", "0" or 0; default true
lowercase boolean or string or integer true, "true", "1" or 1; false, "false", "0" or 0; default true
digits boolean or string or integer true, "true", "1" or 1; false, "false", "0" or 0; default true
symbols boolean or string or integer true, "true", "1" or 1; false, "false", "0" or 0; default false

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.password string yes
data.length integer yes
data.entropy integer yes Bits, rounded
data.charsetSize integer yes
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

POST /api/toolkit/ssl

Check the TLS certificate of a host.

Connects to the host from the server and reads its certificate. A leading http:// or https://, a path and a port in host are dropped. Hosts on loopback and link-local addresses are refused; private addresses are allowed. The connection and handshake time out after 8 seconds.

Needs device.connect. neodesk toolkit ssl calls it.

Request body, application/json:

Field Type Required What it is
host string yes A host name or address, at most 253 characters
port integer or string 443 when not given or 0; at least 1, at most 65535

200: The certificate; success false when the connection or handshake failed (application/json)

Object or ToolkitFailure.

Error When
400 The request is not valid
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

POST /api/toolkit/urlencode

Percent-encode a text for a URL or decode it.

Needs device.connect. neodesk toolkit urlencode calls it.

Request body, application/json:

Field Type Required What it is
text string yes At most 1 MB
mode string, one of encode, decode encode when not given

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.result string yes
data.mode string yes The mode as given, encode when none was
Error When
400 Text is missing or too large, or the text is not valid to encode or decode (URI malformed)
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

POST /api/toolkit/whois

Look up the DNS records of a domain.

Reads the A, AAAA, MX, TXT and NS records from the server, for up to 15 seconds. It does not query WHOIS. A record type that fails to resolve is an empty list. Names on loopback and link-local addresses are refused.

Needs device.connect. neodesk toolkit dns calls it.

Request body, application/json:

Field Type Required What it is
domain string yes A leading http:// or https://, a path and a port are dropped

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.domain string yes The domain as it was looked up, in lower case
data.dns object yes
data.dns.A array of string yes
data.dns.AAAA array of string yes
data.dns.MX array of object yes
data.dns.MX[].priority integer
data.dns.MX[].exchange string
data.dns.TXT array of string yes
data.dns.NS array of string yes
Error When
400 The request is not valid
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

POST /api/toolkit/wol

Send a wake-on-LAN packet from the server.

Sends the magic packet to UDP port 9 of the broadcast address. Loopback and link-local broadcast addresses are refused.

Needs device.connect. neodesk toolkit wake calls it.

Request body, application/json:

Field Type Required What it is
mac string yes Twelve hex digits, with or without : or -
broadcast string An IPv4 address; 255.255.255.255 when not given

200: Sent; success false when the packet could not be sent (application/json)

Object or ToolkitFailure.

Error When
400 The request is not valid
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token

Type to search pages, sections, commands and settings.