Skip to main content
工作流使用户能够通过为各种模板设置定义的执行顺序来编排一系列操作。这些模板在预定条件下被激活,建立了一种流线型方法来利用nuclei的功能,根据用户的特定需求进行定制。因此,您可以创建依赖于特定技术或目标的工作流—例如那些专属于WordPress或Jira的工作流—仅在识别到相关技术时触发这些序列。 在工作流中,所有模板共享统一的执行环境,这意味着一个模板中的任何命名提取器都可以在另一个模板中通过简单引用其指定名称来无缝访问。
对于那些事先了解所使用技术栈的人,我们建议为您的扫描构建个性化工作流。这种策略方法不仅能大幅减少扫描持续时间,还能提高结果的质量和精确度。
工作流可以使用workflows属性定义,后跟要执行的template / subtemplatestags
workflows:
  - template: http/technologies/template-to-execute.yaml
工作流类型
  1. 通用工作流
  2. 条件工作流

通用工作流

在通用工作流中,可以从单个工作流文件定义单个或多个要执行的模板。它支持文件和目录作为输入。 一个在给定URL列表上运行所有配置相关模板的工作流。
workflows:
  - template: http/exposures/configs/git-config.yaml
  - template: http/exposures/configs/exposed-svn.yaml
  - template: http/vulnerabilities/generic/generic-env.yaml
  - template: http/exposures/backups/zip-backup-files.yaml
  - tags: xss,ssrf,cve,lfi
一个运行为您的项目定义的特定检查列表的工作流。
workflows:
  - template: http/cves/
  - template: http/exposures/
  - tags: exposures

条件工作流

您还可以创建条件模板,这些模板在匹配先前模板的条件后执行。这对于漏洞检测和利用以及基于技术的检测和利用特别有用。这类工作流的用例广泛且多样。 基于模板的条件检查 当基础模板匹配时执行子模板的工作流。
workflows:
  - template: http/technologies/jira-detect.yaml
    subtemplates:
      - tags: jira
      - template: exploits/jira/
基于匹配器名称的条件检查 当在结果中找到基础模板的匹配器时执行子模板的工作流。
workflows:
  - template: http/technologies/tech-detect.yaml
    matchers:
      - name: vbulletin
        subtemplates:
          - template: exploits/vbulletin-exp1.yaml
          - template: exploits/vbulletin-exp2.yaml
      - name: jboss
        subtemplates:
          - template: exploits/jboss-exp1.yaml
          - template: exploits/jboss-exp2.yaml
以类似方式,可以根据需要为工作流创建任意多和任意嵌套的检查。 基于子模板和匹配器名称的多级条件检查 展示模板执行链的工作流,这些模板仅在先前模板匹配时运行。
workflows:
  - template: http/technologies/tech-detect.yaml
    matchers:
      - name: lotus-domino
        subtemplates:
          - template: http/technologies/lotus-domino-version.yaml
            subtemplates:
              - template: http/cves/2020/xx-yy-zz.yaml
                subtemplates:
                  - template: http/cves/2020/xx-xx-xx.yaml
条件工作流是执行检查和漏洞检测的最有效方式的绝佳示例,而不是将所有模板应用于所有目标,通常会为您的时间带来良好的投资回报,并且对目标也更为温和。

共享执行上下文

Nuclei引擎支持在同一工作流的模板部分之间透明共享工作流cookiejar和键值。以下是一个工作流的示例,它从第一个模板中提取值并在第二个条件模板中使用它:
id: key-value-sharing-example
info:
  name: Key Value Sharing Example
  author: pdteam
  severity: info

workflows:
  - template: template-with-named-extractor.yaml
    subtemplates:
      - template: template-using-named-extractor.yaml
例如,以下模板从目标网页正文中提取href链接,并使该值在extracted键下可用:
# template-with-named-extractor.yaml

id: value-sharing-template1

info:
  name: value-sharing-template1
  author: pdteam
  severity: info

http:
  - path:
      - "{{BaseURL}}/path1"
    extractors:
      - type: regex
        part: body
        name: extracted
        regex:
          - 'href="(.*)"'
        group: 1
最后,工作流中的第二个模板将通过引用提取器名称(extracted)来使用获得的值:
# template-using-named-extractor.yaml

id: value-sharing-template2

info:
  name: value-sharing-template2
  author: pdteam
  severity: info

http:
  - raw:
      - |
        GET /path2 HTTP/1.1
        Host: {{Hostname}}
        
        {{extracted}}