Skip to content

Commit 710097a

Browse files
authored
Update nuclei flags and broken nuclei-templates (#6)
* action: refac and update to new nuclei version - remove some default values, set a default value for a not required input cause scripts to every run the rule with value. - fix nuclei templates directory - remove user-agent flag for default - add options to include-rr and report-config * readme: add github issues example
1 parent 8130238 commit 710097a

File tree

2 files changed

+66
-15
lines changed

2 files changed

+66
-15
lines changed

README.md

+32-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,34 @@ jobs:
4242
path: nuclei.log
4343
```
4444

45+
Example with nuclei generating an ISSUE with the report:
46+
47+
*.github/workflows/nuclei.yml*
48+
```
49+
on:
50+
workflow_dispatch:
51+
schedule:
52+
- cron: "0 10 * * *"
53+
54+
jobs:
55+
worker:
56+
runs-on: ubuntu-20.04
57+
steps:
58+
- uses: actions/checkout@v2
59+
60+
- uses: actions/cache@v2
61+
id: cache
62+
with:
63+
path: /home/runner/go/bin/nuclei
64+
key: ${{ runner.os }}-${{ hashFiles('/home/runner/go/bin/nuclei') }}
65+
66+
- uses: projectdiscovery/nuclei-action@main
67+
with:
68+
urls: "urls.txt"
69+
github-report: true
70+
report-token: ${{ secrets.GITHUB_TOKEN }}
71+
```
72+
4573
Inputs
4674
------
4775

@@ -50,5 +78,8 @@ Inputs
5078
| `urls` | List of urls to run templates | true
5179
| `templates` | Templates input file/files to check across hosts | false
5280
| `output` | File to save output result | false
81+
| `include-rr` | Include request/response in log | false
5382
| `nuclei-ignore` | Define templates that will be blocked from execution | false
54-
| `user-agent` | Set a User-Agent header | false
83+
| `user-agent` | Set a User-Agent header | false
84+
| `github-report` | Set `true` for generate an issue with the report | false
85+
| `report-token` | Set the Github Token | false

action.yml

+34-14
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,62 @@ inputs:
99
templates:
1010
description: "Templates input file/files to check across hosts"
1111
required: false
12-
default: "nuclei-templates"
1312
output:
1413
description: "File to save output result"
1514
required: false
1615
default: "nuclei.log"
16+
include-rr:
17+
description: "Write requests/responses for matches in JSON output"
18+
required: false
19+
default: false
1720
nuclei-ignore:
1821
description: "define templates that will be blocked from execution"
1922
required: false
20-
default: ".nuclei-ignore"
2123
user-agent:
2224
description: "Set a User-Agent header"
2325
required: false
24-
default: "Nuclei - Open-source project (github.com/projectdiscovery/nuclei)"
25-
26+
github-report:
27+
description: "Active Nuclei Reporting Module for Github"
28+
required: false
29+
default: false
30+
report-token:
31+
description: "Github token for create issues"
32+
required: false
33+
2634
runs:
2735
using: "composite"
2836
steps:
2937
- run: |
3038
[ ! -x /home/runner/go/bin/nuclei ] && GO111MODULE=on go get -v github.com/projectdiscovery/nuclei/v2/cmd/nuclei
3139
echo "/home/runner/go/bin/" >> $GITHUB_PATH
3240
shell: bash
33-
3441
- run: |
42+
[ ! -z ${{ inputs.nuclei-ignore }} ] && cp ${{ inputs.nuclei-ignore }} /nuclei-templates/.nuclei-ignore
43+
[ ! -z "${{ inputs.user-agent }}" ] && echo 'useragent=-H "User-Agent: ${{ inputs.user-agent }}"' >> $GITHUB_ENV
44+
${{ inputs.include-rr }} && echo "includerr=-irr" >> $GITHUB_ENV
45+
46+
${{ inputs.github-report }} \
47+
&& touch ~/nuclei-report-config.yaml \
48+
&& echo -e "github:" >> ~/nuclei-report-config.yaml \
49+
&& echo -e " username: \"$GITHUB_ACTOR\"" >> ~/nuclei-report-config.yaml \
50+
&& echo -e " owner: \"${GITHUB_REPOSITORY%%/*}\"" >> ~/nuclei-report-config.yaml \
51+
&& echo -e " token: \"${{ inputs.report-token }}\"" >> ~/nuclei-report-config.yaml \
52+
&& echo -e " project-name: \"${GITHUB_REPOSITORY#*/}\"" >> ~/nuclei-report-config.yaml \
53+
&& echo -e " issue-label: \"Nuclei Reporting\"" >> ~/nuclei-report-config.yaml \
54+
&& echo "reportconfig=-rc ~/nuclei-report-config.yaml" >> $GITHUB_ENV
55+
3556
nuclei \
3657
-update-templates \
37-
-update-directory ./ \
38-
\
39-
40-
[ -e ${{ inputs.nuclei-ignore }} ] && cp ${{ inputs.nuclei-ignore }} ${{ inputs.templates }}/.nuclei-ignore
41-
58+
-update-directory ./nuclei-templates
59+
shell: bash
60+
- run: |
61+
4262
nuclei \
4363
-l ${{ inputs.urls }} \
44-
-t ${{ inputs.templates }} \
64+
-t ./nuclei-templates/${{ inputs.templates }} \
65+
${{ env.useragent }} \
4566
-o ${{ inputs.output }} \
46-
-H "User-Agent: ${{ inputs.user-agent }}" \
4767
-json \
48-
-include-rr \
49-
\
68+
${{ env.reportconfig }} \
69+
${{ env.includerr }}
5070
shell: bash

0 commit comments

Comments
 (0)