-
Notifications
You must be signed in to change notification settings - Fork 7
65 lines (64 loc) · 2.46 KB
/
update.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Update database and its container
on:
workflow_dispatch:
schedule:
- cron: "0 3 1,15 * *"
jobs:
update-database:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Pre-setup
run: |
pip install -r <(curl https://raw.githubusercontent.com/scmanjarrez/CVEScannerV2/master/extra/requirements.txt)
echo "MSFV=$(curl -s https://raw.githubusercontent.com/rapid7/metasploit-framework/master/Gemfile.lock | perl -ne '/metasploit-framework\s*\((.*?)\)/ && print $1')-dev" >> $GITHUB_ENV
git config --global push.default current
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Retrieve latest database
uses: addnab/docker-run-action@v3
with:
image: scmanjarrez/cvescanner:db
options: --rm -v ${{ github.workspace }}:/tmp/cve
run: cp cve.db /tmp/cve
- name: Update DB
run: |
sudo chown runner:runner cve.db && sudo rm semicolon_delimited_script
python3 <(curl https://raw.githubusercontent.com/scmanjarrez/CVEScannerV2/master/extra/database.py)
sqlite3 cve.db .dump > dump.sql
grep -vx -f extra/schema.sql -f extra/pragma.sql dump.sql > data.sql
python3 extra/splitter.py -i data.sql
rm {data,dump}.sql
env:
NVD_KEY: ${{secrets.API_KEY}}
- name: Upload updated DB
uses: actions/upload-artifact@v4
with:
name: cve.db
path: cve.db
retention-days: 15
- name: Update repository
run: |
git checkout --orphan latest
git add -A
git commit -m "Update database (msf $MSFV)"
git branch -D master
git branch -m master
git push -f
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: scmanjarrez/cvescanner:db,scmanjarrez/cvescanner:latest
platforms: linux/amd64,linux/arm64,linux/arm/v7