Acunetix API
Acunetix API是創建自定義工具來管理Acunetix功能的好方法。
本文檔將引導您使用API文檔,嘗試使用可用的API函數來執行單元測試,以幫助您創建自己的工具。您可以在此處下載API文檔。
假設:您將需要在要部署此處討論的環境的同一臺計算機上安裝Acunetix。
對于此示例,我們將使用API文檔通過“ / scans”端點使用“ getScans”功能來檢索掃描列表。
將API文檔文件加載到瀏覽器中,并使用左側的欄,向下滾動到標題為“ API方法-掃描”的部分,然后單擊“ getScans”項。

這將帶您到此特定功能的文檔,并帶有“ curl”命令行示例,您可以使用該示例來模擬用于單元測試的API調用。在此示例中,建議的命令是:
curl -X GET -H“ X-Auth:[[apiKey]]”“ https://127.0.0.1:3443/api/v1/scans?c=&l=&q=&s=”
如您所見,URL指向127.0.0.1:3443-如果您希望將此請求指向其他主機上的Acunetix安裝,則需要適當地替換IP地址。
另外,您需要用Acunetix API密鑰替換“ [[apiKey]]”,該密鑰可從Acunetix UI的“個人資料”頁面獲得:

點擊“復制”按鈕會將您的API密鑰復制到剪貼板。現在,您可以將其替換為命令行:
curl -X GET -H“ X-Auth:1986ad8c0a5b3df4d7028d5f3c0abcdeffce628fc6a24411491808049a33e872d”“ https://127.0.0.1:3443/api/v1/scans?c=&l=&q=&s=”
現在我們需要在網址中的“?”之后調整參數。
此請求的最簡單形式是不帶任何參數的請求:
curl -X GET -H“ X-Auth:1986ad8c0a5b3df4d7028d5f3c0abcdeffce628fc6a24411491808049a33e872d”“ https://127.0.0.1:3443/api/v1/scans”
這將為您提供所有掃描的完整列表。您可以對“ curl”使用“ -k”選項來克服一些與證書檢查有關的挑戰:
curl -X GET -k -H“ X-Auth:1986ad8c0a5b3df4d7028d5f3c0abcdeffce628fc6a24411491808049a33e872d”“ https://127.0.0.1:3443/api/v1/scans”
這是對此類請求的響應的示例摘錄:
{
"pagination": {
"count": 5,
"cursor_hash": "8f629dd49f910b9202eb0da5d51fdb6e",
"cursors": [
null
],
"sort": null
},
"scans": [
{
"criticality": 10,
"current_session": {
"acusensor": true,
"event_level": 1,
"progress": 100,
"scan_session_id": "89bcd86a-0b58-4a6b-b60d-72f2351e33ba",
"severity_counts": {
"high": 8,
"info": 6,
"low": 12,
"medium": 11
},
"start_date": "2020-03-06T10:27:45.859166+00:00",
"status": "completed",
"threat": 3
},
"incremental": false,
"max_scan_time": 0,
"next_run": null,
"profile_id": "11111111-1111-1111-1111-111111111111",
"profile_name": "Full Scan",
"report_template_id": null,
"scan_id": "86b995f2-63fb-48e0-a785-b335bc372bfa",
"schedule": {
"disable": false,
"history_limit": null,
"recurrence": null,
"start_date": null,
"time_sensitive": false,
"triggerable": false
},
"target": {
"address": "http://testaspnet.vulnweb.com/",
"criticality": 10,
"description": "Test ASP .NET Site",
"type": "default"
},
"target_id": "2841ec02-1e15-4454-8417-f03f836b13c4"
},
{
"criticality": 10,
"current_session": {
"event_level": 1,
"progress": 100,
"scan_session_id": "8a12502d-3251-421d-a89a-1856e198a870",
"severity_counts": {
"high": 11,
"info": 4,
"low": 7,
"medium": 8
},
"start_date": "2020-03-06T10:27:16.613259+00:00",
"status": "completed",
"threat": 3
},
"incremental": false,
"max_scan_time": 0,
"next_run": null,
"profile_id": "11111111-1111-1111-1111-111111111111",
"profile_name": "Full Scan",
"report_template_id": null,
"scan_id": "1c3a1c3f-c242-4585-8ea0-99c9086591e6",
"schedule": {
"disable": false,
"history_limit": null,
"recurrence": null,
"start_date": null,
"time_sensitive": false,
"triggerable": false
},
"target": {
"address": "http://testasp.vulnweb.com/",
"criticality": 10,
"description": "Test ASP Site",
"type": "default"
},
"target_id": "9fc16bf7-7bad-4208-94a4-5da5f6c623ad"
},
響應的第一部分包含分頁信息;第二部分(我們在這里只能看到一部分)包含與請求匹配的所有掃描的信息;在這種情況下,它將包含所有掃描,因為我們沒有應用任何過濾器(或者前100次掃描,因為API允許每個請求最大100個掃描響應)。
推薦文章: