Автоматизация Фреймворк
Это дополнение обеспечивает структуру, которая позволяет автоматизировать ZAP простым и гибким способом.
Он предоставляет следующие параметры командной строки:
- -autorun <source> Run the automation jobs specified in the file or from the URL.
- -autogenmin <filename> Сгенерировать файл автоматизации шаблона с ключевыми параметрами.
- -autogenmax <filename> Сгенерировать файл автоматизации шаблона со всеми параметрами.
- -autogenconf <filename> Сгенерировать файл автоматизации шаблона с использованием текущей конфигурации.
- -autocheck <source> Check the specified automation plan in the file or from the URL.
If the -autorun option is used with the ZAP -cmd option then the ZAP exit value will be set by default as follows:
- 0 - план выполнен успешно, ошибок и предупреждений нет.
- 1 - План сообщил об одной или нескольких ошибках
- 2 - План не сообщил об ошибках, кроме одного или нескольких предупреждений.
These values can be overridden by the exitStatus job.
Whether the plan completed after encountering errors or warnings will depend on the settings used in the environment.
Чтобы использовать среду автоматизации:
- Создайте файл автоматизации шаблона, используя один из параметров командной строки
-autogen *
- Отредактируйте файл в соответствии с вашими требованиями
- Запустите файл с помощью параметра командной строки
-autorun , например. ./zap.sh -cmd -autorun config.yaml
Note: The Jobs are executed in the order in which they appear (top to bottom) within the Plan.
В большинстве случаев рекомендуется также использовать параметр командной строки -cmd , чтобы рабочий стол ZAP не отображался.
и ZAP завершает работу, как только завершит создание или выполнение заданий, определенных в файле.
Однако вы можете запускать задания Automation Framework с помощью рабочего стола ZAP, чтобы помочь вам отладить проблемы.
The Automation Framework supports all of the authentication mechanisms supported by ZAP.
GUI находится в стадии разработки и предоставляет постоянно расширяющийся набор функций.
The Automation Options screen allows you to configure specific options.
The following API endpoints are provided by this add-on:
- Action: endDelayJob() - ends the currently running delay job, if any
- Действие: runPlan (filePath) - загружает и асинхронно запускает план в указанном файле, возвращая planId
- Action: stopPlan(planId) - stops the running plan identified by the planId
- Вид:
planProgress (planId) - возвращает сведения о прогрессе для указанного planId
If the ZAP desktop is being used then the plan will also be shown in the GUI to make it easier to diagnose any problems.
Note that some jobs may not stop immediately, for example if authentication is being handled.
The environment section of the file defines the applications which the rest of the jobs can act on.
All file and directory paths can either be absolute or relative to the directory containing the plan.
Relative paths are recommended for portability.
The following automation jobs are supported by this add-on:
- activeScan-config - configures the active scanner
- activeScan-policy - creates an active policy
- addOns - add-on management, now deprecated
- delay - приостанавливает выполнение плана на указанный период времени или выполняется определенное условие
- requestor - crafts specific requests to send отправить по соответствующим целям
- activeScan - runs the active scanner
- exitStatus - sets ZAP's exit code based on scan results
The following options can be applied to all jobs, via the automation plan or the GUI:
enabled - only jobs that are enabled will run.
alwaysRun - enabled jobs with this option will run even if the plan exits early.
Importance of Job Order
The order of jobs is relevant and important. For example:
- there is no point putting a passiveScan-wait job before any sort of spidering or importing
- configuring an alertFilter job after alerts have been generated by passive or active scanning will have no effect on the Alerts that were raised by those components in earlier jobs
Рабочие тесты могут быть добавлены к заданиям, чтобы проверить, что задания выполняются должным образом.
Эта структура является подключаемой, поэтому другие надстройки могут добавлять поддержку для других заданий, см.
Automation Framework для получения более полного списка.
Шаблоны «min» и «max» включают комментарии, дающие дополнительную информацию о полях.