Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.

REST API

Stefan Arentz edited this page May 30, 2013 · 6 revisions

Talking to the REST API

Request Available Plans

curl -XGET http://127.0.0.1:8383/plans
{
  "plans": [
    {
      "description": "Run an nmap scan",
      "name": "nmap"
    },
    {
      "description": "Plan that runs long",
      "name": "long"
    },
    {
      "description": "Plan that fails",
      "name": "fail"
    },
    {
      "description": "Run Skipfish in a light configuration",
      "name": "skipfish"
    },
    {
      "description": "Run the ZAP Spider and Scanner",
      "name": "zap"
    },
    {
      "description": "Runs SSL related checks",
      "name": "ssl"
    },
    {
      "description": "Run basic tests",
      "name": "basic"
    }
  ],
  "success": true
}

See details for a specific plan

curl -XGET http://127.0.0.1:8383/plans/basic
{
  "plan": {
    "description": "Run basic tests",
    "name": "basic",
    "workflow": [
      {
        "configuration": {},
        "description": "",
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.AlivePlugin",
          "weight": "light",
          "name": "Alive"
        }
      },
      {
        "configuration": {},
        "description": "",
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.XFrameOptionsPlugin",
          "weight": "light",
          "name": "XFrameOptions"
        }
      },
      {
        "configuration": {},
        "description": "",
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.HSTSPlugin",
          "weight": "light",
          "name": "HSTS"
        }
      },
      {
        "configuration": {},
        "description": "",
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.XContentTypeOptionsPlugin",
          "weight": "light",
          "name": "XContentTypeOptions"
        }
      },
      {
        "configuration": {},
        "description": "",
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.XXSSProtectionPlugin",
          "weight": "light",
          "name": "XXSSProtection"
        }
      },
      {
        "configuration": {},
        "description": "",
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.ServerDetailsPlugin",
          "weight": "light",
          "name": "ServerDetails"
        }
      },
      {
        "configuration": {},
        "description": "",
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.RobotsPlugin",
          "weight": "light",
          "name": "Robots"
        }
      },
      {
        "configuration": {},
        "description": "",
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.CSPPlugin",
          "weight": "light",
          "name": "CSP"
        }
      }
    ]
  },
  "success": true
}

Create a new scan

You can start a scan against a specific host by POSTting a JSON configuration that contains the plan name and the scan configuration:

curl -H "Content-Type: application/json" -XPOST \
  -d '{"plan":"basic", "configuration":{"target":"http://foobar"}}' \
  http://127.0.0.1:8383/scans
{
  "success": true,
  "scan": {
    "sessions": [
      {
        "description": "",
        "started": null,
        "finished": null,
        "configuration": {
          "target": "http://foobar"
        },
        "id": "b5a99722-363a-4876-b134-bd3d4e89ba96",
        "issues": [],
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.AlivePlugin",
          "weight": "light",
          "name": "Alive"
        },
        "artifacts": {},
        "created": 1369920876,
        "state": "CREATED",
        "progress": null,
        "queued": null
      },
      {
        "description": "",
        "started": null,
        "finished": null,
        "configuration": {
          "target": "http://foobar"
        },
        "id": "23837f8e-70a7-4c84-84a3-fb4151e5807a",
        "issues": [],
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.XFrameOptionsPlugin",
          "weight": "light",
          "name": "XFrameOptions"
        },
        "artifacts": {},
        "created": 1369920876,
        "state": "CREATED",
        "progress": null,
        "queued": null
      },
      {
        "description": "",
        "started": null,
        "finished": null,
        "configuration": {
          "target": "http://foobar"
        },
        "id": "eb0c8465-13c6-453e-8030-8601ac7b4cf7",
        "issues": [],
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.HSTSPlugin",
          "weight": "light",
          "name": "HSTS"
        },
        "artifacts": {},
        "created": 1369920876,
        "state": "CREATED",
        "progress": null,
        "queued": null
      },
      {
        "description": "",
        "started": null,
        "finished": null,
        "configuration": {
          "target": "http://foobar"
        },
        "id": "d12e7020-db75-4aa2-8854-29ad6d318bbf",
        "issues": [],
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.XContentTypeOptionsPlugin",
          "weight": "light",
          "name": "XContentTypeOptions"
        },
        "artifacts": {},
        "created": 1369920876,
        "state": "CREATED",
        "progress": null,
        "queued": null
      },
      {
        "description": "",
        "started": null,
        "finished": null,
        "configuration": {
          "target": "http://foobar"
        },
        "id": "b5790ed6-aaf8-4467-8e7f-c2ec19e1a488",
        "issues": [],
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.XXSSProtectionPlugin",
          "weight": "light",
          "name": "XXSSProtection"
        },
        "artifacts": {},
        "created": 1369920876,
        "state": "CREATED",
        "progress": null,
        "queued": null
      },
      {
        "description": "",
        "started": null,
        "finished": null,
        "configuration": {
          "target": "http://foobar"
        },
        "id": "e7bc2634-186c-4110-b971-8febf127d03d",
        "issues": [],
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.ServerDetailsPlugin",
          "weight": "light",
          "name": "ServerDetails"
        },
        "artifacts": {},
        "created": 1369920876,
        "state": "CREATED",
        "progress": null,
        "queued": null
      },
      {
        "description": "",
        "started": null,
        "finished": null,
        "configuration": {
          "target": "http://foobar"
        },
        "id": "b1fd5cdf-f268-472f-befc-b2f169d9733b",
        "issues": [],
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.RobotsPlugin",
          "weight": "light",
          "name": "Robots"
        },
        "artifacts": {},
        "created": 1369920876,
        "state": "CREATED",
        "progress": null,
        "queued": null
      },
      {
        "description": "",
        "started": null,
        "finished": null,
        "configuration": {
          "target": "http://foobar"
        },
        "id": "993b717b-5cd0-4bb9-a3cd-6ec09d72aff6",
        "issues": [],
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.CSPPlugin",
          "weight": "light",
          "name": "CSP"
        },
        "artifacts": {},
        "created": 1369920876,
        "state": "CREATED",
        "progress": null,
        "queued": null
      }
    ],
    "started": null,
    "finished": null,
    "meta": {
      "owner": null,
      "tags": []
    },
    "plan": {
      "name": "basic",
      "revision": 0
    },
    "configuration": {
      "target": "http://foobar"
    },
    "id": "4e33e9c0-0d6e-45c9-88df-3b76cc790f5d",
    "created": 1369920876,
    "state": "CREATED",
    "queued": null
  }
}

Starting a scan

You start the scan by PUTting START to it's control channel:

curl -XPUT -H "Content-Type: application/json" -d START \
    http://127.0.0.1:8383/scans/4e33e9c0-0d6e-45c9-88df-3b76cc790f5d/state
{
    "success": true
}

Getting the scan status and results
-----------------------------------

You can grab the scan by GETting it:

```shell
curl -XGET http://127.0.0.1:8383/scans/4e33e9c0-0d6e-45c9-88df-3b76cc790f5d
{
  "success": true,
  "scan": {
    "configuration": {
      "target": "http://foobar"
    },
    "created": 1369920876,
    "started": 1369921238,
    "sessions": [
      {
        "description": "",
        "created": 1369920876,
        "artifacts": {},
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.AlivePlugin",
          "weight": "light",
          "name": "Alive"
        },
        "state": "FINISHED",
        "queued": 1369921238,
        "started": 1369921238,
        "finished": 1369921238,
        "progress": null,
        "_task": "cdee9b29-a5b1-4343-9708-28dec5760931",
        "configuration": {
          "target": "http://foobar"
        },
        "id": "b5a99722-363a-4876-b134-bd3d4e89ba96",
        "issues": []
      },
      {
        "description": "",
        "created": 1369920876,
        "artifacts": {},
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.XFrameOptionsPlugin",
          "weight": "light",
          "name": "XFrameOptions"
        },
        "state": "FINISHED",
        "queued": 1369921238,
        "started": 1369921238,
        "finished": 1369921239,
        "progress": null,
        "_task": "7ca57086-eba3-4f7c-ac8f-d1ffe4b71f14",
        "configuration": {
          "target": "http://foobar"
        },
        "id": "23837f8e-70a7-4c84-84a3-fb4151e5807a",
        "issues": [
          {
            "Id": "291fd3ae-208c-42a5-92df-db86ebb0f147",
            "Severity": "Info",
            "Summary": "Site has a correct X-Frame-Options header"
          }
        ]
      },
      {
        "description": "",
        "created": 1369920876,
        "artifacts": {},
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.HSTSPlugin",
          "weight": "light",
          "name": "HSTS"
        },
        "state": "FINISHED",
        "queued": 1369921239,
        "started": 1369921239,
        "finished": 1369921239,
        "progress": null,
        "_task": "b7cd3c5b-f399-42fd-b2fc-071a8985d40b",
        "configuration": {
          "target": "http://foobar"
        },
        "id": "eb0c8465-13c6-453e-8030-8601ac7b4cf7",
        "issues": []
      },
      {
        "description": "",
        "created": 1369920876,
        "artifacts": {},
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.XContentTypeOptionsPlugin",
          "weight": "light",
          "name": "XContentTypeOptions"
        },
        "state": "FINISHED",
        "queued": 1369921239,
        "started": 1369921239,
        "finished": 1369921240,
        "progress": null,
        "_task": "d72d912a-e029-4daf-a85a-4cade9be3e89",
        "configuration": {
          "target": "http://foobar"
        },
        "id": "d12e7020-db75-4aa2-8854-29ad6d318bbf",
        "issues": [
          {
            "Id": "6b93eb26-6a92-429a-8ec5-e79656a0a67d",
            "Severity": "High",
            "Summary": "Site does not set X-Content-Type-Options header"
          }
        ]
      },
      {
        "description": "",
        "created": 1369920876,
        "artifacts": {},
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.XXSSProtectionPlugin",
          "weight": "light",
          "name": "XXSSProtection"
        },
        "state": "FINISHED",
        "queued": 1369921240,
        "started": 1369921240,
        "finished": 1369921241,
        "progress": null,
        "_task": "02242425-93ad-4afe-837a-216142d22ffb",
        "configuration": {
          "target": "http://foobar"
        },
        "id": "b5790ed6-aaf8-4467-8e7f-c2ec19e1a488",
        "issues": [
          {
            "Id": "c6f7f461-556d-413d-b0a8-0e0e7a1a70f8",
            "Severity": "High",
            "Summary": "Site does not set X-XSS-Protection header"
          }
        ]
      },
      {
        "description": "",
        "created": 1369920876,
        "artifacts": {},
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.ServerDetailsPlugin",
          "weight": "light",
          "name": "ServerDetails"
        },
        "state": "FINISHED",
        "queued": 1369921241,
        "started": 1369921241,
        "finished": 1369921241,
        "progress": null,
        "_task": "2e2c4224-256e-4f00-94e1-a60d92aca8f2",
        "configuration": {
          "target": "http://foobar"
        },
        "id": "e7bc2634-186c-4110-b971-8febf127d03d",
        "issues": []
      },
      {
        "description": "",
        "created": 1369920876,
        "artifacts": {},
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.RobotsPlugin",
          "weight": "light",
          "name": "Robots"
        },
        "state": "FINISHED",
        "queued": 1369921241,
        "started": 1369921241,
        "finished": 1369921242,
        "progress": null,
        "_task": "3706fef2-5f70-46d2-a42e-f44a9eb34c68",
        "configuration": {
          "target": "http://foobar"
        },
        "id": "b1fd5cdf-f268-472f-befc-b2f169d9733b",
        "issues": []
      },
      {
        "description": "",
        "created": 1369920876,
        "artifacts": {},
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.CSPPlugin",
          "weight": "light",
          "name": "CSP"
        },
        "state": "FINISHED",
        "queued": 1369921242,
        "started": 1369921242,
        "finished": 1369921243,
        "progress": null,
        "_task": "84fd86a7-93c4-4b38-b2b2-c7089e683e70",
        "configuration": {
          "target": "http://foobar"
        },
        "id": "993b717b-5cd0-4bb9-a3cd-6ec09d72aff6",
        "issues": [
          {
            "Id": "fa730ebc-227d-4a3c-9569-aa16e3dcc55e",
            "Severity": "High",
            "Summary": "No X-Content-Security-Policy header set"
          }
        ]
      }
    ],
    "state": "FINISHED",
    "queued": 1369921234,
    "finished": 1369921243,
    "meta": {
      "owner": null,
      "tags": []
    },
    "plan": {
      "name": "basic",
      "revision": 0
    },
    "id": "4e33e9c0-0d6e-45c9-88df-3b76cc790f5d"
  }
}

Getting a scan summary

You can also get a shorter version of the scan results by asking for the summmary:

curl -XGET http://127.0.0.1:8383/scans/4e33e9c0-0d6e-45c9-88df-3b76cc790f5d/summary
{
  "success": true,
  "summary": {
    "isues": {
      "High": 3,
      "Info": 1,
      "Medium": 0,
      "Low": 0
    },
    "state": "FINISHED",
    "id": "4e33e9c0-0d6e-45c9-88df-3b76cc790f5d",
    "sessions": [
      {
        "state": "FINISHED",
        "id": "b5a99722-363a-4876-b134-bd3d4e89ba96",
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.AlivePlugin",
          "weight": "light",
          "name": "Alive"
        }
      },
      {
        "state": "FINISHED",
        "id": "23837f8e-70a7-4c84-84a3-fb4151e5807a",
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.XFrameOptionsPlugin",
          "weight": "light",
          "name": "XFrameOptions"
        }
      },
      {
        "state": "FINISHED",
        "id": "eb0c8465-13c6-453e-8030-8601ac7b4cf7",
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.HSTSPlugin",
          "weight": "light",
          "name": "HSTS"
        }
      },
      {
        "state": "FINISHED",
        "id": "d12e7020-db75-4aa2-8854-29ad6d318bbf",
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.XContentTypeOptionsPlugin",
          "weight": "light",
          "name": "XContentTypeOptions"
        }
      },
      {
        "state": "FINISHED",
        "id": "b5790ed6-aaf8-4467-8e7f-c2ec19e1a488",
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.XXSSProtectionPlugin",
          "weight": "light",
          "name": "XXSSProtection"
        }
      },
      {
        "state": "FINISHED",
        "id": "e7bc2634-186c-4110-b971-8febf127d03d",
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.ServerDetailsPlugin",
          "weight": "light",
          "name": "ServerDetails"
        }
      },
      {
        "state": "FINISHED",
        "id": "b1fd5cdf-f268-472f-befc-b2f169d9733b",
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.RobotsPlugin",
          "weight": "light",
          "name": "Robots"
        }
      },
      {
        "state": "FINISHED",
        "id": "993b717b-5cd0-4bb9-a3cd-6ec09d72aff6",
        "plugin": {
          "version": "0.0",
          "class": "minion.plugins.basic.CSPPlugin",
          "weight": "light",
          "name": "CSP"
        }
      }
    ]
  }
}

Clone this wiki locally