# AI agent 與掃描器

> 說明 PentAGI 等自主式 agent 與 DAST 或弱點掃描器的差異，以及如何將兩者結合使用。

弱點掃描器與 AI [pentest](https://pentagi.com/zh-tw/docs/glossary/#pentest) [agent](https://pentagi.com/zh-tw/docs/glossary/#agent) 都會尋找弱點，但兩者的運作方式不同。DAST 掃描器會對執行中的應用程式執行一組固定的檢查。agent 則會根據目標規劃測試，並依據迄今為止的發現來選擇每一個下一步。

|         | 掃描器的做法             | AI agent 的做法                                                          |
| ------- | ------------------ | --------------------------------------------------------------------- |
| 如何選擇下一步 | 遵循固定的檢查清單與爬蟲       | 遵循其 plan，並在每個 [subtask](https://pentagi.com/zh-tw/docs/glossary/#subtask) 之後進行修訂               |
| 能夠觸及的範圍 | 爬蟲找到的頁面與請求         | [task](https://pentagi.com/zh-tw/docs/glossary/#task) 所指定的任何目標：主機、服務、Web 應用程式、API              |
| 使用的工具   | 自身的引擎              | [sandbox](https://pentagi.com/zh-tw/docs/glossary/#sandbox) 中的 20 多種安全工具、網頁搜尋，以及 agents 撰寫的程式碼 |
| 報告內容    | 與已知模式的比對結果，需逐一進行分類 | 包含導致這些結果的步驟，並彙整於 [report](https://pentagi.com/zh-tw/docs/glossary/#report) 中                   |
| 執行是否可重複 | 相同的檢查會產生相同的結果      | 同一個 task 的兩次執行結果可能不同                                                  |
| 所需時間與成本 | 數分鐘，無模型成本          | 執行時間較長，會消耗模型 token 或 GPU 時間                                           |

## [何時該使用哪一種](https://pentagi.com/zh-tw/docs/concepts/agents-and-scanners/#when-to-use-which)

* 掃描器提供廣泛且可重複的涵蓋範圍：在每次發布時於 CI 中執行，或依排程執行，以便及早發現已知問題。
* agent 提供深度：它會檢查個別弱點是否會累積成一條進入系統的實際路徑、追蹤掃描器標記的問題，並測試爬蟲無法觸及的服務。

兩者搭配使用效果良好。PentAGI 可以從其 sandbox 執行掃描工具，並調查它們所報告的內容；您也可以將掃描器的 report 上傳至 [flow](https://pentagi.com/zh-tw/docs/glossary/#flow)，並要求 agents 檢查其 [findings](https://pentagi.com/zh-tw/docs/glossary/#finding)。

## [agent 需要您提供什麼](https://pentagi.com/zh-tw/docs/concepts/agents-and-scanners/#what-an-agent-needs-from-you)

* 寫入 task 中的目標、目的與範圍 — 請參閱 [Autonomous penetration testing](https://pentagi.com/zh-tw/docs/concepts/autonomous-pentesting/#where-you-stay-in-control)。
* 為主要 agents 選擇強大的模型 — 請參閱 [Choosing models](https://pentagi.com/zh-tw/docs/configuration/llm-providers/#choosing-models)。
* 對範圍內的每一個目標進行測試的授權。