zdns-rest

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2025 License: MIT Imports: 28 Imported by: 0

README

zdns-rest

A simple REST API for zdns. See zmap/zdns for more information.

Build

go build -o zdns-rest cmd/main.go

Run

./zdns-rest --bind-ip 127.0.0.1 --bind-port 8080

API

POST /job/{lookup}
  • lookup: string, name of the lookup module to use (e.g. MX, A, AAAA, etc.) - see zmap/zdns for more information, optional (default: A)

  • Body:

    • queries: array of strings, names to lookup
    • module: string, name of the lookup module to use (e.g. MX, A, AAAA, etc.) (optional, default: A)
  • Response: JSON response, delimited by newlines - see zmap/zdns

    • data: array of DNS records
    • name: string, name of the lookup
    • status: string, status of the lookup
    • timestamp: string, timestamp of the lookup
GET /ping
  • Body: empty

  • Response: JSON string with code 1000 and message "Command completed successfully"

Example

$ ./zdns-rest --iterative
$ curl -X POST -H "Content-Type: application/json" -d '{"module": "MXLOOKUP", "queries": ["google.com", "bing.com"]}' http://localhost:8080/job
{
  "data": {
    "exchanges": [
      {
        "class": "IN",
        "ipv4_addresses": [
          "74.125.71.27",
          "74.125.71.26",
          "74.125.133.27",
          "74.125.133.26",
          "64.233.166.27"
        ],
        "name": "smtp.google.com",
        "preference": 10,
        "ttl": 300,
        "type": "MX"
      }
    ]
  },
  "name": "google.com",
  "status": "NOERROR",
  "timestamp": "2025-02-02T17:28:04+01:00"
}
{
  "data": {
    "exchanges": [
      {
        "class": "IN",
        "name": "bing-com.mail.protection.outlook.com",
        "preference": 10,
        "ttl": 3600,
        "type": "MX"
      }
    ]
  },
  "name": "bing.com",
  "status": "NOERROR",
  "timestamp": "2025-02-02T18:01:47+01:00"
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL