pax_global_header 0000666 0000000 0000000 00000000064 14752631415 0014522 g ustar 00root root 0000000 0000000 52 comment=80e35fa90c807f0904985be9c0e94cf587fda279
greenbone-feed-sync-25.1.0/ 0000775 0000000 0000000 00000000000 14752631415 0015426 5 ustar 00root root 0000000 0000000 greenbone-feed-sync-25.1.0/.docker/ 0000775 0000000 0000000 00000000000 14752631415 0016753 5 ustar 00root root 0000000 0000000 greenbone-feed-sync-25.1.0/.docker/Dockerfile 0000664 0000000 0000000 00000002535 14752631415 0020752 0 ustar 00root root 0000000 0000000 FROM debian:stable-slim AS builder
COPY . /source
WORKDIR /source
RUN apt-get update && \
apt-get install --no-install-recommends --no-install-suggests -y \
gosu \
python3 \
python-is-python3 \
ssh-client \
pipx && \
apt-get remove --purge --auto-remove -y && \
rm -rf /var/lib/apt/lists/*
RUN pipx install poetry
RUN rm -rf dist && /root/.local/bin/poetry build -f wheel
FROM debian:stable-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=off
ENV PATH="/root/.local/bin:${PATH}"
WORKDIR /greenbone-feed-sync
RUN apt-get update && \
apt-get install --no-install-recommends --no-install-suggests -y \
gosu \
rsync \
python3 \
pipx \
openssh-client \
python3-pip && \
apt-get remove --purge --auto-remove -y && \
rm -rf /var/lib/apt/lists/*
RUN PIPX_HOME=/var/lib/pipx PIPX_BIN_DIR=/usr/bin
RUN addgroup --gid 1001 --system gvm && \
adduser --no-create-home --shell /bin/false --disabled-password --uid 1001 --system --group gvm
COPY --from=builder /source/dist/* /greenbone-feed-sync/
COPY .docker/entrypoint.sh /usr/local/bin/entrypoint
RUN python3 -m pip install --break-system-packages /greenbone-feed-sync/*
RUN chown -R gvm:gvm /greenbone-feed-sync && \
chown -R gvm:gvm /var/lib/ && \
chmod 755 /usr/local/bin/entrypoint
ENTRYPOINT [ "/usr/local/bin/entrypoint" ]
CMD ["/bin/bash"]
greenbone-feed-sync-25.1.0/.docker/entrypoint.sh 0000664 0000000 0000000 00000000040 14752631415 0021514 0 ustar 00root root 0000000 0000000 #!/bin/bash
exec gosu gvm "$@"
greenbone-feed-sync-25.1.0/.dockerignore 0000664 0000000 0000000 00000000067 14752631415 0020105 0 ustar 00root root 0000000 0000000 .git
.mypy_cache
.ruff_cache
.venv
.vscode
lib
htmlcov
greenbone-feed-sync-25.1.0/.github/ 0000775 0000000 0000000 00000000000 14752631415 0016766 5 ustar 00root root 0000000 0000000 greenbone-feed-sync-25.1.0/.github/CODEOWNERS 0000664 0000000 0000000 00000000050 14752631415 0020354 0 ustar 00root root 0000000 0000000 # default reviewers
* @greenbone/devops
greenbone-feed-sync-25.1.0/.github/dependabot.yml 0000664 0000000 0000000 00000001047 14752631415 0021620 0 ustar 00root root 0000000 0000000 version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
time: "04:00"
open-pull-requests-limit: 10
allow:
- dependency-type: direct
- dependency-type: indirect
commit-message:
prefix: "Deps"
groups:
python-packages:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "Deps"
groups:
github-actions:
patterns:
- "*"
greenbone-feed-sync-25.1.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14752631415 0021023 5 ustar 00root root 0000000 0000000 greenbone-feed-sync-25.1.0/.github/workflows/auto-merge.yml 0000664 0000000 0000000 00000000326 14752631415 0023614 0 ustar 00root root 0000000 0000000 name: Auto-merge rebase
on: pull_request_target
permissions:
contents: write
pull-requests: write
jobs:
auto-merge:
uses: greenbone/workflows/.github/workflows/auto-merge.yml@main
secrets: inherit
greenbone-feed-sync-25.1.0/.github/workflows/ci-python.yml 0000664 0000000 0000000 00000002412 14752631415 0023457 0 ustar 00root root 0000000 0000000 name: Build and test
on:
push:
branches:
- main
pull_request:
jobs:
linting:
name: Linting
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
uses: greenbone/workflows/.github/workflows/lint-python.yml@main
with:
lint-packages: "greenbone tests"
linter: ruff check
python-version: ${{ matrix.python-version }}
test:
name: Run all tests
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
uses: greenbone/workflows/.github/workflows/test-python.yml@main
with:
python-version: ${{ matrix.python-version }}
codecov:
name: Upload coverage to codecov.io
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Install and calculate and upload coverage to codecov.io
uses: greenbone/actions/coverage-python@v3
with:
python-version: "3.10"
token: ${{ secrets.CODECOV_TOKEN }}
mypy:
name: Check type information
uses: greenbone/workflows/.github/workflows/typing-python.yml@main
versioning:
name: Check versioning
uses: greenbone/workflows/.github/workflows/check-version.yml@main
greenbone-feed-sync-25.1.0/.github/workflows/codeql-analysis-python.yml 0000664 0000000 0000000 00000002235 14752631415 0026157 0 ustar 00root root 0000000 0000000 # For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [main]
pull_request:
branches: [main]
paths-ignore:
- "**/*.md"
- "**/*.txt"
schedule:
- cron: "30 5 * * 0" # 5:30h on Sundays
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ["python"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
greenbone-feed-sync-25.1.0/.github/workflows/conventional-commits.yml 0000664 0000000 0000000 00000000442 14752631415 0025716 0 ustar 00root root 0000000 0000000 name: Conventional Commits
on:
pull_request_target:
permissions:
pull-requests: write
jobs:
conventional-commits:
name: Conventional Commits
runs-on: ubuntu-latest
steps:
- name: Report Conventional Commits
uses: greenbone/actions/conventional-commits@v3
greenbone-feed-sync-25.1.0/.github/workflows/dependency-review.yml 0000664 0000000 0000000 00000000345 14752631415 0025165 0 ustar 00root root 0000000 0000000 name: 'Dependency Review'
on: [pull_request]
permissions:
contents: read
jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Dependency Review'
uses: greenbone/actions/dependency-review@v3
greenbone-feed-sync-25.1.0/.github/workflows/deploy-pypi.yml 0000664 0000000 0000000 00000000512 14752631415 0024017 0 ustar 00root root 0000000 0000000 name: Deploy on PyPI
on:
release:
types: [created]
jobs:
deploy:
permissions:
id-token: write
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/greenbone-feed-sync/
steps:
- name: Build and publish to PyPI
uses: greenbone/actions/pypi-upload@v3
greenbone-feed-sync-25.1.0/.github/workflows/push.yml 0000664 0000000 0000000 00000001556 14752631415 0022534 0 ustar 00root root 0000000 0000000 name: Build and Push to Greenbone Registry
on:
push:
branches: [ main ]
tags: ["v*"]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
ref-name:
type: string
description: "The ref to build a container image from. For example a tag v23.0.0."
required: true
jobs:
push:
name: Build and push to self-hosted harbor
uses: greenbone/workflows/.github/workflows/container-build-push-2nd-gen.yml@main
with:
build-docker-file: .docker/Dockerfile
image-labels: |
org.opencontainers.image.vendor=Greenbone
org.opencontainers.image.documentation=https://greenbone.github.io/docs/
org.opencontainers.image.base.name=debian:stable-slim
image-url: community/greenbone-feed-sync
ref-name: ${{ inputs.ref-name }}
service: greenbone-feed-sync
secrets: inherit
greenbone-feed-sync-25.1.0/.github/workflows/release.yml 0000664 0000000 0000000 00000001346 14752631415 0023172 0 ustar 00root root 0000000 0000000 name: Release greenbone-feed-sync
on:
pull_request:
types: [closed]
workflow_dispatch:
inputs:
release-type:
type: choice
description: "Release type. One of patch, minor or major"
options:
- patch
- minor
- major
release-version:
description: "Set an explicit version, that will overwrite release-type. Fails if version is not compliant."
type: string
jobs:
build-and-release:
name: Create a new release
uses: greenbone/workflows/.github/workflows/release-generic.yml@main
with:
versioning-scheme: semver
release-type: ${{ inputs.release-type }}
release-version: ${{ inputs.release-version }}
secrets: inherit
greenbone-feed-sync-25.1.0/.github/workflows/sbom-upload.yml 0000664 0000000 0000000 00000000415 14752631415 0023770 0 ustar 00root root 0000000 0000000 name: SBOM upload
on:
workflow_dispatch:
push:
branches: ["main"]
jobs:
SBOM-upload:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: 'SBOM upload'
uses: greenbone/actions/sbom-upload@v3
greenbone-feed-sync-25.1.0/.gitignore 0000664 0000000 0000000 00000002422 14752631415 0017416 0 ustar 00root root 0000000 0000000 # Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
# ruff
.ruff_cache/
# vscode settings
.vscode
# vim settings in virtualenv
.vim
process.log
greenbone-feed-sync-25.1.0/LICENSE 0000664 0000000 0000000 00000104515 14752631415 0016441 0 ustar 00root root 0000000 0000000 GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Copyright (C)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
.
greenbone-feed-sync-25.1.0/README.md 0000664 0000000 0000000 00000116157 14752631415 0016720 0 ustar 00root root 0000000 0000000 
# greenbone-feed-sync
Tool for downloading the Greenbone Community Feed.
`greenbone-feed-sync` assumes you are using the latest feed release and up to
date components of the Greenbone Community Edition by default. It is highly
configurable and can be adjusted easily for downloading different feed releases
and types.
- [Installation](#installation)
- [Version](#version)
- [Requirements](#requirements)
- [Install using pipx](#install-using-pipx)
- [Install using pip](#install-using-pip)
- [Usage](#usage)
- [Usage on Kali Linux](#usage-on-kali-linux)
- [Command Completion](#command-completion)
- [Settings](#settings)
- [verbose](#verbose)
- [quiet](#quiet)
- [config](#config)
- [private-directory](#private-directory)
- [compression-level](#compression-level)
- [type](#type)
- [feed-url](#feed-url)
- [feed-release](#feed-release)
- [destination-prefix](#destination-prefix)
- [gvmd-data-destination](#gvmd-data-destination)
- [gvmd-data-url](#gvmd-data-url)
- [notus-destination](#notus-destination)
- [notus-url](#notus-url)
- [nasl-destination](#nasl-destination)
- [nasl-url](#nasl-url)
- [scap-data-destination](#scap-data-destination)
- [scap-data-url](#scap-data-url)
- [cert-data-destination](#cert-data-destination)
- [cert-data-url](#cert-data-url)
- [report-formats-destination](#report-formats-destination)
- [report-formats-url](#report-formats-url)
- [scan-configs-destination](#scan-configs-destination)
- [scan-configs-url](#scan-configs-url)
- [port-lists-destination](#port-lists-destination)
- [port-lists-url](#port-lists-url)
- [gvmd-lock-file](#gvmd-lock-file)
- [openvas-lock-file](#openvas-lock-file)
- [fail-fast](#fail-fast)
- [no-wait](#no-wait)
- [wait-interval](#wait-interval)
- [rsync-timeout](#rsync-timeout)
- [group](#group)
- [user](#user)
- [greenbone-enterprise-feed-key](#greenbone-enterprise-feed-key)
- [Config](#config-1)
- [Development](#development)
- [Maintainer](#maintainer)
- [Contributing](#contributing)
- [License](#license)
## Installation
### Version
`greenbone-feed-sync` uses [semantic versioning](https://semver.org/).
Versions prior to 25.0.0 used [calendar versioning](https://calver.org/).
> [!IMPORTANT] `greenbone-feed-sync` >= 25.0.0 requires [gvmd 25.0.0](https://github.com/greenbone/gvmd/releases/tag/v25.0.0)
> to work out of the box. If a version of gvmd < 24.0.0 is used, the feed release
> has to be set to 22.04 via the [config file, the `GREENBONE_FEED_SYNC_FEED_RELEASE`
> environment variable or the `--feed-release` CLI argument](#feed-release).
> For example run `greenbone-feed-sync --feed-release 22.04`.
> Alternatively you can downgrade `greenbone-feed-sync` to a release version < 25.0.0.
>
> Versions of gvmd between 24.0.0 and 25.0.0 have issues with the feed loading
> and require manual interventions.
### Requirements
Python 3.9 and later is supported.
`greenbone-feed-sync` requires the `rsync` tool being installed and available
within the `PATH`.
On Debian based Distributions like Ubuntu and Kali `rsync` can be installed via
```sh
sudo apt install rsync
```
### Install using pipx
You can install the latest release of **greenbone-feed-sync** from the Python
Package Index (pypi) using [pipx]
```sh
python3 -m pipx install greenbone-feed-sync
```
On Debian based Distributions like Ubuntu and Kali `pipx` itself can be
installed via
```sh
sudo apt install pipx
```
### Install using pip
**NOTE:** The `pip install` command does no longer work out-of-the-box in newer
distributions like Ubuntu 23.04 or Debian 12 because of [PEP 668](https://peps.python.org/pep-0668).
Please use the [installation via pipx](#install-using-pipx) instead.
You can install the latest release of **greenbone-feed-sync** from the
Python Package Index ([pypi]) using [pip]
```sh
python3 -m pip install greenbone-feed-sync
```
## Usage
Most of the time you should just run the script without any arguments to
download the new data for all necessary feed types
**NOTE:** See details about [usage on Kali Linux](#usage-on-kali-linux)
```sh
sudo greenbone-feed-sync
```
To get verbose progress output during the data download you might increase the
verbosity
```sh
sudo greenbone-feed-sync -vvv
```
If the script is run in a cron job the output can be turned off via
```sh
sudo greenbone-feed-sync --quiet
```
To download only a specific feed content the `--type` argument can be used
```sh
sudo greenbone-feed-sync --type nvt
```
Run `--help` to get information about all possible types and additional argument
options
```sh
greenbone-feed-sync --help
```
## Usage on Kali Linux
When running `greenbone-feed-sync` as root user, for example via sudo, the
actual user and group of the process are changed to the `gvm` user and group via
[seteuid](https://docs.python.org/3/library/os.html#os.seteuid). This is done to
ensure that [`gvmd`](https://github.com/greenbone/gvmd) and
[`openvas-scanner`](https://github.com/greenbone/openvas-scanner) can read the
downloaded file contents.
When using the Greenbone Community Edition installed via packages on Kali Linux
a different user and group are used. They are both named `_gvm` instead.
Therefore the [group](#group) and [user](#user) settings need to be adjusted.
This can be done by using a [config file](#config-1).
```sh
sudo mkdir /etc/gvm
sudo chmod +r /etc/gvm
cat <> ~/.bashrc
greenbone-feed-sync --print-completion bash > ~/.greenbone-feed-sync-complete.bash
```
Alternatively, you can use the result of the completion command directly with
the eval function of your bash shell:
```bash
eval "$(greenbone-feed-sync --print-completion bash)"
```
Setup for zsh:
```zsh
echo 'fpath=("$HOME/.zsh.d" $fpath)' >> ~/.zsh
mkdir -p ~/.zsh.d/
greenbone-feed-sync --print-completion zsh > ~/.zsh.d/_greenbone_feed_sync
```
## Settings
The `greenbone-feed-sync` script is adjustable for all kind of purposes and very
flexible which content gets downloaded. Most likely you will never need to
adjust the settings because the defaults will suffice. Changing the settings
is only required for experts and testing purposes.
### verbose
| Name | Value |
| -------------------- | -------------------------------------------- |
| CLI Argument | `--verbose, -v` |
| Config Variable | verbose |
| Environment Variable | `GREENBONE_FEED_SYNC_VERBOSE` |
| Default Value | 2 |
| Description | Log verbosity. `-vvv` for maximum verbosity. |
### quiet
| Name | Value |
| -------------------- | --------------------------------------------------------------------------------------- |
| CLI Argument | `--quiet` |
| Config Variable | |
| Environment Variable | |
| Default Value | |
| Description | Disable all log output. Same as setting `verbose` or `GREENBONE_FEED_SYNC_VERBOSE` to 0 |
### config
| Name | Value |
| -------------------- | ---------------------------------------------------------------------------- |
| CLI Argument | `--config, -c` |
| Config Variable | |
| Environment Variable | |
| Default Value | `~/.config/greenbone-feed-sync.toml` and `/etc/gvm/greenbone-feed-sync.toml` |
| Description | TOML config file to load settings from. |
### private-directory
| Name | Value |
| -------------------- | ------------------------------------------------------------------------------------ |
| CLI Argument | `--private-directory` |
| Config Variable | private-directory |
| Environment Variable | `GREENBONE_FEED_SYNC_PRIVATE_DIRECTORY` |
| Default Value | |
| Description | (Sub-)Directory to exclude from the sync which will never get deleted automatically. |
### compression-level
| Name | Value |
| -------------------- | ----------------------------------------------------------------------- |
| CLI Argument | `--compression-level` |
| Config Variable | compression-level |
| Environment Variable | `GREENBONE_FEED_SYNC_COMPRESSION_LEVEL` |
| Default Value | 9 |
| Description | rsync compression level 0-9. (0 - no compression, 9 - high compression) |
### type
| Name | Value |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| CLI Argument | `--type` |
| Config Variable | |
| Environment Variable | |
| Default Value | all |
| Description | Specifies which feed data should be downloaded. Possible values are `all`, `nvt`/`nvts`, `gvmd-data`, `scap`, `cert`, `notus`, `nasl`, `report-format`/`report-formats`, `scan-config`/`scan-configs` or `port-list`/`port-lists`. |
### feed-url
| Name | Value |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| CLI Argument | |
| Config Variable | feed-url |
| Environment Variable | `GREENBONE_FEED_SYNC_URL` |
| Default Value | `rsync://feed.community.greenbone.net/community` |
| Description | URL to download the feed data from. Other URLs will be relative to this URL by default. For example using `rsync://example.com` as feed url the notus url will be `rsync://example.com/vulnerability-feed/$FEED_VERSION/vt-data/notus/`. |
### feed-release
| Name | |
| -------------------- | --------------------------------------------------------------------------------------------------- |
| CLI Argument | `--feed-release` |
| Config Variable | feed-release |
| Environment Variable | `GREENBONE_FEED_SYNC_FEED_RELEASE` |
| Default Value | `24.10` |
| Description | Release series of the feed to be downloaded. Download destinations and URLs will use this variable. |
### destination-prefix
| Name | Value |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| CLI Argument | `--destination-prefix` |
| Config Variable | destination-prefix |
| Environment Variable | `GREENBONE_FEED_SYNC_DESTINATION_PREFIX` |
| Default Value | `/var/lib/` |
| Description | Directory prefix to use for default feed data download destinations. Other download destinations will be relative to this path by default. For example using `/opt/lib` as destination prefix will change the default of the notus destination to `/opt/lib/notus`. |
### gvmd-data-destination
| Name | Value |
| -------------------- | ---------------------------------------------------------- |
| CLI Argument | `--gvmd-data-destination` |
| Config Variable | gvmd-data-destination |
| Environment Variable | `GREENBONE_FEED_SYNC_GVMD_DATA_DESTINATION` |
| Default Value | `$DESTINATION_PREFIX/gvm/data-objects/gvmd/$FEED_VERSION/` |
| Description | Destination of the downloaded gvmd data. |
### gvmd-data-url
| Name | Value |
| -------------------- | ---------------------------------------------------------------------------------------------- |
| CLI Argument | `--gvmd-data-url` |
| Config Variable | gvmd-data-url |
| Environment Variable | `GREENBONE_FEED_SYNC_GVMD_DATA_URL` |
| Default Value | `$FEED_URL/data-feed/$FEED_VERSION/` |
| Description | URL to download the gvmd data from. This includes scan-configs, report-formats and port-lists. |
### notus-destination
| Name | Value |
| -------------------- | ----------------------------------------- |
| CLI Argument | `--notus-destination` |
| Config Variable | notus-destination |
| Environment Variable | `GREENBONE_FEED_SYNC_NOTUS_DESTINATION` |
| Default Value | `$DESTINATION_PREFIX/notus` |
| Description | Destination of the downloaded notus data. |
### notus-url
| Name | Value |
| -------------------- | ----------------------------------------------------------- |
| CLI Argument | `--notus-url` |
| Config Variable | notus-url |
| Environment Variable | `GREENBONE_FEED_SYNC_NOTUS_URL` |
| Default Value | `$FEED_URL/vulnerability-feed/$FEED_VERSION/vt-data/notus/` |
| Description | URL to download the notus data from. |
### nasl-destination
| Name | Value |
| -------------------- | ---------------------------------------- |
| CLI Argument | `--nasl-destination` |
| Config Variable | nasl-destination |
| Environment Variable | `GREENBONE_FEED_SYNC_NASL_DESTINATION` |
| Default Value | `$DESTINATION_PREFIX/openvas/plugins` |
| Description | Destination of the downloaded nasl data. |
### nasl-url
| Name | Value |
| -------------------- | ---------------------------------------------------------- |
| CLI Argument | `--nasl-url` |
| Config Variable | nasl-url |
| Environment Variable | `GREENBONE_FEED_SYNC_NASL_URL` |
| Default Value | `$FEED_URL/vulnerability-feed/$FEED_VERSION/vt-data/nasl/` |
| Description | URL to download the nasl data from. |
### scap-data-destination
| Name | Value |
| -------------------- | ------------------------------------------- |
| CLI Argument | `--scap-data-destination` |
| Config Variable | scap-data-destination |
| Environment Variable | `GREENBONE_FEED_SYNC_SCAP_DATA_DESTINATION` |
| Default Value | `$DESTINATION_PREFIX/gvm/scap-data` |
| Description | Destination of the downloaded SCAP data. |
### scap-data-url
| Name | Value |
| -------------------- | ------------------------------------------------------ |
| CLI Argument | `--scap-data-url` |
| Config Variable | scap-data-url |
| Environment Variable | `GREENBONE_FEED_SYNC_SCAP_DATA_URL` |
| Default Value | `$FEED_URL/vulnerability-feed/$FEED_VERSION/scap-data` |
| Description | URL to download the SCAP data from. |
### cert-data-destination
| Name | Value |
| -------------------- | ------------------------------------------- |
| CLI Argument | `--cert-data-destination` |
| Config Variable | cert-data-destination |
| Environment Variable | `GREENBONE_FEED_SYNC_CERT_DATA_DESTINATION` |
| Default Value | `$DESTINATION_PREFIX/gvm/cert-data` |
| Description | Destination of the downloaded CERT data. |
### cert-data-url
| Name | Value |
| -------------------- | ------------------------------------------------------ |
| CLI Argument | `--cert-data-url` |
| Config Variable | cert-data-url |
| Environment Variable | `GREENBONE_FEED_SYNC_CERT_DATA_URL` |
| Default Value | `$FEED_URL/vulnerability-feed/$FEED_VERSION/cert-data` |
| Description | URL to download the CERT data from. |
### report-formats-destination
| Name | Value |
| -------------------- | ------------------------------------------------------------------------ |
| CLI Argument | `--report-formats-destination` |
| Config Variable | report-formats-destination |
| Environment Variable | `GREENBONE_FEED_SYNC_REPORT_FORMATS_DESTINATION` |
| Default Value | `$DESTINATION_PREFIX/gvm/data-objects/gvmd/$FEED_VERSION/report-formats` |
| Description | Destination of the downloaded report format data. |
### report-formats-url
| Name | Value |
| -------------------- | -------------------------------------------------- |
| CLI Argument | `--report-formats-url` |
| Config Variable | report-formats-url |
| Environment Variable | `GREENBONE_FEED_SYNC_REPORT_FORMATS_URL` |
| Default Value | `$FEED_URL/data-feed/$FEED_VERSION/report-formats` |
| Description | URL to download the report format data from. |
### scan-configs-destination
| Name | Value |
| -------------------- | ---------------------------------------------------------------------- |
| CLI Argument | `--scan-configs-destination` |
| Config Variable | scan-configs-destination |
| Environment Variable | `GREENBONE_FEED_SYNC_SCAN_CONFIGS_DESTINATION` |
| Default Value | `$DESTINATION_PREFIX/gvm/data-objects/gvmd/$FEED_VERSION/scan-configs` |
| Description | Destination of the downloaded scan config data. |
### scan-configs-url
| Name | Value |
| -------------------- | ------------------------------------------------ |
| CLI Argument | `--scan-configs-url` |
| Config Variable | scan-configs-url |
| Environment Variable | `GREENBONE_FEED_SYNC_SCAN_CONFIGS_URL` |
| Default Value | `$FEED_URL/data-feed/$FEED_VERSION/scan-configs` |
| Description | URL to download the scan config data from. |
### port-lists-destination
| Name | Value |
| -------------------- | -------------------------------------------------------------------- |
| CLI Argument | `--port-lists-destination` |
| Config Variable | port-lists-destination |
| Environment Variable | `GREENBONE_FEED_SYNC_PORT_LISTS_DESTINATION` |
| Default Value | `$DESTINATION_PREFIX/gvm/data-objects/gvmd/$FEED_VERSION/port-lists` |
| Description | Destination of the downloaded port list data. |
### port-lists-url
| Name | Value |
| -------------------- | ---------------------------------------------- |
| CLI Argument | `--port-lists-url` |
| Config Variable | port-lists-url |
| Environment Variable | `GREENBONE_FEED_SYNC_PORT_LISTS_URL` |
| Default Value | `$FEED_URL/data-feed/$FEED_VERSION/port-lists` |
| Description | URL to download the port list data from. |
### gvmd-lock-file
| Name | Value |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| CLI Argument | `--gvmd-lock-file` |
| Config Variable | gvmd-lock-file |
| Environment Variable | `GREENBONE_FEED_SYNC_GVMD_LOCK_FILE` |
| Default Value | `$DESTINATION_PREFIX/gvm/feed-update.lock` |
| Description | File to use for locking the feed synchronization for data loaded by the gvmd daemon. Used to avoid that more then one process accesses the feed data at the same time. |
### openvas-lock-file
| Name | Value |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| CLI Argument | `--openvas-lock-file` |
| Config Variable | openvas-lock-file |
| Environment Variable | `GREENBONE_FEED_SYNC_OPENVAS_LOCK_FILE` |
| Default Value | `$DESTINATION_PREFIX/openvas/feed-update.lock` |
| Description | File to use for locking the feed synchronization for data loaded by the openvas scanner. Used to avoid that more then one process accesses the feed data at the same time. |
### fail-fast
| Name | Value |
| -------------------- | ----------------------------------------------------------------------------------------------------------- |
| CLI Argument | `--fail-fast, --failfast` |
| Config Variable | fail-fast |
| Environment Variable | `GREENBONE_FEED_SYNC_FAIL_FAST` |
| Default Value | false |
| Description | Stop after a first error has occurred. Otherwise the script tries to download additional data if specified. |
### no-wait
| Name | Value |
| -------------------- | ------------------------------------------------- |
| CLI Argument | `--no-wait` |
| Config Variable | no-wait |
| Environment Variable | `GREENBONE_FEED_SYNC_NO_WAIT` |
| Default Value | false |
| Description | Fail directly if the lock file can't be acquired. |
### wait-interval
| Name | Value |
| -------------------- | ------------------------------------------------------------------------------------ |
| CLI Argument | `--wait-interval` |
| Config Variable | wait-interval |
| Environment Variable | `GREENBONE_FEED_SYNC_LOCK_WAIT_INTERVAL` |
| Default Value | 5 |
| Description | Time to wait in seconds after failed lock attempt before re-trying to lock the file. |
### rsync-timeout
| Name | Value |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| CLI Argument | `--rsync-timeout` |
| Config Variable | rsync-timeout |
| Environment Variable | `GREENBONE_FEED_SYNC_RSYNC_TIMEOUT` |
| Default Value | |
| Description | Maximum I/O timeout in seconds used for rsync. If no data is transferred for the specified time then rsync will exit. By default no timeout is set and the rsync default will be used. |
### group
| Name | Value |
| -------------------- | ---------------------------------------------------------------------------------------------------------- |
| CLI Argument | `--group` |
| Config Variable | group |
| Environment Variable | `GREENBONE_FEED_SYNC_GROUP` |
| Default Value | gvm |
| Description | If the greenbone-feed-sync script is run as root, the effective group is changed to this group name or ID. |
### user
| Name | Value |
| -------------------- | -------------------------------------------------------------------------------------------------------- |
| CLI Argument | `--user` |
| Config Variable | user |
| Environment Variable | `GREENBONE_FEED_SYNC_USER` |
| Default Value | gvm |
| Description | If the greenbone-feed-sync script is run as root, the effective user is changed to this user name or ID. |
### greenbone-enterprise-feed-key
| Name | Value |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| CLI Argument | `--greenbone-enterprise-feed-key` |
| Config Variable | greenbone-enterprise-feed-key |
| Environment Variable | `GREENBONE_FEED_SYNC_ENTERPRISE_FEED_KEY` |
| Default Value | /etc/gvm/greenbone-enterprise-feed-key |
| Description | File to read the Greenbone Enterprise Feed key from. The key gives access to additional vulnerability tests for enterprise software among other advantages. See [Greenbone Enterprise Feed and Greenbone Community Feed in Comparison](https://www.greenbone.net/en/feed-comparison/) for more details. The default URLs are adjusted according to the data in the key. If the key file does not exist it is ignored. |
## Config
It is possible to use a config file for loading the settings of the
`greenbone-feed-sync` script. The config file uses the [TOML] format. Without
explicitly passing a config file, `greenbone-feed-sync` tries to load
`~/.config/greenbone-feed-sync.toml` and if that file doesn't exist afterwards
`/etc/gvm/greenbone-feed-sync.toml`.
Example:
```toml
[greenbone-feed-sync]
destination-prefix = "/opt/greenbone-feed"
lock-file = "/opt/greenbone-feed.lock"
no-wait = true
```
## Development
**greenbone-feed-sync** uses [poetry] for its own dependency management and
build process.
First install poetry via pipx
```sh
python3 -m pipx install poetry
```
Afterwards run
```sh
poetry install
```
in the checkout directory of **greenbone-feed-sync** (the directory containing
the `pyproject.toml` file) to install all dependencies including the packages
only required for development.
Afterwards activate the git hooks for auto-formatting and linting via
[autohooks].
```sh
poetry run autohooks activate
```
Validate the activated git hooks by running
```sh
poetry run autohooks check
```
## Maintainer
This project is maintained by [Greenbone AG][Greenbone Networks]
## Contributing
Your contributions are highly appreciated. Please
[create a pull request](https://github.com/greenbone/greeenbon-feed-sync/pulls)
on GitHub. Bigger changes need to be discussed with the development team via the
[issues section at GitHub](https://github.com/greenbone/greenbone-feed-sync/issues)
first.
## License
Copyright (C) 2022-2025 [Greenbone AG][Greenbone Networks]
Licensed under the [GNU General Public License v3.0 or later](LICENSE).
[Greenbone Networks]: https://www.greenbone.net/
[poetry]: https://python-poetry.org/
[pip]: https://pip.pypa.io/
[pipx]: https://pypa.github.io/pipx/
[autohooks]: https://github.com/greenbone/autohooks
[TOML]: https://toml.io/
[pypi]: https://pypi.org
greenbone-feed-sync-25.1.0/greenbone/ 0000775 0000000 0000000 00000000000 14752631415 0017372 5 ustar 00root root 0000000 0000000 greenbone-feed-sync-25.1.0/greenbone/feed/ 0000775 0000000 0000000 00000000000 14752631415 0020275 5 ustar 00root root 0000000 0000000 greenbone-feed-sync-25.1.0/greenbone/feed/sync/ 0000775 0000000 0000000 00000000000 14752631415 0021251 5 ustar 00root root 0000000 0000000 greenbone-feed-sync-25.1.0/greenbone/feed/sync/__init__.py 0000664 0000000 0000000 00000000141 14752631415 0023356 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2022-2024 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
greenbone-feed-sync-25.1.0/greenbone/feed/sync/__version__.py 0000664 0000000 0000000 00000000147 14752631415 0024106 0 ustar 00root root 0000000 0000000 # pylint: disable=invalid-name
# THIS IS AN AUTOGENERATED FILE. DO NOT TOUCH!
__version__ = "25.1.0"
greenbone-feed-sync-25.1.0/greenbone/feed/sync/config.py 0000664 0000000 0000000 00000025773 14752631415 0023106 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2023-2024 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
import os
from dataclasses import dataclass
from pathlib import Path
from typing import (
Any,
Callable,
Generic,
Iterable,
Optional,
Protocol,
TypeVar,
Union,
)
from urllib.parse import urlsplit
from greenbone.feed.sync.errors import ConfigError, ConfigFileError
from greenbone.feed.sync.helper import DEFAULT_FLOCK_WAIT_INTERVAL
from greenbone.feed.sync.rsync import (
DEFAULT_RSYNC_COMPRESSION_LEVEL,
DEFAULT_RSYNC_URL,
)
try:
import tomllib
except ImportError:
import tomli as tomllib # type: ignore[no-redef]
def maybe_int(value: Optional[str]) -> Union[int, str, None]:
"""
Convert string into int if possible
"""
try:
value = int(value) # type: ignore[arg-type,assignment]
except ValueError:
pass
return value
DEFAULT_FEED_RELEASE = "24.10"
DEFAULT_DESTINATION_PREFIX = "/var/lib/"
DEFAULT_NASL_PATH = "openvas/plugins"
DEFAULT_NOTUS_PATH = "notus"
DEFAULT_SCAP_DATA_PATH = "gvm/scap-data"
DEFAULT_CERT_DATA_PATH = "gvm/cert-data"
DEFAULT_GVMD_LOCK_FILE_PATH = "gvm/feed-update.lock"
DEFAULT_OPENVAS_LOCK_FILE_PATH = "openvas/feed-update.lock"
DEFAULT_CONFIG_FILE = "/etc/gvm/greenbone-feed-sync.toml"
DEFAULT_USER_CONFIG_FILE = "~/.config/greenbone-feed-sync.toml"
DEFAULT_ENTERPRISE_KEY_PATH = "/etc/gvm/greenbone-enterprise-feed-key"
DEFAULT_GROUP = "gvm"
DEFAULT_USER = "gvm"
DEFAULT_VERBOSITY = 2
T = TypeVar("T")
ValuesDict = dict[str, Any]
DefaultValueCallable = Callable[[ValuesDict], Any]
ValueTypeCallable = Callable[[Any], T]
def resolve_gvmd_data_destination(values: ValuesDict) -> str:
path = "gvm/data-objects/gvmd"
feed_release: str = values.get("feed-release") # type: ignore[assignment]
try:
str_major, str_minor = feed_release.split(".")[:2]
major, minor = int(str_major), int(str_minor)
except ValueError as e:
raise ConfigError(f"Invalid feed release format: {feed_release}") from e
return (
f"{values['destination-prefix']}/{path}"
if major >= 24 and minor >= 10
else f"{values['destination-prefix']}/{path}/{feed_release}"
)
@dataclass
class Setting(Generic[T]):
config_key: str
environment_key: str
default_value: Union[str, int, bool, None]
value_type: ValueTypeCallable[T]
def resolve(self, values: ValuesDict) -> Optional[T]:
value: Any
if self.environment_key in os.environ:
value = os.environ.get(self.environment_key)
elif self.config_key in values:
value = values.get(self.config_key)
else:
value = self.default_value
return None if value is None else self.value_type(value)
@dataclass
class DependentSetting(Generic[T]):
config_key: str
environment_key: str
default_value: DefaultValueCallable
value_type: ValueTypeCallable[T]
def resolve(self, values: ValuesDict) -> Optional[T]:
if self.environment_key in os.environ:
value = os.environ.get(self.environment_key)
elif self.config_key in values:
value = values.get(self.config_key)
else:
value = self.default_value(values)
return None if value is None else self.value_type(value)
@dataclass
class EnterpriseSettings:
user: Optional[str]
host: Optional[str]
key: Path
@classmethod
def from_key(cls, enterprise_key: Path) -> "EnterpriseSettings":
with enterprise_key.open("r", encoding="utf8", errors="ignore") as f:
line = f.readline()
url = urlsplit(line)
if not url.scheme:
# ensure that url gets splitted correctly if line doesn't contain
# an url scheme (which is the default)
url = urlsplit(f"//{line}")
return EnterpriseSettings(url.username, url.hostname, enterprise_key)
def feed_url(self) -> str:
return f"ssh://{self.user}@{self.host}/enterprise"
_SETTINGS = (
Setting(
"destination-prefix",
"GREENBONE_FEED_SYNC_DESTINATION_PREFIX",
DEFAULT_DESTINATION_PREFIX,
Path,
),
Setting("feed-url", "GREENBONE_FEED_SYNC_URL", DEFAULT_RSYNC_URL, str),
Setting(
"wait-interval",
"GREENBONE_FEED_SYNC_LOCK_WAIT_INTERVAL",
DEFAULT_FLOCK_WAIT_INTERVAL,
int,
),
Setting("no-wait", "GREENBONE_FEED_SYNC_NO_WAIT", False, bool),
Setting(
"compression-level",
"GREENBONE_FEED_SYNC_COMPRESSION_LEVEL",
DEFAULT_RSYNC_COMPRESSION_LEVEL,
int,
),
Setting(
"private-directory", "GREENBONE_FEED_SYNC_PRIVATE_DIRECTORY", None, Path
),
Setting("verbose", "GREENBONE_FEED_SYNC_VERBOSE", None, int),
Setting("fail-fast", "GREENBONE_FEED_SYNC_FAIL_FAST", False, bool),
Setting("rsync-timeout", "GREENBONE_FEED_SYNC_RSYNC_TIMEOUT", None, int),
Setting("group", "GREENBONE_FEED_SYNC_GROUP", DEFAULT_GROUP, maybe_int),
Setting("user", "GREENBONE_FEED_SYNC_USER", DEFAULT_USER, maybe_int),
Setting(
"greenbone-enterprise-feed-key",
"GREENBONE_FEED_SYNC_ENTERPRISE_FEED_KEY",
DEFAULT_ENTERPRISE_KEY_PATH,
Path,
),
Setting(
"feed-release",
"GREENBONE_FEED_SYNC_FEED_RELEASE",
DEFAULT_FEED_RELEASE,
str,
),
)
_DEPENDENT_SETTINGS = (
DependentSetting(
"gvmd-data-destination",
"GREENBONE_FEED_SYNC_GVMD_DATA_DESTINATION",
resolve_gvmd_data_destination,
Path,
),
DependentSetting(
"gvmd-data-url",
"GREENBONE_FEED_SYNC_GVMD_DATA_URL",
lambda values: f"{values['feed-url']}/data-feed/{values['feed-release']}/",
str,
),
DependentSetting(
"notus-destination",
"GREENBONE_FEED_SYNC_NOTUS_DESTINATION",
lambda values: f"{values['destination-prefix']}/{DEFAULT_NOTUS_PATH}",
Path,
),
DependentSetting(
"notus-url",
"GREENBONE_FEED_SYNC_NOTUS_URL",
lambda values: f"{values['feed-url']}/vulnerability-feed/{values['feed-release']}/vt-data/notus/",
str,
),
DependentSetting(
"nasl-destination",
"GREENBONE_FEED_SYNC_NASL_DESTINATION",
lambda values: f"{values['destination-prefix']}/{DEFAULT_NASL_PATH}",
Path,
),
DependentSetting(
"nasl-url",
"GREENBONE_FEED_SYNC_NASL_URL",
lambda values: f"{values['feed-url']}/vulnerability-feed/{values['feed-release']}/vt-data/nasl/",
str,
),
DependentSetting(
"scap-data-destination",
"GREENBONE_FEED_SYNC_SCAP_DATA_DESTINATION",
lambda values: f"{values['destination-prefix']}/{DEFAULT_SCAP_DATA_PATH}", # noqa: E501
Path,
),
DependentSetting(
"scap-data-url",
"GREENBONE_FEED_SYNC_SCAP_DATA_URL",
lambda values: f"{values['feed-url']}/vulnerability-feed/{values['feed-release']}/scap-data/",
str,
),
DependentSetting(
"cert-data-destination",
"GREENBONE_FEED_SYNC_CERT_DATA_DESTINATION",
lambda values: f"{values['destination-prefix']}/{DEFAULT_CERT_DATA_PATH}", # noqa: E501
Path,
),
DependentSetting(
"cert-data-url",
"GREENBONE_FEED_SYNC_CERT_DATA_URL",
lambda values: f"{values['feed-url']}/vulnerability-feed/{values['feed-release']}/cert-data/",
str,
),
DependentSetting(
"report-formats-destination",
"GREENBONE_FEED_SYNC_REPORT_FORMATS_DESTINATION",
lambda values: f"{values['gvmd-data-destination']}/report-formats",
Path,
),
DependentSetting(
"report-formats-url",
"GREENBONE_FEED_SYNC_REPORT_FORMATS_URL",
lambda values: f"{values['feed-url']}/data-feed/{values['feed-release']}/report-formats/", # noqa: E501
str,
),
DependentSetting(
"scan-configs-destination",
"GREENBONE_FEED_SYNC_SCAN_CONFIGS_DESTINATION",
lambda values: f"{values['gvmd-data-destination']}/scan-configs",
Path,
),
DependentSetting(
"scan-configs-url",
"GREENBONE_FEED_SYNC_SCAN_CONFIGS_URL",
lambda values: f"{values['feed-url']}/data-feed/{values['feed-release']}/scan-configs/", # noqa: E501
str,
),
DependentSetting(
"port-lists-destination",
"GREENBONE_FEED_SYNC_PORT_LISTS_DESTINATION",
lambda values: f"{values['gvmd-data-destination']}/port-lists",
Path,
),
DependentSetting(
"port-lists-url",
"GREENBONE_FEED_SYNC_PORT_LISTS_URL",
lambda values: f"{values['feed-url']}/data-feed/{values['feed-release']}/port-lists/", # noqa: E501
str,
),
DependentSetting(
"gvmd-lock-file",
"GREENBONE_FEED_SYNC_GVMD_LOCK_FILE",
lambda values: f"{values['destination-prefix']}/{DEFAULT_GVMD_LOCK_FILE_PATH}", # noqa: E501
Path,
),
DependentSetting(
"openvas-lock-file",
"GREENBONE_FEED_SYNC_OPENVAS_LOCK_FILE",
lambda values: f"{values['destination-prefix']}/{DEFAULT_OPENVAS_LOCK_FILE_PATH}", # noqa: E501
Path,
),
)
class ConfigDict(Protocol):
def items(self) -> Iterable[tuple[str, Any]]: ...
def __getitem__(self, key: str) -> Any: ...
class Config:
"""
A class to load configuration values from the environment, config file and
defaults.
"""
def __init__(self) -> None:
self._config: ValuesDict = {}
def load_from_config_file(self, config_file: Path) -> None:
try:
content = config_file.read_text(encoding="utf-8")
config_data = tomllib.loads(content)
self._config = config_data.get("greenbone-feed-sync", {})
except IOError as e:
raise ConfigFileError(
f"Can't load config file {config_file.absolute()}. "
f"Error was {e}."
) from e
except tomllib.TOMLDecodeError as e:
raise ConfigFileError(
f"Can't load config file. {config_file.absolute()} is not "
"a valid TOML file."
) from e
def apply_settings(self) -> None:
for setting in _SETTINGS:
self._config[setting.config_key] = setting.resolve(self._config)
def apply_dependent_settings(self) -> None:
for setting in _DEPENDENT_SETTINGS:
self._config[setting.config_key] = setting.resolve(self._config)
@classmethod
def load(cls, config_file: Optional[Path] = None) -> "Config":
"""
Load config values from config_file and apply all settings
"""
config = cls()
if config_file:
config.load_from_config_file(config_file)
config.apply_settings()
config.apply_dependent_settings()
return config
def items(self) -> Iterable[tuple[str, Any]]:
return self._config.items()
def __getitem__(self, key: str) -> Any:
return self._config[key]
def __setitem__(self, key: str, value: Any) -> None:
self._config[key] = value
def __len__(self) -> int:
return len(self._config)
greenbone-feed-sync-25.1.0/greenbone/feed/sync/errors.py 0000664 0000000 0000000 00000004147 14752631415 0023145 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2024 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
from typing import Iterable, Optional
class GreenboneFeedSyncError(Exception):
"""
Base exception class
"""
class ConfigError(GreenboneFeedSyncError):
"""
Error while processing a config
"""
class ConfigFileError(ConfigError):
"""
Error while processing a config file
"""
class ExecProcessError(GreenboneFeedSyncError):
"""
Error while executing a process
"""
def __init__(
self,
returncode: int,
cmd: Iterable[str],
*,
stdout: Optional[bytes] = None,
stderr: Optional[bytes] = None,
) -> None:
self.returncode = returncode
self.cmd = cmd
self.stout = (
None if not stdout else stdout.decode("utf8", errors="ignore")
)
self.stderr = (
None if not stderr else stderr.decode("utf8", errors="ignore")
)
def __str__(self):
cmd = " ".join(self.cmd)
return f"'{cmd}' returned non-zero exit status {self.returncode}."
class RsyncError(ExecProcessError):
"""
Error while running rsync
"""
def __init__(
self,
returncode: int,
args: Iterable[str],
stderr: Optional[bytes] = None,
) -> None:
super().__init__(returncode, cmd=["rsync"] + list(args), stderr=stderr)
class FileLockingError(GreenboneFeedSyncError):
"""
An error during locking a file
"""
greenbone-feed-sync-25.1.0/greenbone/feed/sync/helper.py 0000664 0000000 0000000 00000012135 14752631415 0023104 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2022-2024 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
import asyncio
import errno
import fcntl
import os
import shutil
from contextlib import asynccontextmanager
from pathlib import Path
from types import TracebackType
from typing import AsyncGenerator, Optional, Type, Union
from rich.console import Console
from rich.live import Live
from rich.spinner import Spinner as RichSpinner
from greenbone.feed.sync.errors import FileLockingError, GreenboneFeedSyncError
DEFAULT_FLOCK_WAIT_INTERVAL = 5 # in seconds
def is_root() -> bool:
"""
Checks if the current user is root
"""
return os.geteuid() == 0
@asynccontextmanager
async def flock_wait(
path: Union[str, Path],
*,
console: Optional[Console] = None,
wait_interval: Optional[Union[int, float]] = DEFAULT_FLOCK_WAIT_INTERVAL,
) -> AsyncGenerator[None, None]:
"""
Try to lock a file and wait if it is already locked
Arguments:
path: File to lock
console: A console to print messages to or None to keep the function
quiet.
wait_interval: Time to wait in seconds after failed lock attempt before
re-trying to lock the file. Set to None to raise a FileLockingError
instead of re-trying to acquire the lock. Default is 5 seconds.
"""
# ensure path is a Path
path = Path(path)
# ensure parent directories exist
try:
path.parent.mkdir(parents=True, exist_ok=True, mode=0o770)
except OSError as e:
raise FileLockingError(
f"Could not create parent directories for {path}"
) from e
try:
with path.open("w", encoding="utf8") as fd0:
has_lock = False
while not has_lock:
try:
if console:
console.print(
f"Trying to acquire lock on {path.absolute()}"
)
fcntl.flock(fd0, fcntl.LOCK_EX | fcntl.LOCK_NB)
if console:
console.print(f"Acquired lock on {path.absolute()}")
has_lock = True
path.chmod(mode=0o660)
except OSError as e:
if e.errno in (errno.EAGAIN, errno.EACCES):
if wait_interval is None:
raise FileLockingError(
f"{path.absolute()} is locked. Another process "
"related to the feed update may already running."
) from None
if console:
console.print(
f"{path.absolute()} is locked by another process. "
f"Waiting {wait_interval} seconds before next try."
)
await asyncio.sleep(wait_interval)
else:
raise
try:
yield
finally:
try:
# free the lock
if console:
console.print(f"Releasing lock on {path.absolute()}")
fcntl.flock(fd0, fcntl.LOCK_UN)
except OSError:
pass
except PermissionError as e:
raise FileLockingError(
"Permission error while trying to open the lock file "
f"{path.absolute()}"
) from e
class Spinner:
def __init__(self, console: Console, status: str) -> None:
self._spinner = RichSpinner(
"dots", text=status, style="status.spinner", speed=1.0
)
self._live = Live(
self._spinner,
console=console,
refresh_per_second=12.5,
transient=False,
)
def __enter__(self) -> "Spinner":
self._live.start()
return self
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Optional[BaseException],
exc_tb: Optional[TracebackType],
) -> None:
self._live.stop()
def change_user_and_group(
user: Union[str, int], group: Union[str, int]
) -> None:
"""
Change effective user or group of the current running process
Args:
user: User name or ID
group: Group name or ID
"""
if isinstance(user, str):
user_id = shutil._get_uid( # type: ignore[attr-defined] # pylint: disable=protected-access # noqa: E501
user
)
if user_id is None:
raise GreenboneFeedSyncError(
f"Can't run as user '{user}'. User '{user}' is unknown."
)
user = user_id
if isinstance(group, str):
group_id = shutil._get_gid(group) # type: ignore[attr-defined] # pylint: disable=protected-access # noqa: E501
if group_id is None:
raise GreenboneFeedSyncError(
f"Can't run as group '{group}'. Group '{group}' is unknown."
)
group = group_id
os.setegid(group) # type: ignore[arg-type]
os.seteuid(user) # type: ignore[arg-type]
greenbone-feed-sync-25.1.0/greenbone/feed/sync/main.py 0000664 0000000 0000000 00000013725 14752631415 0022557 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2022-2024 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
import asyncio
import subprocess
import sys
from dataclasses import dataclass
from typing import Iterable, NoReturn
from rich.console import Console
from greenbone.feed.sync.config import DEFAULT_VERBOSITY
from greenbone.feed.sync.errors import GreenboneFeedSyncError, RsyncError
from greenbone.feed.sync.helper import (
Spinner,
change_user_and_group,
flock_wait,
is_root,
)
from greenbone.feed.sync.parser import CliParser
from greenbone.feed.sync.rsync import Rsync
__all__ = ("main",)
@dataclass
class Sync:
"""
Class to store sync information
"""
name: str
types: Iterable[str]
url: str
destination: str
@dataclass
class SyncList:
"""
Class to store a list of sync information
"""
lock_file: str
syncs: Iterable[Sync]
def filter_syncs(lock_file: str, feed_type: str, *syncs: Sync) -> SyncList:
"""
Create a list of syncs which only match to the feed type
"""
return SyncList(
lock_file=lock_file,
syncs=[sync for sync in syncs if feed_type in sync.types],
)
def do_selftest() -> None:
"""
Check for rsync command.
"""
try:
subprocess.run(
["rsync", "--help"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
check=True,
)
except (PermissionError, FileNotFoundError, subprocess.CalledProcessError):
raise GreenboneFeedSyncError(
"The rsync binary could not be found."
) from None
async def feed_sync(console: Console, error_console: Console) -> int:
"""
Sync the feeds
"""
parser = CliParser()
args = parser.parse_arguments()
do_selftest()
if args.selftest:
return 0
if args.quiet:
verbose = 0
else:
verbose = DEFAULT_VERBOSITY if args.verbose is None else args.verbose
if is_root():
if verbose >= 1:
console.print(
f"Running as root. Switching to user '{args.user}' and "
f"group '{args.group}'."
)
change_user_and_group(args.user, args.group)
rsync = Rsync(
private_subdir=args.private_directory,
verbose=verbose >= 3,
compression_level=args.compression_level,
ssh_key=args.greenbone_enterprise_feed_key,
)
openvas_syncs = filter_syncs(
args.openvas_lock_file,
args.type,
Sync(
name="Notus files",
types=("notus", "nvt", "all"),
url=args.notus_url,
destination=args.notus_destination,
),
Sync(
name="NASL files",
types=("nasl", "nvt", "all"),
url=args.nasl_url,
destination=args.nasl_destination,
),
)
gvmd_syncs = filter_syncs(
args.gvmd_lock_file,
args.type,
Sync(
name="SCAP data",
types=("scap", "all"),
url=args.scap_data_url,
destination=args.scap_data_destination,
),
Sync(
name="CERT-Bund data",
types=("cert", "all"),
url=args.cert_data_url,
destination=args.cert_data_destination,
),
Sync(
name="gvmd data",
types=("gvmd-data", "all"),
url=args.gvmd_data_url,
destination=args.gvmd_data_destination,
),
Sync(
name="report formats",
types=("report-format"),
url=args.report_formats_url,
destination=args.report_formats_destination,
),
Sync(
name="scan configs",
types=("scan-config"),
url=args.scan_configs_url,
destination=args.scan_configs_destination,
),
Sync(
name="port lists",
types=("port-list"),
url=args.port_lists_url,
destination=args.port_lists_destination,
),
)
has_error = False
wait_interval = None if args.no_wait else args.wait_interval
for sync_list in (openvas_syncs, gvmd_syncs):
if not sync_list.syncs:
continue
async with flock_wait(
sync_list.lock_file,
console=console if verbose else None,
wait_interval=wait_interval,
):
for sync in sync_list.syncs:
try:
rsync_coro = rsync.sync(
url=sync.url, destination=sync.destination
)
if verbose >= 3:
console.print(
f"Downloading {sync.name} from {sync.url} to "
f"{sync.destination}"
)
await rsync_coro
# add newline after rsync
console.print()
elif verbose >= 1:
with Spinner(
console,
f"Downloading {sync.name} from {sync.url} to "
f"{sync.destination}",
):
await rsync_coro
else:
await rsync_coro
except RsyncError as e:
has_error = True
error_console.print(e.stderr)
if args.fail_fast:
return 1
if verbose >= 2:
# add newline for grouping lock
console.print()
return 1 if has_error else 0
def main() -> NoReturn:
"""
Main CLI function
"""
console = Console()
error_console = Console(stderr=True)
try:
sys.exit(asyncio.run(feed_sync(console, error_console)))
except GreenboneFeedSyncError as e:
error_console.print(f"[red]❌[/red]Error: {e}")
sys.exit(1)
except KeyboardInterrupt:
sys.exit(1)
if __name__ == "__main__":
main()
greenbone-feed-sync-25.1.0/greenbone/feed/sync/parser.py 0000664 0000000 0000000 00000031674 14752631415 0023132 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2023-2024 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
from argparse import ArgumentParser, Namespace
from pathlib import Path
from typing import Any, Optional, Sequence
import shtab
from greenbone.feed.sync.__version__ import __version__
from greenbone.feed.sync.config import (
DEFAULT_CONFIG_FILE,
DEFAULT_USER_CONFIG_FILE,
Config,
ConfigDict,
EnterpriseSettings,
maybe_int,
)
from greenbone.feed.sync.errors import ConfigFileError
def _to_defaults(values: ConfigDict) -> dict[str, Any]:
defaults = {}
for key, value in values.items():
defaults[key.replace("-", "_")] = value
return defaults
def feed_type(value: str) -> str:
"""
Converts to a specific feed type
"""
value = value.replace("_", "-").lower()
if value in ("nvts", "report-formats", "port-lists", "scan-configs"):
return value[:-1]
return value
class CliParser:
"""
An ArgumentParser for the feed sync CLI
"""
def __init__(self) -> None:
parser = ArgumentParser(add_help=False)
shtab.add_argument_to(parser)
parser.add_argument(
"--version",
help="Print version then exit.",
action="version",
version=f"%(prog)s {__version__}",
)
parser.add_argument(
"-h",
"--help",
help="Show this help message and exit.",
action="store_true",
)
parser.add_argument(
"--selftest",
help="Perform self-test and set exit code",
action="store_true",
)
output_group = parser.add_mutually_exclusive_group()
output_group.add_argument(
"--verbose",
"-v",
action="count",
help="Set log verbosity. `-vvv` for maximum verbosity. "
"(Default: %(default)s)",
)
output_group.add_argument(
"--quiet", action="store_true", help="Disable all log output."
)
parser.add_argument(
"-c",
"--config",
help="Configuration file path. If not set %(prog)s "
f"tries to load {DEFAULT_USER_CONFIG_FILE} or "
f"{DEFAULT_CONFIG_FILE}.",
)
parser.add_argument(
"--private-directory",
help="(Sub-)Directory to exclude from the sync which will never "
"get deleted automatically.",
type=Path,
)
parser.add_argument(
"--compression-level",
type=int,
choices=range(0, 10),
help="Rsync compression level (0-9). (Default: %(default)s)",
)
parser.add_argument(
"--type",
choices=[
"all",
"nvt",
"gvmd-data",
"scap",
"cert",
"notus",
"nasl",
"report-format",
"scan-config",
"port-list",
],
default="all",
type=feed_type,
help="Select which feed should be synced. (Default: %(default)s)",
)
parser.add_argument(
"--feed-version",
help="Deprecated. Use --feed-release instead.",
)
parser.add_argument(
"--feed-release",
help="Release series of the feed to download for example 22.04 or 24.10. (Default: %(default)s)",
)
parser.add_argument(
"--destination-prefix",
type=Path,
help="Prefix for the destination directories. (Default: %(default)s)",
)
parser.add_argument(
"--gvmd-data-destination",
type=Path,
help="Destination of the downloaded gvmd data. "
"(Default: %(default)s)",
)
parser.add_argument(
"--gvmd-data-url",
help="URL to download the gvmd data from. (Default: %(default)s)",
)
nvts_destination_group = parser.add_argument_group()
nvts_destination_group.add_argument(
"--notus-destination",
type=Path,
help="Destination of the downloaded notus data. "
"(Default: %(default)s)",
)
nvts_url_group = parser.add_argument_group()
nvts_url_group.add_argument(
"--notus-url",
help="URL to download the notus data from. (Default: %(default)s)",
)
nvts_destination_group.add_argument(
"--nasl-destination",
type=Path,
help="Destination of the downloaded nasl data. "
"(Default: %(default)s)",
)
nvts_url_group.add_argument(
"--nasl-url",
help="URL to download the nasl data from. (Default: %(default)s)",
)
secinfo_destination_group = parser.add_argument_group()
secinfo_destination_group.add_argument(
"--scap-data-destination",
type=Path,
help="Destination of the downloaded SCAP data. "
"(Default: %(default)s)",
)
secinfo_url_group = parser.add_argument_group()
secinfo_url_group.add_argument(
"--scap-data-url",
help="URL to download the SCAP data from. (Default: %(default)s)",
)
secinfo_destination_group.add_argument(
"--cert-data-destination",
type=Path,
help="Destination of the downloaded CERT data. "
"(Default: %(default)s)",
)
secinfo_url_group.add_argument(
"--cert-data-url",
help="URL to download the CERT data from. (Default: %(default)s)",
)
data_objects_destination_group = parser.add_argument_group()
data_objects_destination_group.add_argument(
"--report-formats-destination",
type=Path,
help="Destination of the downloaded report format data "
"(Default: %(default)s)",
)
data_objects_url_group = parser.add_argument_group()
data_objects_url_group.add_argument(
"--report-formats-url",
help="URL to download the report format data from. "
"(Default: %(default)s)",
)
data_objects_destination_group.add_argument(
"--scan-configs-destination",
type=Path,
help="Destination of the downloaded scan config data. "
"(Default: %(default)s)",
)
data_objects_url_group.add_argument(
"--scan-configs-url",
help="URL to download the scan config data from. "
"(Default: %(default)s)",
)
data_objects_destination_group.add_argument(
"--port-lists-destination",
type=Path,
help="Destination of the downloaded port list data. "
"(Default: %(default)s)",
)
data_objects_url_group.add_argument(
"--port-lists-url",
help="URL to download the port list data from. "
"(Default: %(default)s)",
)
lock_file_group = parser.add_argument_group()
lock_file_group.add_argument(
"--gvmd-lock-file",
type=Path,
help="File to use for locking the feed synchronization for data "
"loaded by the gvmd daemon. Used to avoid that more then one "
"process accesses the feed data at the same time. "
"(Default: %(default)s)",
)
lock_file_group.add_argument(
"--openvas-lock-file",
type=Path,
help="File to use for locking the feed synchronization for data "
"loaded by the openvas scanner. Used to avoid that more then one "
"process accesses the feed data at the same time. "
"(Default: %(default)s)",
)
parser.add_argument(
"--fail-fast",
"--failfast",
action="store_true",
help="Stop after a first error has occurred. Otherwise the script "
"tries to download additional data if specified.",
)
wait_group = parser.add_mutually_exclusive_group()
wait_group.add_argument(
"--no-wait",
action="store_true",
help="Fail directly if the lock file can't be acquired.",
)
wait_group.add_argument(
"--wait-interval",
type=int,
help="Time to wait in seconds after failed lock attempt before"
"re-trying to lock the file. (Default: %(default)s seconds)",
)
parser.add_argument(
"--rsync-timeout",
type=int,
help="Maximum I/O timeout in seconds used for rsync. If no data is "
"transferred for the specified time then rsync will exit. By "
"default no timeout is set and the rsync default will be used.",
)
permissions_group = parser.add_argument_group()
permissions_group.add_argument(
"--user",
type=maybe_int,
help="If started as root, use this user name or ID to run the "
"script. (Default: %(default)s)",
)
permissions_group.add_argument(
"--group",
type=maybe_int,
help="If started as root, use this group name or ID to run the "
"script. (Default: %(default)s)",
)
parser.add_argument(
"--greenbone-enterprise-feed-key",
type=Path,
help="File to read the Greenbone Enterprise Feed key from. "
"The key gives access to additional vulnerability tests for "
"enterprise software among other advantages. See "
"https://www.greenbone.net/en/feed-comparison/ for more details."
"The default URLs are adjusted according to the data in the key."
"If the key file does not exist it is ignored. "
"(Default: %(default)s)",
)
self.parser = parser
def _determine_enterprise_settings(
self, enterprise_key: Path
) -> Optional[EnterpriseSettings]:
if not enterprise_key or not enterprise_key.exists():
return None
return EnterpriseSettings.from_key(enterprise_key)
def _load_config(self, config_file: str) -> Config:
config_path = None
if config_file is None:
for file in [DEFAULT_USER_CONFIG_FILE, DEFAULT_CONFIG_FILE]:
path = Path(file).expanduser().resolve()
if path.exists():
config_path = path
break
else:
config_path = Path(config_file).expanduser().resolve()
if not config_path.exists():
raise ConfigFileError(
f"Config file {config_file} does not exist."
)
config = Config()
if config_path:
config.load_from_config_file(config_path)
return config
def _set_defaults(self, config: ConfigDict) -> None:
self.parser.set_defaults(**_to_defaults(config))
def parse_arguments(
self, args: Optional[Sequence[str]] = None
) -> Namespace:
"""
Parse CLI arguments
"""
# Parse args to get the config file path passed as option
known_args, _ = self.parser.parse_known_args(args)
# Load the defaults from the config file if it exists.
config = self._load_config(known_args.config)
# set greenbone enterprise feed key in config if user passed one to load
# desired key for determining the feed url
if known_args.greenbone_enterprise_feed_key:
config["greenbone-enterprise-feed-key"] = (
known_args.greenbone_enterprise_feed_key
)
if known_args.feed_version:
config["feed-release"] = known_args.feed_version
if known_args.feed_release:
config["feed-release"] = known_args.feed_release
if known_args.destination_prefix:
config["destination-prefix"] = known_args.destination_prefix
if self.parser.prog == "greenbone-nvt-sync":
config["type"] = "nvt"
elif self.parser.prog == "greenbone-scapdata-sync":
config["type"] = "scap"
elif self.parser.prog == "greenbone-certdata-sync":
config["type"] = "cert"
# apply defaults in config
config.apply_settings()
# check if a enterprise feed key is available
enterprise_settings = self._determine_enterprise_settings(
config["greenbone-enterprise-feed-key"]
)
# override feed url from key
if enterprise_settings:
config["feed-url"] = enterprise_settings.feed_url()
# apply other config defaults
config.apply_dependent_settings()
# set config as defaults for CLI to make them visible in --help
self._set_defaults(config)
if known_args.help:
self.parser.print_help()
self.parser.exit(0)
return self.parser.parse_args(args)
greenbone-feed-sync-25.1.0/greenbone/feed/sync/rsync.py 0000664 0000000 0000000 00000010564 14752631415 0022767 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2022-2024 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
import asyncio
import os
from pathlib import Path
from typing import Iterable, Optional, Union
from urllib.parse import urlsplit
from greenbone.feed.sync.errors import RsyncError
async def exec_rsync(*args: str) -> None:
"""
Run rsync
Argument:
args: Arguments for rsync
"""
process = await asyncio.create_subprocess_exec(
"rsync", *args, stderr=asyncio.subprocess.PIPE
)
_, stderr = await process.communicate()
returncode = await process.wait()
if returncode:
raise RsyncError(returncode, args, stderr=stderr)
DEFAULT_RSYNC_URL = "rsync://feed.community.greenbone.net/community"
DEFAULT_RSYNC_COMPRESSION_LEVEL = 9
DEFAULT_RSYNC_TIMEOUT: Optional[int] = (
None # in seconds. 0 means no timeout and None use rsync default
)
DEFAULT_RSYNC_SSH_PORT = 24
DEFAULT_RSYNC_SSH_OPTS = (
"-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
)
PathLike = Union[os.PathLike, str]
class Rsync:
"""
Class to sync the feed data via rsync
Args:
verbose: Enable verbose output
private_subdir: A private directory to exclude from from the sync
compression_level: Set an compression level explicitly.
Default is 9 (highest).
timeout: Set a specific timeout in seconds. Default timeout of rsync is
used of not set explicitly. 0 for no timeout.
ssh_key: SSH key for using ssh as rsync transport protocol.
exclude: An iterable of directories to exclude from the sync.
"""
def __init__(
self,
*,
verbose: bool = False,
private_subdir: Optional[PathLike] = None,
compression_level: Optional[int] = DEFAULT_RSYNC_COMPRESSION_LEVEL,
timeout: Optional[int] = DEFAULT_RSYNC_TIMEOUT,
ssh_key: Optional[PathLike] = None,
exclude: Optional[Iterable[PathLike]] = None,
) -> None:
self.verbose = verbose
self.private_subdir = private_subdir
self.compression_level = compression_level
self.timeout = timeout
self.ssh_key = ssh_key
self.exclude = exclude
async def sync(self, url: str, destination: PathLike) -> None:
"""
Sync data from a remote URL to a destination path
Args:
url: URL to sync
destination: Path to store the downloaded data
"""
dest = Path(destination)
dest.mkdir(parents=True, exist_ok=True)
splitted_url = urlsplit(url)
rsync_default_options = [
"--links",
"--times",
"--omit-dir-times",
"--recursive",
"--partial",
"--progress",
]
if "ssh" in splitted_url.scheme:
port = splitted_url.port or DEFAULT_RSYNC_SSH_PORT
# we use ssh now
rsync_ssh_options = [
"-e",
f"ssh {DEFAULT_RSYNC_SSH_OPTS} -p {port} -i '{self.ssh_key}'",
]
url = f"{splitted_url.netloc}:{splitted_url.path}"
else:
rsync_ssh_options = []
rsync_timeout = (
[
f"--timeout={self.timeout}",
]
if self.timeout is not None
else []
)
rsync_compress = (
[
f"--compress-level={self.compression_level}",
]
if self.compression_level is not None
else []
)
rsync_delete = [
"--delete",
]
rsync_chmod = [
"--perms",
"--chmod=Fugo+r,Fug+w,Dugo-s,Dugo+rx,Dug+w",
]
rsync_links = [
"--copy-unsafe-links",
"--hard-links",
]
if self.private_subdir:
rsync_delete.extend(["--exclude", os.fspath(self.private_subdir)])
if self.exclude:
for exclude in self.exclude:
rsync_delete.extend(["--exclude", os.fspath(exclude)])
rsync_verbose = ["-v"] if self.verbose else ["-q"]
args = (
rsync_default_options
+ rsync_ssh_options
+ rsync_timeout
+ rsync_verbose
+ rsync_compress
+ rsync_delete
+ rsync_chmod
+ rsync_links
+ [url, str(dest.absolute())]
)
await exec_rsync(*args)
greenbone-feed-sync-25.1.0/poetry.lock 0000664 0000000 0000000 00000200703 14752631415 0017624 0 ustar 00root root 0000000 0000000 # This file is automatically @generated by Poetry 1.8.5 and should not be changed by hand.
[[package]]
name = "anyio"
version = "4.8.0"
description = "High level compatibility layer for multiple asynchronous event loop implementations"
optional = false
python-versions = ">=3.9"
files = [
{file = "anyio-4.8.0-py3-none-any.whl", hash = "sha256:b5011f270ab5eb0abf13385f851315585cc37ef330dd88e27ec3d34d651fd47a"},
{file = "anyio-4.8.0.tar.gz", hash = "sha256:1d9fe889df5212298c0c0723fa20479d1b94883a2df44bd3897aa91083316f7a"},
]
[package.dependencies]
exceptiongroup = {version = ">=1.0.2", markers = "python_version < \"3.11\""}
idna = ">=2.8"
sniffio = ">=1.1"
typing_extensions = {version = ">=4.5", markers = "python_version < \"3.13\""}
[package.extras]
doc = ["Sphinx (>=7.4,<8.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx_rtd_theme"]
test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "trustme", "truststore (>=0.9.1)", "uvloop (>=0.21)"]
trio = ["trio (>=0.26.1)"]
[[package]]
name = "autohooks"
version = "25.2.0"
description = "Library for managing git hooks"
optional = false
python-versions = "<4.0,>=3.9"
files = [
{file = "autohooks-25.2.0-py3-none-any.whl", hash = "sha256:5a2ed5fc03d899725638d2ca6bcb367f025a6196b225a5ea177e502fdf1bb065"},
{file = "autohooks-25.2.0.tar.gz", hash = "sha256:e306a24801fbc815628ebe48b063e2853a0857eb00bbdae733175e06e0ce8a84"},
]
[package.dependencies]
pontos = ">=22.8.0"
rich = ">=12.5.1"
shtab = ">=1.7.0"
tomlkit = ">=0.5.11"
[[package]]
name = "autohooks-plugin-black"
version = "23.10.0"
description = "An autohooks plugin for python code formatting via black"
optional = false
python-versions = ">=3.9,<4.0"
files = [
{file = "autohooks_plugin_black-23.10.0-py3-none-any.whl", hash = "sha256:88d648251df749586af9ea5be3105daa4358ed916b61aee738d0727387214470"},
{file = "autohooks_plugin_black-23.10.0.tar.gz", hash = "sha256:8415b5f566d861236bde2b0973699f64a8b861208af4fa05fe04a1f923ea3ef6"},
]
[package.dependencies]
autohooks = ">=21.6.0"
black = ">=20.8"
[[package]]
name = "autohooks-plugin-mypy"
version = "23.10.0"
description = "An autohooks plugin for python code static typing check with mypy"
optional = false
python-versions = ">=3.9,<4.0"
files = [
{file = "autohooks_plugin_mypy-23.10.0-py3-none-any.whl", hash = "sha256:8ac36b74900b2f2456fec046126e564374acd6de2752d87255c6f71c4e6a73ff"},
{file = "autohooks_plugin_mypy-23.10.0.tar.gz", hash = "sha256:ebefaa83074b662de38c914f6cac9f4f8e3452e36f54a5834df3f1590cc0c540"},
]
[package.dependencies]
autohooks = ">=21.7.0"
mypy = ">=0.910"
[[package]]
name = "autohooks-plugin-ruff"
version = "25.2.0"
description = "An autohooks plugin for python code formatting via ruff"
optional = false
python-versions = "<4.0,>=3.9"
files = [
{file = "autohooks_plugin_ruff-25.2.0-py3-none-any.whl", hash = "sha256:b0e3bbfb2d8bb94c509dad291801af1f6821877147b7f02f7e93812f8aef6ba1"},
{file = "autohooks_plugin_ruff-25.2.0.tar.gz", hash = "sha256:3290cd5b1939d80113e5a3b6408e4728e1c2bed0960b8101479897a196dc69d6"},
]
[package.dependencies]
autohooks = ">=25.2.0"
ruff = ">=0.0.272"
[[package]]
name = "black"
version = "25.1.0"
description = "The uncompromising code formatter."
optional = false
python-versions = ">=3.9"
files = [
{file = "black-25.1.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:759e7ec1e050a15f89b770cefbf91ebee8917aac5c20483bc2d80a6c3a04df32"},
{file = "black-25.1.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:0e519ecf93120f34243e6b0054db49c00a35f84f195d5bce7e9f5cfc578fc2da"},
{file = "black-25.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:055e59b198df7ac0b7efca5ad7ff2516bca343276c466be72eb04a3bcc1f82d7"},
{file = "black-25.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:db8ea9917d6f8fc62abd90d944920d95e73c83a5ee3383493e35d271aca872e9"},
{file = "black-25.1.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a39337598244de4bae26475f77dda852ea00a93bd4c728e09eacd827ec929df0"},
{file = "black-25.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:96c1c7cd856bba8e20094e36e0f948718dc688dba4a9d78c3adde52b9e6c2299"},
{file = "black-25.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bce2e264d59c91e52d8000d507eb20a9aca4a778731a08cfff7e5ac4a4bb7096"},
{file = "black-25.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:172b1dbff09f86ce6f4eb8edf9dede08b1fce58ba194c87d7a4f1a5aa2f5b3c2"},
{file = "black-25.1.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4b60580e829091e6f9238c848ea6750efed72140b91b048770b64e74fe04908b"},
{file = "black-25.1.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1e2978f6df243b155ef5fa7e558a43037c3079093ed5d10fd84c43900f2d8ecc"},
{file = "black-25.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3b48735872ec535027d979e8dcb20bf4f70b5ac75a8ea99f127c106a7d7aba9f"},
{file = "black-25.1.0-cp312-cp312-win_amd64.whl", hash = "sha256:ea0213189960bda9cf99be5b8c8ce66bb054af5e9e861249cd23471bd7b0b3ba"},
{file = "black-25.1.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:8f0b18a02996a836cc9c9c78e5babec10930862827b1b724ddfe98ccf2f2fe4f"},
{file = "black-25.1.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:afebb7098bfbc70037a053b91ae8437c3857482d3a690fefc03e9ff7aa9a5fd3"},
{file = "black-25.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:030b9759066a4ee5e5aca28c3c77f9c64789cdd4de8ac1df642c40b708be6171"},
{file = "black-25.1.0-cp313-cp313-win_amd64.whl", hash = "sha256:a22f402b410566e2d1c950708c77ebf5ebd5d0d88a6a2e87c86d9fb48afa0d18"},
{file = "black-25.1.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:a1ee0a0c330f7b5130ce0caed9936a904793576ef4d2b98c40835d6a65afa6a0"},
{file = "black-25.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:f3df5f1bf91d36002b0a75389ca8663510cf0531cca8aa5c1ef695b46d98655f"},
{file = "black-25.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d9e6827d563a2c820772b32ce8a42828dc6790f095f441beef18f96aa6f8294e"},
{file = "black-25.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:bacabb307dca5ebaf9c118d2d2f6903da0d62c9faa82bd21a33eecc319559355"},
{file = "black-25.1.0-py3-none-any.whl", hash = "sha256:95e8176dae143ba9097f351d174fdaf0ccd29efb414b362ae3fd72bf0f710717"},
{file = "black-25.1.0.tar.gz", hash = "sha256:33496d5cd1222ad73391352b4ae8da15253c5de89b93a80b3e2c8d9a19ec2666"},
]
[package.dependencies]
click = ">=8.0.0"
mypy-extensions = ">=0.4.3"
packaging = ">=22.0"
pathspec = ">=0.9.0"
platformdirs = ">=2"
tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
typing-extensions = {version = ">=4.0.1", markers = "python_version < \"3.11\""}
[package.extras]
colorama = ["colorama (>=0.4.3)"]
d = ["aiohttp (>=3.10)"]
jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"]
uvloop = ["uvloop (>=0.15.2)"]
[[package]]
name = "certifi"
version = "2025.1.31"
description = "Python package for providing Mozilla's CA Bundle."
optional = false
python-versions = ">=3.6"
files = [
{file = "certifi-2025.1.31-py3-none-any.whl", hash = "sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe"},
{file = "certifi-2025.1.31.tar.gz", hash = "sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651"},
]
[[package]]
name = "click"
version = "8.1.8"
description = "Composable command line interface toolkit"
optional = false
python-versions = ">=3.7"
files = [
{file = "click-8.1.8-py3-none-any.whl", hash = "sha256:63c132bbbed01578a06712a2d1f497bb62d9c1c0d329b7903a866228027263b2"},
{file = "click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a"},
]
[package.dependencies]
colorama = {version = "*", markers = "platform_system == \"Windows\""}
[[package]]
name = "colorama"
version = "0.4.6"
description = "Cross-platform colored terminal text."
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
files = [
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
]
[[package]]
name = "colorful"
version = "0.5.6"
description = "Terminal string styling done right, in Python."
optional = false
python-versions = "*"
files = [
{file = "colorful-0.5.6-py2.py3-none-any.whl", hash = "sha256:eab8c1c809f5025ad2b5238a50bd691e26850da8cac8f90d660ede6ea1af9f1e"},
{file = "colorful-0.5.6.tar.gz", hash = "sha256:b56d5c01db1dac4898308ea889edcb113fbee3e6ec5df4bacffd61d5241b5b8d"},
]
[package.dependencies]
colorama = {version = "*", markers = "platform_system == \"Windows\""}
[[package]]
name = "coverage"
version = "7.6.11"
description = "Code coverage measurement for Python"
optional = false
python-versions = ">=3.9"
files = [
{file = "coverage-7.6.11-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:eafea49da254a8289bed3fab960f808b322eda5577cb17a3733014928bbfbebd"},
{file = "coverage-7.6.11-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5a3f7cbbcb4ad95067a6525f83a6fc78d9cbc1e70f8abaeeaeaa72ef34f48fc3"},
{file = "coverage-7.6.11-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:de6b079b39246a7da9a40cfa62d5766bd52b4b7a88cf5a82ec4c45bf6e152306"},
{file = "coverage-7.6.11-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:60d4ad09dfc8c36c4910685faafcb8044c84e4dae302e86c585b3e2e7778726c"},
{file = "coverage-7.6.11-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8e433b6e3a834a43dae2889adc125f3fa4c66668df420d8e49bc4ee817dd7a70"},
{file = "coverage-7.6.11-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:ac5d92e2cc121a13270697e4cb37e1eb4511ac01d23fe1b6c097facc3b46489e"},
{file = "coverage-7.6.11-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:5128f3ba694c0a1bde55fc480090392c336236c3e1a10dad40dc1ab17c7675ff"},
{file = "coverage-7.6.11-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:397489c611b76302dfa1d9ea079e138dddc4af80fc6819d5f5119ec8ca6c0e47"},
{file = "coverage-7.6.11-cp310-cp310-win32.whl", hash = "sha256:c7719a5e1dc93883a6b319bc0374ecd46fb6091ed659f3fbe281ab991634b9b0"},
{file = "coverage-7.6.11-cp310-cp310-win_amd64.whl", hash = "sha256:c27df03730059118b8a923cfc8b84b7e9976742560af528242f201880879c1da"},
{file = "coverage-7.6.11-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:532fe139691af134aa8b54ed60dd3c806aa81312d93693bd2883c7b61592c840"},
{file = "coverage-7.6.11-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e0b0f272901a5172090c0802053fbc503cdc3fa2612720d2669a98a7384a7bec"},
{file = "coverage-7.6.11-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4bda710139ea646890d1c000feb533caff86904a0e0638f85e967c28cb8eec50"},
{file = "coverage-7.6.11-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a165b09e7d5f685bf659063334a9a7b1a2d57b531753d3e04bd442b3cfe5845b"},
{file = "coverage-7.6.11-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:ff136607689c1c87f43d24203b6d2055b42030f352d5176f9c8b204d4235ef27"},
{file = "coverage-7.6.11-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:050172741de03525290e67f0161ae5f7f387c88fca50d47fceb4724ceaa591d2"},
{file = "coverage-7.6.11-cp311-cp311-win32.whl", hash = "sha256:27700d859be68e4fb2e7bf774cf49933dcac6f81a9bc4c13bd41735b8d26a53b"},
{file = "coverage-7.6.11-cp311-cp311-win_amd64.whl", hash = "sha256:cd4839813b09ab1dd1be1bbc74f9a7787615f931f83952b6a9af1b2d3f708bf7"},
{file = "coverage-7.6.11-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:dbb1a822fd858d9853333a7c95d4e70dde9a79e65893138ce32c2ec6457d7a36"},
{file = "coverage-7.6.11-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:61c834cbb80946d6ebfddd9b393a4c46bec92fcc0fa069321fcb8049117f76ea"},
{file = "coverage-7.6.11-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a46d56e99a31d858d6912d31ffa4ede6a325c86af13139539beefca10a1234ce"},
{file = "coverage-7.6.11-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5b48db06f53d1864fea6dbd855e6d51d41c0f06c212c3004511c0bdc6847b297"},
{file = "coverage-7.6.11-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:b6ff5be3b1853e0862da9d349fe87f869f68e63a25f7c37ce1130b321140f963"},
{file = "coverage-7.6.11-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:be05bde21d5e6eefbc3a6de6b9bee2b47894b8945342e8663192809c4d1f08ce"},
{file = "coverage-7.6.11-cp312-cp312-win32.whl", hash = "sha256:e3b746fa0ffc5b6b8856529de487da8b9aeb4fb394bb58de6502ef45f3434f12"},
{file = "coverage-7.6.11-cp312-cp312-win_amd64.whl", hash = "sha256:ac476e6d0128fb7919b3fae726de72b28b5c9644cb4b579e4a523d693187c551"},
{file = "coverage-7.6.11-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:c86f4c7a6d1a54a24d804d9684d96e36a62d3ef7c0d7745ae2ea39e3e0293251"},
{file = "coverage-7.6.11-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:7eb0504bb307401fd08bc5163a351df301438b3beb88a4fa044681295bbefc67"},
{file = "coverage-7.6.11-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca95d40900cf614e07f00cee8c2fad0371df03ca4d7a80161d84be2ec132b7a4"},
{file = "coverage-7.6.11-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:db4b1a69976b1b02acda15937538a1d3fe10b185f9d99920b17a740a0a102e06"},
{file = "coverage-7.6.11-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4cf96beb05d004e4c51cd846fcdf9eee9eb2681518524b66b2e7610507944c2f"},
{file = "coverage-7.6.11-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:08e5fb93576a6b054d3d326242af5ef93daaac9bb52bc25f12ccbc3fa94227cd"},
{file = "coverage-7.6.11-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:25575cd5a7d2acc46b42711e8aff826027c0e4f80fb38028a74f31ac22aae69d"},
{file = "coverage-7.6.11-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:8fa4fffd90ee92f62ff7404b4801b59e8ea8502e19c9bf2d3241ce745b52926c"},
{file = "coverage-7.6.11-cp313-cp313-win32.whl", hash = "sha256:0d03c9452d9d1ccfe5d3a5df0427705022a49b356ac212d529762eaea5ef97b4"},
{file = "coverage-7.6.11-cp313-cp313-win_amd64.whl", hash = "sha256:fd2fffc8ce8692ce540103dff26279d2af22d424516ddebe2d7e4d6dbb3816b2"},
{file = "coverage-7.6.11-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:5e7ac966ab110bd94ee844f2643f196d78fde1cd2450399116d3efdd706e19f5"},
{file = "coverage-7.6.11-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:6ba27a0375c5ef4d2a7712f829265102decd5ff78b96d342ac2fa555742c4f4f"},
{file = "coverage-7.6.11-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e2778be4f574b39ec9dcd9e5e13644f770351ee0990a0ecd27e364aba95af89b"},
{file = "coverage-7.6.11-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5edc16712187139ab635a2e644cc41fc239bc6d245b16124045743130455c652"},
{file = "coverage-7.6.11-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:df6ff122a0a10a30121d9f0cb3fbd03a6fe05861e4ec47adb9f25e9245aabc19"},
{file = "coverage-7.6.11-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:ff562952f15eff27247a4c4b03e45ce8a82e3fb197de6a7c54080f9d4ba07845"},
{file = "coverage-7.6.11-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:4f21e3617f48d683f30cf2a6c8b739c838e600cb1454fe6b2eb486ac2bce8fbd"},
{file = "coverage-7.6.11-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:6d60577673ba48d8ae8e362e61fd4ad1a640293ffe8991d11c86f195479100b7"},
{file = "coverage-7.6.11-cp313-cp313t-win32.whl", hash = "sha256:13100f98497086b359bf56fc035a762c674de8ef526daa389ac8932cb9bff1e0"},
{file = "coverage-7.6.11-cp313-cp313t-win_amd64.whl", hash = "sha256:2c81e53782043b323bd34c7de711ed9b4673414eb517eaf35af92185b873839c"},
{file = "coverage-7.6.11-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:ff52b4e2ac0080c96e506819586c4b16cdbf46724bda90d308a7330a73cc8521"},
{file = "coverage-7.6.11-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:f4679fcc9eb9004fdd1b00231ef1ec7167168071bebc4d66327e28c1979b4449"},
{file = "coverage-7.6.11-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:90de4e9ca4489e823138bd13098af9ac8028cc029f33f60098b5c08c675c7bda"},
{file = "coverage-7.6.11-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c96a142057d83ee993eaf71629ca3fb952cda8afa9a70af4132950c2bd3deb9"},
{file = "coverage-7.6.11-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:476f29a258b9cd153f2be5bf5f119d670d2806363595263917bddc167d6e5cce"},
{file = "coverage-7.6.11-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:09d03f48d9025b8a6a116cddcb6c7b8ce80e4fb4c31dd2e124a7c377036ad58e"},
{file = "coverage-7.6.11-cp39-cp39-win32.whl", hash = "sha256:bb35ae9f134fbd9cf7302a9654d5a1e597c974202678082dcc569eb39a8cde03"},
{file = "coverage-7.6.11-cp39-cp39-win_amd64.whl", hash = "sha256:f382004fa4c93c01016d9226b9d696a08c53f6818b7ad59b4e96cb67e863353a"},
{file = "coverage-7.6.11-pp39.pp310-none-any.whl", hash = "sha256:adc2d941c0381edfcf3897f94b9f41b1e504902fab78a04b1677f2f72afead4b"},
{file = "coverage-7.6.11-py3-none-any.whl", hash = "sha256:f0f334ae844675420164175bf32b04e18a81fe57ad8eb7e0cfd4689d681ffed7"},
{file = "coverage-7.6.11.tar.gz", hash = "sha256:e642e6a46a04e992ebfdabed79e46f478ec60e2c528e1e1a074d63800eda4286"},
]
[package.dependencies]
tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""}
[package.extras]
toml = ["tomli"]
[[package]]
name = "exceptiongroup"
version = "1.2.2"
description = "Backport of PEP 654 (exception groups)"
optional = false
python-versions = ">=3.7"
files = [
{file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"},
{file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"},
]
[package.extras]
test = ["pytest (>=6)"]
[[package]]
name = "h11"
version = "0.14.0"
description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1"
optional = false
python-versions = ">=3.7"
files = [
{file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"},
{file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"},
]
[[package]]
name = "h2"
version = "4.2.0"
description = "Pure-Python HTTP/2 protocol implementation"
optional = false
python-versions = ">=3.9"
files = [
{file = "h2-4.2.0-py3-none-any.whl", hash = "sha256:479a53ad425bb29af087f3458a61d30780bc818e4ebcf01f0b536ba916462ed0"},
{file = "h2-4.2.0.tar.gz", hash = "sha256:c8a52129695e88b1a0578d8d2cc6842bbd79128ac685463b887ee278126ad01f"},
]
[package.dependencies]
hpack = ">=4.1,<5"
hyperframe = ">=6.1,<7"
[[package]]
name = "hpack"
version = "4.1.0"
description = "Pure-Python HPACK header encoding"
optional = false
python-versions = ">=3.9"
files = [
{file = "hpack-4.1.0-py3-none-any.whl", hash = "sha256:157ac792668d995c657d93111f46b4535ed114f0c9c8d672271bbec7eae1b496"},
{file = "hpack-4.1.0.tar.gz", hash = "sha256:ec5eca154f7056aa06f196a557655c5b009b382873ac8d1e66e79e87535f1dca"},
]
[[package]]
name = "httpcore"
version = "1.0.7"
description = "A minimal low-level HTTP client."
optional = false
python-versions = ">=3.8"
files = [
{file = "httpcore-1.0.7-py3-none-any.whl", hash = "sha256:a3fff8f43dc260d5bd363d9f9cf1830fa3a458b332856f34282de498ed420edd"},
{file = "httpcore-1.0.7.tar.gz", hash = "sha256:8551cb62a169ec7162ac7be8d4817d561f60e08eaa485234898414bb5a8a0b4c"},
]
[package.dependencies]
certifi = "*"
h11 = ">=0.13,<0.15"
[package.extras]
asyncio = ["anyio (>=4.0,<5.0)"]
http2 = ["h2 (>=3,<5)"]
socks = ["socksio (==1.*)"]
trio = ["trio (>=0.22.0,<1.0)"]
[[package]]
name = "httpx"
version = "0.28.1"
description = "The next generation HTTP client."
optional = false
python-versions = ">=3.8"
files = [
{file = "httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad"},
{file = "httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc"},
]
[package.dependencies]
anyio = "*"
certifi = "*"
h2 = {version = ">=3,<5", optional = true, markers = "extra == \"http2\""}
httpcore = "==1.*"
idna = "*"
[package.extras]
brotli = ["brotli", "brotlicffi"]
cli = ["click (==8.*)", "pygments (==2.*)", "rich (>=10,<14)"]
http2 = ["h2 (>=3,<5)"]
socks = ["socksio (==1.*)"]
zstd = ["zstandard (>=0.18.0)"]
[[package]]
name = "hyperframe"
version = "6.1.0"
description = "Pure-Python HTTP/2 framing"
optional = false
python-versions = ">=3.9"
files = [
{file = "hyperframe-6.1.0-py3-none-any.whl", hash = "sha256:b03380493a519fce58ea5af42e4a42317bf9bd425596f7a0835ffce80f1a42e5"},
{file = "hyperframe-6.1.0.tar.gz", hash = "sha256:f630908a00854a7adeabd6382b43923a4c4cd4b821fcb527e6ab9e15382a3b08"},
]
[[package]]
name = "idna"
version = "3.10"
description = "Internationalized Domain Names in Applications (IDNA)"
optional = false
python-versions = ">=3.6"
files = [
{file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"},
{file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"},
]
[package.extras]
all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"]
[[package]]
name = "lxml"
version = "5.3.0"
description = "Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API."
optional = false
python-versions = ">=3.6"
files = [
{file = "lxml-5.3.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:dd36439be765e2dde7660212b5275641edbc813e7b24668831a5c8ac91180656"},
{file = "lxml-5.3.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ae5fe5c4b525aa82b8076c1a59d642c17b6e8739ecf852522c6321852178119d"},
{file = "lxml-5.3.0-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:501d0d7e26b4d261fca8132854d845e4988097611ba2531408ec91cf3fd9d20a"},
{file = "lxml-5.3.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fb66442c2546446944437df74379e9cf9e9db353e61301d1a0e26482f43f0dd8"},
{file = "lxml-5.3.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9e41506fec7a7f9405b14aa2d5c8abbb4dbbd09d88f9496958b6d00cb4d45330"},
{file = "lxml-5.3.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f7d4a670107d75dfe5ad080bed6c341d18c4442f9378c9f58e5851e86eb79965"},
{file = "lxml-5.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:41ce1f1e2c7755abfc7e759dc34d7d05fd221723ff822947132dc934d122fe22"},
{file = "lxml-5.3.0-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:44264ecae91b30e5633013fb66f6ddd05c006d3e0e884f75ce0b4755b3e3847b"},
{file = "lxml-5.3.0-cp310-cp310-manylinux_2_28_ppc64le.whl", hash = "sha256:3c174dc350d3ec52deb77f2faf05c439331d6ed5e702fc247ccb4e6b62d884b7"},
{file = "lxml-5.3.0-cp310-cp310-manylinux_2_28_s390x.whl", hash = "sha256:2dfab5fa6a28a0b60a20638dc48e6343c02ea9933e3279ccb132f555a62323d8"},
{file = "lxml-5.3.0-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:b1c8c20847b9f34e98080da785bb2336ea982e7f913eed5809e5a3c872900f32"},
{file = "lxml-5.3.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:2c86bf781b12ba417f64f3422cfc302523ac9cd1d8ae8c0f92a1c66e56ef2e86"},
{file = "lxml-5.3.0-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:c162b216070f280fa7da844531169be0baf9ccb17263cf5a8bf876fcd3117fa5"},
{file = "lxml-5.3.0-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:36aef61a1678cb778097b4a6eeae96a69875d51d1e8f4d4b491ab3cfb54b5a03"},
{file = "lxml-5.3.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:f65e5120863c2b266dbcc927b306c5b78e502c71edf3295dfcb9501ec96e5fc7"},
{file = "lxml-5.3.0-cp310-cp310-win32.whl", hash = "sha256:ef0c1fe22171dd7c7c27147f2e9c3e86f8bdf473fed75f16b0c2e84a5030ce80"},
{file = "lxml-5.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:052d99051e77a4f3e8482c65014cf6372e61b0a6f4fe9edb98503bb5364cfee3"},
{file = "lxml-5.3.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:74bcb423462233bc5d6066e4e98b0264e7c1bed7541fff2f4e34fe6b21563c8b"},
{file = "lxml-5.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a3d819eb6f9b8677f57f9664265d0a10dd6551d227afb4af2b9cd7bdc2ccbf18"},
{file = "lxml-5.3.0-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5b8f5db71b28b8c404956ddf79575ea77aa8b1538e8b2ef9ec877945b3f46442"},
{file = "lxml-5.3.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2c3406b63232fc7e9b8783ab0b765d7c59e7c59ff96759d8ef9632fca27c7ee4"},
{file = "lxml-5.3.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2ecdd78ab768f844c7a1d4a03595038c166b609f6395e25af9b0f3f26ae1230f"},
{file = "lxml-5.3.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:168f2dfcfdedf611eb285efac1516c8454c8c99caf271dccda8943576b67552e"},
{file = "lxml-5.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa617107a410245b8660028a7483b68e7914304a6d4882b5ff3d2d3eb5948d8c"},
{file = "lxml-5.3.0-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:69959bd3167b993e6e710b99051265654133a98f20cec1d9b493b931942e9c16"},
{file = "lxml-5.3.0-cp311-cp311-manylinux_2_28_ppc64le.whl", hash = "sha256:bd96517ef76c8654446fc3db9242d019a1bb5fe8b751ba414765d59f99210b79"},
{file = "lxml-5.3.0-cp311-cp311-manylinux_2_28_s390x.whl", hash = "sha256:ab6dd83b970dc97c2d10bc71aa925b84788c7c05de30241b9e96f9b6d9ea3080"},
{file = "lxml-5.3.0-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:eec1bb8cdbba2925bedc887bc0609a80e599c75b12d87ae42ac23fd199445654"},
{file = "lxml-5.3.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:6a7095eeec6f89111d03dabfe5883a1fd54da319c94e0fb104ee8f23616b572d"},
{file = "lxml-5.3.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:6f651ebd0b21ec65dfca93aa629610a0dbc13dbc13554f19b0113da2e61a4763"},
{file = "lxml-5.3.0-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:f422a209d2455c56849442ae42f25dbaaba1c6c3f501d58761c619c7836642ec"},
{file = "lxml-5.3.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:62f7fdb0d1ed2065451f086519865b4c90aa19aed51081979ecd05a21eb4d1be"},
{file = "lxml-5.3.0-cp311-cp311-win32.whl", hash = "sha256:c6379f35350b655fd817cd0d6cbeef7f265f3ae5fedb1caae2eb442bbeae9ab9"},
{file = "lxml-5.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:9c52100e2c2dbb0649b90467935c4b0de5528833c76a35ea1a2691ec9f1ee7a1"},
{file = "lxml-5.3.0-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:e99f5507401436fdcc85036a2e7dc2e28d962550afe1cbfc07c40e454256a859"},
{file = "lxml-5.3.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:384aacddf2e5813a36495233b64cb96b1949da72bef933918ba5c84e06af8f0e"},
{file = "lxml-5.3.0-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:874a216bf6afaf97c263b56371434e47e2c652d215788396f60477540298218f"},
{file = "lxml-5.3.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:65ab5685d56914b9a2a34d67dd5488b83213d680b0c5d10b47f81da5a16b0b0e"},
{file = "lxml-5.3.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:aac0bbd3e8dd2d9c45ceb82249e8bdd3ac99131a32b4d35c8af3cc9db1657179"},
{file = "lxml-5.3.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b369d3db3c22ed14c75ccd5af429086f166a19627e84a8fdade3f8f31426e52a"},
{file = "lxml-5.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c24037349665434f375645fa9d1f5304800cec574d0310f618490c871fd902b3"},
{file = "lxml-5.3.0-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:62d172f358f33a26d6b41b28c170c63886742f5b6772a42b59b4f0fa10526cb1"},
{file = "lxml-5.3.0-cp312-cp312-manylinux_2_28_ppc64le.whl", hash = "sha256:c1f794c02903c2824fccce5b20c339a1a14b114e83b306ff11b597c5f71a1c8d"},
{file = "lxml-5.3.0-cp312-cp312-manylinux_2_28_s390x.whl", hash = "sha256:5d6a6972b93c426ace71e0be9a6f4b2cfae9b1baed2eed2006076a746692288c"},
{file = "lxml-5.3.0-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:3879cc6ce938ff4eb4900d901ed63555c778731a96365e53fadb36437a131a99"},
{file = "lxml-5.3.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:74068c601baff6ff021c70f0935b0c7bc528baa8ea210c202e03757c68c5a4ff"},
{file = "lxml-5.3.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:ecd4ad8453ac17bc7ba3868371bffb46f628161ad0eefbd0a855d2c8c32dd81a"},
{file = "lxml-5.3.0-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:7e2f58095acc211eb9d8b5771bf04df9ff37d6b87618d1cbf85f92399c98dae8"},
{file = "lxml-5.3.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:e63601ad5cd8f860aa99d109889b5ac34de571c7ee902d6812d5d9ddcc77fa7d"},
{file = "lxml-5.3.0-cp312-cp312-win32.whl", hash = "sha256:17e8d968d04a37c50ad9c456a286b525d78c4a1c15dd53aa46c1d8e06bf6fa30"},
{file = "lxml-5.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:c1a69e58a6bb2de65902051d57fde951febad631a20a64572677a1052690482f"},
{file = "lxml-5.3.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:8c72e9563347c7395910de6a3100a4840a75a6f60e05af5e58566868d5eb2d6a"},
{file = "lxml-5.3.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e92ce66cd919d18d14b3856906a61d3f6b6a8500e0794142338da644260595cd"},
{file = "lxml-5.3.0-cp313-cp313-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1d04f064bebdfef9240478f7a779e8c5dc32b8b7b0b2fc6a62e39b928d428e51"},
{file = "lxml-5.3.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5c2fb570d7823c2bbaf8b419ba6e5662137f8166e364a8b2b91051a1fb40ab8b"},
{file = "lxml-5.3.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0c120f43553ec759f8de1fee2f4794452b0946773299d44c36bfe18e83caf002"},
{file = "lxml-5.3.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:562e7494778a69086f0312ec9689f6b6ac1c6b65670ed7d0267e49f57ffa08c4"},
{file = "lxml-5.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:423b121f7e6fa514ba0c7918e56955a1d4470ed35faa03e3d9f0e3baa4c7e492"},
{file = "lxml-5.3.0-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:c00f323cc00576df6165cc9d21a4c21285fa6b9989c5c39830c3903dc4303ef3"},
{file = "lxml-5.3.0-cp313-cp313-manylinux_2_28_ppc64le.whl", hash = "sha256:1fdc9fae8dd4c763e8a31e7630afef517eab9f5d5d31a278df087f307bf601f4"},
{file = "lxml-5.3.0-cp313-cp313-manylinux_2_28_s390x.whl", hash = "sha256:658f2aa69d31e09699705949b5fc4719cbecbd4a97f9656a232e7d6c7be1a367"},
{file = "lxml-5.3.0-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:1473427aff3d66a3fa2199004c3e601e6c4500ab86696edffdbc84954c72d832"},
{file = "lxml-5.3.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a87de7dd873bf9a792bf1e58b1c3887b9264036629a5bf2d2e6579fe8e73edff"},
{file = "lxml-5.3.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:0d7b36afa46c97875303a94e8f3ad932bf78bace9e18e603f2085b652422edcd"},
{file = "lxml-5.3.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:cf120cce539453ae086eacc0130a324e7026113510efa83ab42ef3fcfccac7fb"},
{file = "lxml-5.3.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:df5c7333167b9674aa8ae1d4008fa4bc17a313cc490b2cca27838bbdcc6bb15b"},
{file = "lxml-5.3.0-cp313-cp313-win32.whl", hash = "sha256:c802e1c2ed9f0c06a65bc4ed0189d000ada8049312cfeab6ca635e39c9608957"},
{file = "lxml-5.3.0-cp313-cp313-win_amd64.whl", hash = "sha256:406246b96d552e0503e17a1006fd27edac678b3fcc9f1be71a2f94b4ff61528d"},
{file = "lxml-5.3.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:8f0de2d390af441fe8b2c12626d103540b5d850d585b18fcada58d972b74a74e"},
{file = "lxml-5.3.0-cp36-cp36m-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1afe0a8c353746e610bd9031a630a95bcfb1a720684c3f2b36c4710a0a96528f"},
{file = "lxml-5.3.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:56b9861a71575f5795bde89256e7467ece3d339c9b43141dbdd54544566b3b94"},
{file = "lxml-5.3.0-cp36-cp36m-manylinux_2_28_x86_64.whl", hash = "sha256:9fb81d2824dff4f2e297a276297e9031f46d2682cafc484f49de182aa5e5df99"},
{file = "lxml-5.3.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:2c226a06ecb8cdef28845ae976da407917542c5e6e75dcac7cc33eb04aaeb237"},
{file = "lxml-5.3.0-cp36-cp36m-musllinux_1_2_x86_64.whl", hash = "sha256:7d3d1ca42870cdb6d0d29939630dbe48fa511c203724820fc0fd507b2fb46577"},
{file = "lxml-5.3.0-cp36-cp36m-win32.whl", hash = "sha256:094cb601ba9f55296774c2d57ad68730daa0b13dc260e1f941b4d13678239e70"},
{file = "lxml-5.3.0-cp36-cp36m-win_amd64.whl", hash = "sha256:eafa2c8658f4e560b098fe9fc54539f86528651f61849b22111a9b107d18910c"},
{file = "lxml-5.3.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:cb83f8a875b3d9b458cada4f880fa498646874ba4011dc974e071a0a84a1b033"},
{file = "lxml-5.3.0-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:25f1b69d41656b05885aa185f5fdf822cb01a586d1b32739633679699f220391"},
{file = "lxml-5.3.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:23e0553b8055600b3bf4a00b255ec5c92e1e4aebf8c2c09334f8368e8bd174d6"},
{file = "lxml-5.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9ada35dd21dc6c039259596b358caab6b13f4db4d4a7f8665764d616daf9cc1d"},
{file = "lxml-5.3.0-cp37-cp37m-manylinux_2_28_aarch64.whl", hash = "sha256:81b4e48da4c69313192d8c8d4311e5d818b8be1afe68ee20f6385d0e96fc9512"},
{file = "lxml-5.3.0-cp37-cp37m-manylinux_2_28_x86_64.whl", hash = "sha256:2bc9fd5ca4729af796f9f59cd8ff160fe06a474da40aca03fcc79655ddee1a8b"},
{file = "lxml-5.3.0-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:07da23d7ee08577760f0a71d67a861019103e4812c87e2fab26b039054594cc5"},
{file = "lxml-5.3.0-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:ea2e2f6f801696ad7de8aec061044d6c8c0dd4037608c7cab38a9a4d316bfb11"},
{file = "lxml-5.3.0-cp37-cp37m-win32.whl", hash = "sha256:5c54afdcbb0182d06836cc3d1be921e540be3ebdf8b8a51ee3ef987537455f84"},
{file = "lxml-5.3.0-cp37-cp37m-win_amd64.whl", hash = "sha256:f2901429da1e645ce548bf9171784c0f74f0718c3f6150ce166be39e4dd66c3e"},
{file = "lxml-5.3.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:c56a1d43b2f9ee4786e4658c7903f05da35b923fb53c11025712562d5cc02753"},
{file = "lxml-5.3.0-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6ee8c39582d2652dcd516d1b879451500f8db3fe3607ce45d7c5957ab2596040"},
{file = "lxml-5.3.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0fdf3a3059611f7585a78ee10399a15566356116a4288380921a4b598d807a22"},
{file = "lxml-5.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:146173654d79eb1fc97498b4280c1d3e1e5d58c398fa530905c9ea50ea849b22"},
{file = "lxml-5.3.0-cp38-cp38-manylinux_2_28_aarch64.whl", hash = "sha256:0a7056921edbdd7560746f4221dca89bb7a3fe457d3d74267995253f46343f15"},
{file = "lxml-5.3.0-cp38-cp38-manylinux_2_28_x86_64.whl", hash = "sha256:9e4b47ac0f5e749cfc618efdf4726269441014ae1d5583e047b452a32e221920"},
{file = "lxml-5.3.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:f914c03e6a31deb632e2daa881fe198461f4d06e57ac3d0e05bbcab8eae01945"},
{file = "lxml-5.3.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:213261f168c5e1d9b7535a67e68b1f59f92398dd17a56d934550837143f79c42"},
{file = "lxml-5.3.0-cp38-cp38-win32.whl", hash = "sha256:218c1b2e17a710e363855594230f44060e2025b05c80d1f0661258142b2add2e"},
{file = "lxml-5.3.0-cp38-cp38-win_amd64.whl", hash = "sha256:315f9542011b2c4e1d280e4a20ddcca1761993dda3afc7a73b01235f8641e903"},
{file = "lxml-5.3.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:1ffc23010330c2ab67fac02781df60998ca8fe759e8efde6f8b756a20599c5de"},
{file = "lxml-5.3.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:2b3778cb38212f52fac9fe913017deea2fdf4eb1a4f8e4cfc6b009a13a6d3fcc"},
{file = "lxml-5.3.0-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4b0c7a688944891086ba192e21c5229dea54382f4836a209ff8d0a660fac06be"},
{file = "lxml-5.3.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:747a3d3e98e24597981ca0be0fd922aebd471fa99d0043a3842d00cdcad7ad6a"},
{file = "lxml-5.3.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:86a6b24b19eaebc448dc56b87c4865527855145d851f9fc3891673ff97950540"},
{file = "lxml-5.3.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b11a5d918a6216e521c715b02749240fb07ae5a1fefd4b7bf12f833bc8b4fe70"},
{file = "lxml-5.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:68b87753c784d6acb8a25b05cb526c3406913c9d988d51f80adecc2b0775d6aa"},
{file = "lxml-5.3.0-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:109fa6fede314cc50eed29e6e56c540075e63d922455346f11e4d7a036d2b8cf"},
{file = "lxml-5.3.0-cp39-cp39-manylinux_2_28_ppc64le.whl", hash = "sha256:02ced472497b8362c8e902ade23e3300479f4f43e45f4105c85ef43b8db85229"},
{file = "lxml-5.3.0-cp39-cp39-manylinux_2_28_s390x.whl", hash = "sha256:6b038cc86b285e4f9fea2ba5ee76e89f21ed1ea898e287dc277a25884f3a7dfe"},
{file = "lxml-5.3.0-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:7437237c6a66b7ca341e868cda48be24b8701862757426852c9b3186de1da8a2"},
{file = "lxml-5.3.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:7f41026c1d64043a36fda21d64c5026762d53a77043e73e94b71f0521939cc71"},
{file = "lxml-5.3.0-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:482c2f67761868f0108b1743098640fbb2a28a8e15bf3f47ada9fa59d9fe08c3"},
{file = "lxml-5.3.0-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:1483fd3358963cc5c1c9b122c80606a3a79ee0875bcac0204149fa09d6ff2727"},
{file = "lxml-5.3.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:2dec2d1130a9cda5b904696cec33b2cfb451304ba9081eeda7f90f724097300a"},
{file = "lxml-5.3.0-cp39-cp39-win32.whl", hash = "sha256:a0eabd0a81625049c5df745209dc7fcef6e2aea7793e5f003ba363610aa0a3ff"},
{file = "lxml-5.3.0-cp39-cp39-win_amd64.whl", hash = "sha256:89e043f1d9d341c52bf2af6d02e6adde62e0a46e6755d5eb60dc6e4f0b8aeca2"},
{file = "lxml-5.3.0-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:7b1cd427cb0d5f7393c31b7496419da594fe600e6fdc4b105a54f82405e6626c"},
{file = "lxml-5.3.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:51806cfe0279e06ed8500ce19479d757db42a30fd509940b1701be9c86a5ff9a"},
{file = "lxml-5.3.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ee70d08fd60c9565ba8190f41a46a54096afa0eeb8f76bd66f2c25d3b1b83005"},
{file = "lxml-5.3.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:8dc2c0395bea8254d8daebc76dcf8eb3a95ec2a46fa6fae5eaccee366bfe02ce"},
{file = "lxml-5.3.0-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:6ba0d3dcac281aad8a0e5b14c7ed6f9fa89c8612b47939fc94f80b16e2e9bc83"},
{file = "lxml-5.3.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:6e91cf736959057f7aac7adfc83481e03615a8e8dd5758aa1d95ea69e8931dba"},
{file = "lxml-5.3.0-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:94d6c3782907b5e40e21cadf94b13b0842ac421192f26b84c45f13f3c9d5dc27"},
{file = "lxml-5.3.0-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c300306673aa0f3ed5ed9372b21867690a17dba38c68c44b287437c362ce486b"},
{file = "lxml-5.3.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:78d9b952e07aed35fe2e1a7ad26e929595412db48535921c5013edc8aa4a35ce"},
{file = "lxml-5.3.0-pp37-pypy37_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:01220dca0d066d1349bd6a1726856a78f7929f3878f7e2ee83c296c69495309e"},
{file = "lxml-5.3.0-pp37-pypy37_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:2d9b8d9177afaef80c53c0a9e30fa252ff3036fb1c6494d427c066a4ce6a282f"},
{file = "lxml-5.3.0-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:20094fc3f21ea0a8669dc4c61ed7fa8263bd37d97d93b90f28fc613371e7a875"},
{file = "lxml-5.3.0-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:ace2c2326a319a0bb8a8b0e5b570c764962e95818de9f259ce814ee666603f19"},
{file = "lxml-5.3.0-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:92e67a0be1639c251d21e35fe74df6bcc40cba445c2cda7c4a967656733249e2"},
{file = "lxml-5.3.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd5350b55f9fecddc51385463a4f67a5da829bc741e38cf689f38ec9023f54ab"},
{file = "lxml-5.3.0-pp38-pypy38_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:4c1fefd7e3d00921c44dc9ca80a775af49698bbfd92ea84498e56acffd4c5469"},
{file = "lxml-5.3.0-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:71a8dd38fbd2f2319136d4ae855a7078c69c9a38ae06e0c17c73fd70fc6caad8"},
{file = "lxml-5.3.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:97acf1e1fd66ab53dacd2c35b319d7e548380c2e9e8c54525c6e76d21b1ae3b1"},
{file = "lxml-5.3.0-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:68934b242c51eb02907c5b81d138cb977b2129a0a75a8f8b60b01cb8586c7b21"},
{file = "lxml-5.3.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b710bc2b8292966b23a6a0121f7a6c51d45d2347edcc75f016ac123b8054d3f2"},
{file = "lxml-5.3.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:18feb4b93302091b1541221196a2155aa296c363fd233814fa11e181adebc52f"},
{file = "lxml-5.3.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:3eb44520c4724c2e1a57c0af33a379eee41792595023f367ba3952a2d96c2aab"},
{file = "lxml-5.3.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:609251a0ca4770e5a8768ff902aa02bf636339c5a93f9349b48eb1f606f7f3e9"},
{file = "lxml-5.3.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:516f491c834eb320d6c843156440fe7fc0d50b33e44387fcec5b02f0bc118a4c"},
{file = "lxml-5.3.0.tar.gz", hash = "sha256:4e109ca30d1edec1ac60cdbe341905dc3b8f55b16855e03a54aaf59e51ec8c6f"},
]
[package.extras]
cssselect = ["cssselect (>=0.7)"]
html-clean = ["lxml-html-clean"]
html5 = ["html5lib"]
htmlsoup = ["BeautifulSoup4"]
source = ["Cython (>=3.0.11)"]
[[package]]
name = "markdown-it-py"
version = "3.0.0"
description = "Python port of markdown-it. Markdown parsing, done right!"
optional = false
python-versions = ">=3.8"
files = [
{file = "markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"},
{file = "markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"},
]
[package.dependencies]
mdurl = ">=0.1,<1.0"
[package.extras]
benchmarking = ["psutil", "pytest", "pytest-benchmark"]
code-style = ["pre-commit (>=3.0,<4.0)"]
compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe (>=1.0,<2.0)", "mistune (>=2.0,<3.0)", "panflute (>=2.3,<3.0)"]
linkify = ["linkify-it-py (>=1,<3)"]
plugins = ["mdit-py-plugins"]
profiling = ["gprof2dot"]
rtd = ["jupyter_sphinx", "mdit-py-plugins", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"]
testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"]
[[package]]
name = "mdurl"
version = "0.1.2"
description = "Markdown URL utilities"
optional = false
python-versions = ">=3.7"
files = [
{file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"},
{file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"},
]
[[package]]
name = "mypy"
version = "1.15.0"
description = "Optional static typing for Python"
optional = false
python-versions = ">=3.9"
files = [
{file = "mypy-1.15.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:979e4e1a006511dacf628e36fadfecbcc0160a8af6ca7dad2f5025529e082c13"},
{file = "mypy-1.15.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c4bb0e1bd29f7d34efcccd71cf733580191e9a264a2202b0239da95984c5b559"},
{file = "mypy-1.15.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:be68172e9fd9ad8fb876c6389f16d1c1b5f100ffa779f77b1fb2176fcc9ab95b"},
{file = "mypy-1.15.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c7be1e46525adfa0d97681432ee9fcd61a3964c2446795714699a998d193f1a3"},
{file = "mypy-1.15.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:2e2c2e6d3593f6451b18588848e66260ff62ccca522dd231cd4dd59b0160668b"},
{file = "mypy-1.15.0-cp310-cp310-win_amd64.whl", hash = "sha256:6983aae8b2f653e098edb77f893f7b6aca69f6cffb19b2cc7443f23cce5f4828"},
{file = "mypy-1.15.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:2922d42e16d6de288022e5ca321cd0618b238cfc5570e0263e5ba0a77dbef56f"},
{file = "mypy-1.15.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2ee2d57e01a7c35de00f4634ba1bbf015185b219e4dc5909e281016df43f5ee5"},
{file = "mypy-1.15.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:973500e0774b85d9689715feeffcc980193086551110fd678ebe1f4342fb7c5e"},
{file = "mypy-1.15.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5a95fb17c13e29d2d5195869262f8125dfdb5c134dc8d9a9d0aecf7525b10c2c"},
{file = "mypy-1.15.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:1905f494bfd7d85a23a88c5d97840888a7bd516545fc5aaedff0267e0bb54e2f"},
{file = "mypy-1.15.0-cp311-cp311-win_amd64.whl", hash = "sha256:c9817fa23833ff189db061e6d2eff49b2f3b6ed9856b4a0a73046e41932d744f"},
{file = "mypy-1.15.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:aea39e0583d05124836ea645f412e88a5c7d0fd77a6d694b60d9b6b2d9f184fd"},
{file = "mypy-1.15.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2f2147ab812b75e5b5499b01ade1f4a81489a147c01585cda36019102538615f"},
{file = "mypy-1.15.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ce436f4c6d218a070048ed6a44c0bbb10cd2cc5e272b29e7845f6a2f57ee4464"},
{file = "mypy-1.15.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8023ff13985661b50a5928fc7a5ca15f3d1affb41e5f0a9952cb68ef090b31ee"},
{file = "mypy-1.15.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1124a18bc11a6a62887e3e137f37f53fbae476dc36c185d549d4f837a2a6a14e"},
{file = "mypy-1.15.0-cp312-cp312-win_amd64.whl", hash = "sha256:171a9ca9a40cd1843abeca0e405bc1940cd9b305eaeea2dda769ba096932bb22"},
{file = "mypy-1.15.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:93faf3fdb04768d44bf28693293f3904bbb555d076b781ad2530214ee53e3445"},
{file = "mypy-1.15.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:811aeccadfb730024c5d3e326b2fbe9249bb7413553f15499a4050f7c30e801d"},
{file = "mypy-1.15.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:98b7b9b9aedb65fe628c62a6dc57f6d5088ef2dfca37903a7d9ee374d03acca5"},
{file = "mypy-1.15.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c43a7682e24b4f576d93072216bf56eeff70d9140241f9edec0c104d0c515036"},
{file = "mypy-1.15.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:baefc32840a9f00babd83251560e0ae1573e2f9d1b067719479bfb0e987c6357"},
{file = "mypy-1.15.0-cp313-cp313-win_amd64.whl", hash = "sha256:b9378e2c00146c44793c98b8d5a61039a048e31f429fb0eb546d93f4b000bedf"},
{file = "mypy-1.15.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:e601a7fa172c2131bff456bb3ee08a88360760d0d2f8cbd7a75a65497e2df078"},
{file = "mypy-1.15.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:712e962a6357634fef20412699a3655c610110e01cdaa6180acec7fc9f8513ba"},
{file = "mypy-1.15.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f95579473af29ab73a10bada2f9722856792a36ec5af5399b653aa28360290a5"},
{file = "mypy-1.15.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8f8722560a14cde92fdb1e31597760dc35f9f5524cce17836c0d22841830fd5b"},
{file = "mypy-1.15.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:1fbb8da62dc352133d7d7ca90ed2fb0e9d42bb1a32724c287d3c76c58cbaa9c2"},
{file = "mypy-1.15.0-cp39-cp39-win_amd64.whl", hash = "sha256:d10d994b41fb3497719bbf866f227b3489048ea4bbbb5015357db306249f7980"},
{file = "mypy-1.15.0-py3-none-any.whl", hash = "sha256:5469affef548bd1895d86d3bf10ce2b44e33d86923c29e4d675b3e323437ea3e"},
{file = "mypy-1.15.0.tar.gz", hash = "sha256:404534629d51d3efea5c800ee7c42b72a6554d6c400e6a79eafe15d11341fd43"},
]
[package.dependencies]
mypy_extensions = ">=1.0.0"
tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""}
typing_extensions = ">=4.6.0"
[package.extras]
dmypy = ["psutil (>=4.0)"]
faster-cache = ["orjson"]
install-types = ["pip"]
mypyc = ["setuptools (>=50)"]
reports = ["lxml"]
[[package]]
name = "mypy-extensions"
version = "1.0.0"
description = "Type system extensions for programs checked with the mypy type checker."
optional = false
python-versions = ">=3.5"
files = [
{file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"},
{file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"},
]
[[package]]
name = "packaging"
version = "24.2"
description = "Core utilities for Python packages"
optional = false
python-versions = ">=3.8"
files = [
{file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"},
{file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"},
]
[[package]]
name = "pathspec"
version = "0.12.1"
description = "Utility library for gitignore style pattern matching of file paths."
optional = false
python-versions = ">=3.8"
files = [
{file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"},
{file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"},
]
[[package]]
name = "platformdirs"
version = "4.3.6"
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`."
optional = false
python-versions = ">=3.8"
files = [
{file = "platformdirs-4.3.6-py3-none-any.whl", hash = "sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb"},
{file = "platformdirs-4.3.6.tar.gz", hash = "sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907"},
]
[package.extras]
docs = ["furo (>=2024.8.6)", "proselint (>=0.14)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4)"]
test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=8.3.2)", "pytest-cov (>=5)", "pytest-mock (>=3.14)"]
type = ["mypy (>=1.11.2)"]
[[package]]
name = "pontos"
version = "25.1.0"
description = "Common utilities and tools maintained by Greenbone Networks"
optional = false
python-versions = "<4.0,>=3.9"
files = [
{file = "pontos-25.1.0-py3-none-any.whl", hash = "sha256:952764e1b6aa9c1b7436e7fba71e64e6726d04a0a84925d51940998d9c5af667"},
{file = "pontos-25.1.0.tar.gz", hash = "sha256:3a2a4267521e316fbac18aa21e7bb779358b1cb47e364ce7869ac4c630621594"},
]
[package.dependencies]
colorful = ">=0.5.4"
httpx = {version = ">=0.23", extras = ["http2"]}
lxml = ">=4.9.0"
packaging = ">=20.3"
python-dateutil = ">=2.8.2"
rich = ">=12.4.4"
semver = ">=2.13"
shtab = ">=1.7.0"
tomlkit = ">=0.5.11"
[[package]]
name = "pygments"
version = "2.19.1"
description = "Pygments is a syntax highlighting package written in Python."
optional = false
python-versions = ">=3.8"
files = [
{file = "pygments-2.19.1-py3-none-any.whl", hash = "sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c"},
{file = "pygments-2.19.1.tar.gz", hash = "sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f"},
]
[package.extras]
windows-terminal = ["colorama (>=0.4.6)"]
[[package]]
name = "python-dateutil"
version = "2.9.0.post0"
description = "Extensions to the standard Python datetime module"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
files = [
{file = "python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3"},
{file = "python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427"},
]
[package.dependencies]
six = ">=1.5"
[[package]]
name = "rich"
version = "13.9.4"
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
optional = false
python-versions = ">=3.8.0"
files = [
{file = "rich-13.9.4-py3-none-any.whl", hash = "sha256:6049d5e6ec054bf2779ab3358186963bac2ea89175919d699e378b99738c2a90"},
{file = "rich-13.9.4.tar.gz", hash = "sha256:439594978a49a09530cff7ebc4b5c7103ef57baf48d5ea3184f21d9a2befa098"},
]
[package.dependencies]
markdown-it-py = ">=2.2.0"
pygments = ">=2.13.0,<3.0.0"
typing-extensions = {version = ">=4.0.0,<5.0", markers = "python_version < \"3.11\""}
[package.extras]
jupyter = ["ipywidgets (>=7.5.1,<9)"]
[[package]]
name = "ruff"
version = "0.9.5"
description = "An extremely fast Python linter and code formatter, written in Rust."
optional = false
python-versions = ">=3.7"
files = [
{file = "ruff-0.9.5-py3-none-linux_armv6l.whl", hash = "sha256:d466d2abc05f39018d53f681fa1c0ffe9570e6d73cde1b65d23bb557c846f442"},
{file = "ruff-0.9.5-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:38840dbcef63948657fa7605ca363194d2fe8c26ce8f9ae12eee7f098c85ac8a"},
{file = "ruff-0.9.5-py3-none-macosx_11_0_arm64.whl", hash = "sha256:d56ba06da53536b575fbd2b56517f6f95774ff7be0f62c80b9e67430391eeb36"},
{file = "ruff-0.9.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4f7cb2a01da08244c50b20ccfaeb5972e4228c3c3a1989d3ece2bc4b1f996001"},
{file = "ruff-0.9.5-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:96d5c76358419bc63a671caac70c18732d4fd0341646ecd01641ddda5c39ca0b"},
{file = "ruff-0.9.5-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:deb8304636ed394211f3a6d46c0e7d9535b016f53adaa8340139859b2359a070"},
{file = "ruff-0.9.5-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:df455000bf59e62b3e8c7ba5ed88a4a2bc64896f900f311dc23ff2dc38156440"},
{file = "ruff-0.9.5-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:de92170dfa50c32a2b8206a647949590e752aca8100a0f6b8cefa02ae29dce80"},
{file = "ruff-0.9.5-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3d28532d73b1f3f627ba88e1456f50748b37f3a345d2be76e4c653bec6c3e393"},
{file = "ruff-0.9.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2c746d7d1df64f31d90503ece5cc34d7007c06751a7a3bbeee10e5f2463d52d2"},
{file = "ruff-0.9.5-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:11417521d6f2d121fda376f0d2169fb529976c544d653d1d6044f4c5562516ee"},
{file = "ruff-0.9.5-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:5b9d71c3879eb32de700f2f6fac3d46566f644a91d3130119a6378f9312a38e1"},
{file = "ruff-0.9.5-py3-none-musllinux_1_2_i686.whl", hash = "sha256:2e36c61145e70febcb78483903c43444c6b9d40f6d2f800b5552fec6e4a7bb9a"},
{file = "ruff-0.9.5-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:2f71d09aeba026c922aa7aa19a08d7bd27c867aedb2f74285a2639644c1c12f5"},
{file = "ruff-0.9.5-py3-none-win32.whl", hash = "sha256:134f958d52aa6fdec3b294b8ebe2320a950d10c041473c4316d2e7d7c2544723"},
{file = "ruff-0.9.5-py3-none-win_amd64.whl", hash = "sha256:78cc6067f6d80b6745b67498fb84e87d32c6fc34992b52bffefbdae3442967d6"},
{file = "ruff-0.9.5-py3-none-win_arm64.whl", hash = "sha256:18a29f1a005bddb229e580795627d297dfa99f16b30c7039e73278cf6b5f9fa9"},
{file = "ruff-0.9.5.tar.gz", hash = "sha256:11aecd7a633932875ab3cb05a484c99970b9d52606ce9ea912b690b02653d56c"},
]
[[package]]
name = "semver"
version = "3.0.4"
description = "Python helper for Semantic Versioning (https://semver.org)"
optional = false
python-versions = ">=3.7"
files = [
{file = "semver-3.0.4-py3-none-any.whl", hash = "sha256:9c824d87ba7f7ab4a1890799cec8596f15c1241cb473404ea1cb0c55e4b04746"},
{file = "semver-3.0.4.tar.gz", hash = "sha256:afc7d8c584a5ed0a11033af086e8af226a9c0b206f313e0301f8dd7b6b589602"},
]
[[package]]
name = "shtab"
version = "1.7.1"
description = "Automagic shell tab completion for Python CLI applications"
optional = false
python-versions = ">=3.7"
files = [
{file = "shtab-1.7.1-py3-none-any.whl", hash = "sha256:32d3d2ff9022d4c77a62492b6ec875527883891e33c6b479ba4d41a51e259983"},
{file = "shtab-1.7.1.tar.gz", hash = "sha256:4e4bcb02eeb82ec45920a5d0add92eac9c9b63b2804c9196c1f1fdc2d039243c"},
]
[package.extras]
dev = ["pytest (>=6)", "pytest-cov", "pytest-timeout"]
[[package]]
name = "six"
version = "1.17.0"
description = "Python 2 and 3 compatibility utilities"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
files = [
{file = "six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274"},
{file = "six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"},
]
[[package]]
name = "sniffio"
version = "1.3.1"
description = "Sniff out which async library your code is running under"
optional = false
python-versions = ">=3.7"
files = [
{file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"},
{file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"},
]
[[package]]
name = "tomli"
version = "2.2.1"
description = "A lil' TOML parser"
optional = false
python-versions = ">=3.8"
files = [
{file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"},
{file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"},
{file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"},
{file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"},
{file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"},
{file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"},
{file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"},
{file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"},
{file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"},
{file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"},
{file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"},
{file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"},
{file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"},
{file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"},
{file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"},
{file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"},
{file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"},
{file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"},
{file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"},
{file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"},
{file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"},
{file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"},
{file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"},
{file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"},
{file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"},
{file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"},
{file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"},
{file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"},
{file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"},
{file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"},
{file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"},
{file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"},
]
[[package]]
name = "tomlkit"
version = "0.13.2"
description = "Style preserving TOML library"
optional = false
python-versions = ">=3.8"
files = [
{file = "tomlkit-0.13.2-py3-none-any.whl", hash = "sha256:7a974427f6e119197f670fbbbeae7bef749a6c14e793db934baefc1b5f03efde"},
{file = "tomlkit-0.13.2.tar.gz", hash = "sha256:fff5fe59a87295b278abd31bec92c15d9bc4a06885ab12bcea52c71119392e79"},
]
[[package]]
name = "typing-extensions"
version = "4.12.2"
description = "Backported and Experimental Type Hints for Python 3.8+"
optional = false
python-versions = ">=3.8"
files = [
{file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"},
{file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"},
]
[metadata]
lock-version = "2.0"
python-versions = "^3.9"
content-hash = "fcb76399a3238b2d08d22b5989b8923506ea2a0375440dfcb1ef7e891ecff9ca"
greenbone-feed-sync-25.1.0/pyproject.toml 0000664 0000000 0000000 00000004403 14752631415 0020343 0 ustar 00root root 0000000 0000000 [tool.poetry]
name = "greenbone-feed-sync"
version = "25.1.0"
description = "A tool for downloading the Greenbone Community Feed"
authors = ["Björn Ricks "]
license = "GPL-3.0-or-later"
readme = "README.md"
classifiers = [
# Full list: https://pypi.org/pypi?%3Aaction=list_classifiers
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", # pylint: disable=line-too-long
"Environment :: Console",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
"Topic :: Utilities",
]
packages = [
{ include = "greenbone" },
{ include = "tests", format = "sdist" },
{ include = "poetry.lock", format = "sdist" },
]
[tool.poetry.dependencies]
python = "^3.9"
rich = ">=13.2.0"
tomli = { version = ">=2.0.1", python = "<3.11" }
shtab = ">=1.6.5"
[tool.poetry.group.dev.dependencies]
autohooks-plugin-black = ">=22.11.0"
autohooks-plugin-ruff = ">=23.6.0"
autohooks-plugin-mypy = ">=23.3.0"
pontos = ">=22.12.2"
coverage = { extras = ["toml"], version = ">=7.1.0" }
[tool.poetry.scripts]
greenbone-feed-sync = 'greenbone.feed.sync.main:main'
greenbone-nvt-sync = 'greenbone.feed.sync.main:main'
greenbone-scapdata-sync = 'greenbone.feed.sync.main:main'
greenbone-certdata-sync = 'greenbone.feed.sync.main:main'
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.black]
line-length = 80
target-version = ['py39', 'py310', 'py311', 'py312']
exclude = '''
/(
\.git
| \.venv
| \.github
| \.vscode
| _build
| build
| dist
| docs
)/
'''
[tool.autohooks]
pre-commit = [
'autohooks.plugins.black',
'autohooks.plugins.ruff',
'autohooks.plugins.mypy',
]
mode = "poetry"
[tool.pontos.version]
version-module-file = "greenbone/feed/sync/__version__.py"
[tool.isort]
profile = "black"
line_length = 80
[tool.ruff]
line-length = 80
target-version = "py39"
[tool.ruff.lint]
extend-select = ["I", "PLE", "PLW"]
[tool.coverage.run]
omit = ["tests/*", "*/__init__.py"]
source = ["greenbone"]
[tool.mypy]
files = "greenbone"
ignore_missing_imports = true
explicit_package_bases = true
greenbone-feed-sync-25.1.0/tests/ 0000775 0000000 0000000 00000000000 14752631415 0016570 5 ustar 00root root 0000000 0000000 greenbone-feed-sync-25.1.0/tests/__init__.py 0000664 0000000 0000000 00000000141 14752631415 0020675 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2022-2024 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
greenbone-feed-sync-25.1.0/tests/test_config.py 0000664 0000000 0000000 00000067747 14752631415 0021473 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2023-2024 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# pylint: disable=line-too-long
# ruff: noqa: E501
import unittest
from pathlib import Path
from unittest.mock import MagicMock, patch
from pontos.testing import temp_file
from greenbone.feed.sync.config import (
DEFAULT_DESTINATION_PREFIX,
DEFAULT_ENTERPRISE_KEY_PATH,
DEFAULT_FEED_RELEASE,
DEFAULT_GROUP,
DEFAULT_GVMD_LOCK_FILE_PATH,
DEFAULT_OPENVAS_LOCK_FILE_PATH,
DEFAULT_USER,
Config,
EnterpriseSettings,
)
from greenbone.feed.sync.errors import ConfigError, ConfigFileError
from greenbone.feed.sync.helper import DEFAULT_FLOCK_WAIT_INTERVAL
from greenbone.feed.sync.rsync import (
DEFAULT_RSYNC_COMPRESSION_LEVEL,
DEFAULT_RSYNC_URL,
)
class ConfigTestCase(unittest.TestCase):
def test_defaults(self):
values = Config.load()
self.assertEqual(len(values), 31)
self.assertEqual(
values["destination-prefix"], Path(DEFAULT_DESTINATION_PREFIX)
)
self.assertEqual(
values["gvmd-data-destination"],
Path(DEFAULT_DESTINATION_PREFIX) / "gvm" / "data-objects" / "gvmd",
)
self.assertEqual(
values["gvmd-data-url"],
f"{DEFAULT_RSYNC_URL}/data-feed/{DEFAULT_FEED_RELEASE}/",
)
self.assertEqual(values["feed-url"], DEFAULT_RSYNC_URL)
self.assertEqual(
values["notus-destination"],
Path(DEFAULT_DESTINATION_PREFIX) / "notus",
)
self.assertEqual(
values["notus-url"],
f"{DEFAULT_RSYNC_URL}/vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/notus/",
)
self.assertEqual(
values["nasl-destination"],
Path(DEFAULT_DESTINATION_PREFIX) / "openvas" / "plugins",
)
self.assertEqual(
values["nasl-url"],
f"{DEFAULT_RSYNC_URL}/vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/nasl/",
)
self.assertEqual(
values["scap-data-destination"],
Path(DEFAULT_DESTINATION_PREFIX) / "gvm" / "scap-data",
)
self.assertEqual(
values["scap-data-url"],
f"{DEFAULT_RSYNC_URL}/vulnerability-feed/{DEFAULT_FEED_RELEASE}/scap-data/",
)
self.assertEqual(
values["cert-data-destination"],
Path(DEFAULT_DESTINATION_PREFIX) / "gvm" / "cert-data",
)
self.assertEqual(
values["cert-data-url"],
f"{DEFAULT_RSYNC_URL}/vulnerability-feed/{DEFAULT_FEED_RELEASE}/cert-data/",
)
self.assertEqual(
values["report-formats-destination"],
Path(DEFAULT_DESTINATION_PREFIX)
/ "gvm"
/ "data-objects"
/ "gvmd"
/ "report-formats",
)
self.assertEqual(
values["report-formats-url"],
f"{DEFAULT_RSYNC_URL}/data-feed/{DEFAULT_FEED_RELEASE}/report-formats/",
)
self.assertEqual(
values["scan-configs-destination"],
Path(DEFAULT_DESTINATION_PREFIX)
/ "gvm"
/ "data-objects"
/ "gvmd"
/ "scan-configs",
)
self.assertEqual(
values["scan-configs-url"],
f"{DEFAULT_RSYNC_URL}/data-feed/{DEFAULT_FEED_RELEASE}/scan-configs/",
)
self.assertEqual(
values["port-lists-destination"],
Path(DEFAULT_DESTINATION_PREFIX)
/ "gvm"
/ "data-objects"
/ "gvmd"
/ "port-lists",
)
self.assertEqual(
values["port-lists-url"],
f"{DEFAULT_RSYNC_URL}/data-feed/{DEFAULT_FEED_RELEASE}/port-lists/",
)
self.assertEqual(
values["gvmd-lock-file"],
Path(DEFAULT_DESTINATION_PREFIX) / DEFAULT_GVMD_LOCK_FILE_PATH,
)
self.assertEqual(
values["openvas-lock-file"],
Path(DEFAULT_DESTINATION_PREFIX) / DEFAULT_OPENVAS_LOCK_FILE_PATH,
)
self.assertEqual(values["wait-interval"], DEFAULT_FLOCK_WAIT_INTERVAL)
self.assertFalse(values["no-wait"])
self.assertEqual(
values["compression-level"], DEFAULT_RSYNC_COMPRESSION_LEVEL
)
self.assertIsNone(values["private-directory"])
self.assertIsNone(values["verbose"])
self.assertFalse(values["fail-fast"])
self.assertIsNone(values["rsync-timeout"])
self.assertEqual(values["group"], DEFAULT_GROUP)
self.assertEqual(values["user"], DEFAULT_USER)
self.assertEqual(
values["greenbone-enterprise-feed-key"],
Path(DEFAULT_ENTERPRISE_KEY_PATH),
)
self.assertEqual(values["feed-release"], DEFAULT_FEED_RELEASE)
def test_config_file(self):
content = """[greenbone-feed-sync]
destination-prefix = "/opt/lib"
feed-url = "rsync://lorem.ipsum"
gvmd-data-destination = "/usr/lib/gvmd-data"
gvmd-data-url = "rsync://foo.bar/gvmd-data"
notus-destination = "/usr/lib/notus"
notus-url = "rsync://foo.bar/notus"
nasl-destination = "/usr/lib/openvas/plugins/"
nasl-url = "rsync://foo.bar/nasl"
scap-data-destination = "/usr/lib/scap-data"
scap-data-url = "rsync://foo.bar/scap-data"
cert-data-destination = "/usr/lib/cert-data"
cert-data-url = "rsync://foo.bar/cert-data"
report-formats-destination = "/usr/lib/report-formats"
report-formats-url = "rsync://foo.bar/report-formats"
scan-configs-destination = "/usr/lib/scan-configs"
scan-configs-url = "rsync://foo.bar/scan-configs"
port-lists-destination = "/usr/lib/port-lists"
port-lists-url = "rsync://foo.bar/port-lists"
openvas-lock-file = "/usr/lib/openvas.lock"
gvmd-lock-file = "/usr/lib/gvmd.lock"
wait-interval = 100
no-wait = true
compression-level = 1
private-directory = "keep-this"
verbose = 5
fail-fast = true
rsync-timeout = 120
group = "foo"
user = "bar"
greenbone-enterprise-feed-key = "/srv/feed.key"
feed-release = "1.2.3"
"""
path_mock = MagicMock(spec=Path)
path_mock.read_text.return_value = content
values = Config.load(path_mock)
self.assertEqual(values["destination-prefix"], Path("/opt/lib"))
self.assertEqual(values["feed-url"], "rsync://lorem.ipsum")
self.assertEqual(
values["gvmd-data-destination"], Path("/usr/lib/gvmd-data")
)
self.assertEqual(values["gvmd-data-url"], "rsync://foo.bar/gvmd-data")
self.assertEqual(
values["nasl-destination"], Path("/usr/lib/openvas/plugins")
)
self.assertEqual(values["notus-destination"], Path("/usr/lib/notus"))
self.assertEqual(values["notus-url"], "rsync://foo.bar/notus")
self.assertEqual(
values["nasl-destination"], Path("/usr/lib/openvas/plugins")
)
self.assertEqual(values["nasl-url"], "rsync://foo.bar/nasl")
self.assertEqual(
values["scap-data-destination"], Path("/usr/lib/scap-data")
)
self.assertEqual(values["scap-data-url"], "rsync://foo.bar/scap-data")
self.assertEqual(
values["cert-data-destination"], Path("/usr/lib/cert-data")
)
self.assertEqual(values["cert-data-url"], "rsync://foo.bar/cert-data")
self.assertEqual(
values["report-formats-destination"],
Path("/usr/lib/report-formats"),
)
self.assertEqual(
values["report-formats-url"], "rsync://foo.bar/report-formats"
)
self.assertEqual(
values["scan-configs-destination"],
Path("/usr/lib/scan-configs"),
)
self.assertEqual(
values["scan-configs-url"], "rsync://foo.bar/scan-configs"
)
self.assertEqual(
values["port-lists-destination"],
Path("/usr/lib/port-lists"),
)
self.assertEqual(values["port-lists-url"], "rsync://foo.bar/port-lists")
self.assertEqual(
values["openvas-lock-file"],
Path("/usr/lib/openvas.lock"),
)
self.assertEqual(values["gvmd-lock-file"], Path("/usr/lib/gvmd.lock"))
self.assertEqual(values["wait-interval"], 100)
self.assertTrue(values["no-wait"])
self.assertEqual(values["compression-level"], 1)
self.assertEqual(values["private-directory"], Path("keep-this"))
self.assertEqual(values["verbose"], 5)
self.assertTrue(values["fail-fast"])
self.assertEqual(values["rsync-timeout"], 120)
self.assertEqual(values["group"], "foo")
self.assertEqual(values["user"], "bar")
self.assertEqual(
values["greenbone-enterprise-feed-key"], Path("/srv/feed.key")
)
self.assertEqual(values["feed-release"], "1.2.3")
def test_destination_prefix(self):
content = """[greenbone-feed-sync]
destination-prefix = "/opt/lib/"
"""
path_mock = MagicMock(spec=Path)
path_mock.read_text.return_value = content
values = Config.load(path_mock)
self.assertEqual(values["destination-prefix"], Path("/opt/lib"))
self.assertEqual(
values["gvmd-data-destination"],
Path("/opt/lib/gvm/data-objects/gvmd/"),
)
self.assertEqual(values["notus-destination"], Path("/opt/lib/notus"))
self.assertEqual(
values["nasl-destination"], Path("/opt/lib/openvas/plugins")
)
self.assertEqual(
values["scap-data-destination"], Path("/opt/lib/gvm/scap-data")
)
self.assertEqual(
values["cert-data-destination"], Path("/opt/lib/gvm/cert-data")
)
self.assertEqual(
values["report-formats-destination"],
Path("/opt/lib/gvm/data-objects/gvmd/report-formats"),
)
self.assertEqual(
values["scan-configs-destination"],
Path("/opt/lib/gvm/data-objects/gvmd/scan-configs"),
)
self.assertEqual(
values["port-lists-destination"],
Path("/opt/lib/gvm/data-objects/gvmd/port-lists"),
)
self.assertEqual(
values["openvas-lock-file"],
Path("/opt/lib/openvas/feed-update.lock"),
)
self.assertEqual(
values["gvmd-lock-file"], Path("/opt/lib/gvm/feed-update.lock")
)
def test_feed_url(self):
content = """[greenbone-feed-sync]
feed-url = "rsync://foo.bar"
"""
path_mock = MagicMock(spec=Path)
path_mock.read_text.return_value = content
values = Config.load(path_mock)
self.assertEqual(values["feed-url"], "rsync://foo.bar")
self.assertEqual(
values["gvmd-data-url"],
f"rsync://foo.bar/data-feed/{DEFAULT_FEED_RELEASE}/",
)
self.assertEqual(
values["notus-url"],
f"rsync://foo.bar/vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/notus/",
)
self.assertEqual(
values["nasl-url"],
f"rsync://foo.bar/vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/nasl/",
)
self.assertEqual(
values["scap-data-url"],
f"rsync://foo.bar/vulnerability-feed/{DEFAULT_FEED_RELEASE}/scap-data/",
)
self.assertEqual(
values["cert-data-url"],
f"rsync://foo.bar/vulnerability-feed/{DEFAULT_FEED_RELEASE}/cert-data/",
)
self.assertEqual(
values["report-formats-url"],
f"rsync://foo.bar/data-feed/{DEFAULT_FEED_RELEASE}/report-formats/",
)
self.assertEqual(
values["scan-configs-url"],
f"rsync://foo.bar/data-feed/{DEFAULT_FEED_RELEASE}/scan-configs/",
)
self.assertEqual(
values["port-lists-url"],
f"rsync://foo.bar/data-feed/{DEFAULT_FEED_RELEASE}/port-lists/",
)
@patch.dict(
"os.environ",
{
"GREENBONE_FEED_SYNC_DESTINATION_PREFIX": "/opt/lib",
"GREENBONE_FEED_SYNC_URL": "rsync://lorem.ipsum",
"GREENBONE_FEED_SYNC_GVMD_DATA_DESTINATION": "/usr/lib/gvmd-data",
"GREENBONE_FEED_SYNC_GVMD_DATA_URL": "rsync://foo.bar/gvmd-data",
"GREENBONE_FEED_SYNC_NOTUS_DESTINATION": "/usr/lib/notus",
"GREENBONE_FEED_SYNC_NOTUS_URL": "rsync://foo.bar/notus",
"GREENBONE_FEED_SYNC_NASL_DESTINATION": "/usr/lib/openvas/plugins/",
"GREENBONE_FEED_SYNC_NASL_URL": "rsync://foo.bar/nasl",
"GREENBONE_FEED_SYNC_SCAP_DATA_DESTINATION": "/usr/lib/scap-data",
"GREENBONE_FEED_SYNC_SCAP_DATA_URL": "rsync://foo.bar/scap-data",
"GREENBONE_FEED_SYNC_CERT_DATA_DESTINATION": "/usr/lib/cert-data",
"GREENBONE_FEED_SYNC_CERT_DATA_URL": "rsync://foo.bar/cert-data",
"GREENBONE_FEED_SYNC_REPORT_FORMATS_DESTINATION": "/usr/lib/report-formats",
"GREENBONE_FEED_SYNC_REPORT_FORMATS_URL": "rsync://foo.bar/report-formats",
"GREENBONE_FEED_SYNC_SCAN_CONFIGS_DESTINATION": "/usr/lib/scan-configs",
"GREENBONE_FEED_SYNC_SCAN_CONFIGS_URL": "rsync://foo.bar/scan-configs",
"GREENBONE_FEED_SYNC_PORT_LISTS_DESTINATION": "/usr/lib/port-lists",
"GREENBONE_FEED_SYNC_PORT_LISTS_URL": "rsync://foo.bar/port-lists",
"GREENBONE_FEED_SYNC_OPENVAS_LOCK_FILE": "/usr/lib/openvas.lock",
"GREENBONE_FEED_SYNC_GVMD_LOCK_FILE": "/usr/lib/gvmd.lock",
"GREENBONE_FEED_SYNC_LOCK_WAIT_INTERVAL": "100",
"GREENBONE_FEED_SYNC_NO_WAIT": "1",
"GREENBONE_FEED_SYNC_COMPRESSION_LEVEL": "1",
"GREENBONE_FEED_SYNC_PRIVATE_DIRECTORY": "keep-this",
"GREENBONE_FEED_SYNC_VERBOSE": "5",
"GREENBONE_FEED_SYNC_FAIL_FAST": "1",
"GREENBONE_FEED_SYNC_RSYNC_TIMEOUT": "120",
"GREENBONE_FEED_SYNC_GROUP": "123",
"GREENBONE_FEED_SYNC_USER": "321",
"GREENBONE_FEED_SYNC_ENTERPRISE_FEED_KEY": "/tmp/some.key",
"GREENBONE_FEED_SYNC_FEED_RELEASE": "1.2.3",
},
)
def test_environment(self):
values = Config.load()
self.assertEqual(values["destination-prefix"], Path("/opt/lib"))
self.assertEqual(values["feed-url"], "rsync://lorem.ipsum")
self.assertEqual(
values["gvmd-data-destination"], Path("/usr/lib/gvmd-data")
)
self.assertEqual(values["gvmd-data-url"], "rsync://foo.bar/gvmd-data")
self.assertEqual(values["notus-destination"], Path("/usr/lib/notus"))
self.assertEqual(values["notus-url"], "rsync://foo.bar/notus")
self.assertEqual(
values["nasl-destination"], Path("/usr/lib/openvas/plugins")
)
self.assertEqual(values["nasl-url"], "rsync://foo.bar/nasl")
self.assertEqual(
values["scap-data-destination"], Path("/usr/lib/scap-data")
)
self.assertEqual(values["scap-data-url"], "rsync://foo.bar/scap-data")
self.assertEqual(
values["cert-data-destination"], Path("/usr/lib/cert-data")
)
self.assertEqual(values["cert-data-url"], "rsync://foo.bar/cert-data")
self.assertEqual(
values["report-formats-destination"],
Path("/usr/lib/report-formats"),
)
self.assertEqual(
values["report-formats-url"], "rsync://foo.bar/report-formats"
)
self.assertEqual(
values["scan-configs-destination"],
Path("/usr/lib/scan-configs"),
)
self.assertEqual(
values["scan-configs-url"], "rsync://foo.bar/scan-configs"
)
self.assertEqual(
values["port-lists-destination"],
Path("/usr/lib/port-lists"),
)
self.assertEqual(values["port-lists-url"], "rsync://foo.bar/port-lists")
self.assertEqual(
values["openvas-lock-file"],
Path("/usr/lib/openvas.lock"),
)
self.assertEqual(values["gvmd-lock-file"], Path("/usr/lib/gvmd.lock"))
self.assertEqual(values["wait-interval"], 100)
self.assertTrue(values["no-wait"])
self.assertEqual(values["compression-level"], 1)
self.assertEqual(values["private-directory"], Path("keep-this"))
self.assertEqual(values["verbose"], 5)
self.assertTrue(values["fail-fast"])
self.assertEqual(values["rsync-timeout"], 120)
self.assertEqual(values["group"], 123)
self.assertEqual(values["user"], 321)
self.assertEqual(
values["greenbone-enterprise-feed-key"], Path("/tmp/some.key")
)
self.assertEqual(values["feed-release"], "1.2.3")
@patch.dict(
"os.environ",
{
"GREENBONE_FEED_SYNC_DESTINATION_PREFIX": "/opt/lib",
"GREENBONE_FEED_SYNC_URL": "rsync://lorem.ipsum",
"GREENBONE_FEED_SYNC_GVMD_DATA_DESTINATION": "/usr/lib/gvmd-data",
"GREENBONE_FEED_SYNC_GVMD_DATA_URL": "rsync://foo.bar/gvmd-data",
"GREENBONE_FEED_SYNC_NOTUS_DESTINATION": "/usr/lib/notus",
"GREENBONE_FEED_SYNC_NOTUS_URL": "rsync://foo.bar/notus",
"GREENBONE_FEED_SYNC_NASL_DESTINATION": "/usr/lib/openvas/plugins/",
"GREENBONE_FEED_SYNC_NASL_URL": "rsync://foo.bar/nasl",
"GREENBONE_FEED_SYNC_SCAP_DATA_DESTINATION": "/usr/lib/scap-data",
"GREENBONE_FEED_SYNC_SCAP_DATA_URL": "rsync://foo.bar/scap-data",
"GREENBONE_FEED_SYNC_CERT_DATA_DESTINATION": "/usr/lib/cert-data",
"GREENBONE_FEED_SYNC_CERT_DATA_URL": "rsync://foo.bar/cert-data",
"GREENBONE_FEED_SYNC_REPORT_FORMATS_DESTINATION": "/usr/lib/report-formats",
"GREENBONE_FEED_SYNC_REPORT_FORMATS_URL": "rsync://foo.bar/report-formats",
"GREENBONE_FEED_SYNC_SCAN_CONFIGS_DESTINATION": "/usr/lib/scan-configs",
"GREENBONE_FEED_SYNC_SCAN_CONFIGS_URL": "rsync://foo.bar/scan-configs",
"GREENBONE_FEED_SYNC_PORT_LISTS_DESTINATION": "/usr/lib/port-lists",
"GREENBONE_FEED_SYNC_PORT_LISTS_URL": "rsync://foo.bar/port-lists",
"GREENBONE_FEED_SYNC_OPENVAS_LOCK_FILE": "/usr/lib/openvas.lock",
"GREENBONE_FEED_SYNC_GVMD_LOCK_FILE": "/usr/lib/gvmd.lock",
"GREENBONE_FEED_SYNC_LOCK_WAIT_INTERVAL": "100",
"GREENBONE_FEED_SYNC_NO_WAIT": "1",
"GREENBONE_FEED_SYNC_COMPRESSION_LEVEL": "1",
"GREENBONE_FEED_SYNC_PRIVATE_DIRECTORY": "keep-this",
"GREENBONE_FEED_SYNC_VERBOSE": "5",
"GREENBONE_FEED_SYNC_FAIL_FAST": "1",
"GREENBONE_FEED_SYNC_RSYNC_TIMEOUT": "120",
"GREENBONE_FEED_SYNC_ENTERPRISE_FEED_KEY": "/tmp/some.key",
"GREENBONE_FEED_SYNC_FEED_RELEASE": "1.2.3",
},
)
def test_environment_overrides_config_file(self):
content = """[greenbone-feed-sync]
destination-prefix = "/svr/lib"
feed-url = "rsync://ipsum.lorem"
gvmd-data-destination = "/root/notus"
gvmd-data-url = "rsync://bar.foo/notus"
notus-destination = "/root/notus"
notus-url = "rsync://bar.foo/notus"
nasl-destination = "/root/openvas/plugins/"
nasl-url = "rsync://bar.foo/nasl"
scap-data-destination = "/root/scap-data"
scap-data-url = "rsync://bar.foo/scap-data"
cert-data-destination = "/root/cert-data"
cert-data-url = "rsync://bar.foo/cert-data"
report-formats-destination = "/root/report-formats"
report-formats-url = "rsync://bar.foo/report-formats"
scan-configs-destination = "/root/scan-configs"
scan-configs-url = "rsync://bar.foo/scan-configs"
port-lists-destination = "/root/port-lists"
port-lists-url = "rsync://bar.foo/port-lists"
openvas-lock-file = "/root/openvas.lock"
gvmd-lock-file = "/root/gvmd.lock"
wait-interval = 99
no-wait = false
compression-level = 7
private-directory = "private"
verbose = 99
fail-fast = false
rsync-timeout = 360
greenbone-enterprise-feed-key = "/srv/feed.key"
feed-release = "2.3.4"
"""
path_mock = MagicMock(spec=Path)
path_mock.read_text.return_value = content
values = Config.load(path_mock)
self.assertEqual(values["destination-prefix"], Path("/opt/lib"))
self.assertEqual(values["feed-url"], "rsync://lorem.ipsum")
self.assertEqual(
values["gvmd-data-destination"], Path("/usr/lib/gvmd-data")
)
self.assertEqual(values["gvmd-data-url"], "rsync://foo.bar/gvmd-data")
self.assertEqual(values["notus-destination"], Path("/usr/lib/notus"))
self.assertEqual(values["notus-url"], "rsync://foo.bar/notus")
self.assertEqual(
values["nasl-destination"], Path("/usr/lib/openvas/plugins")
)
self.assertEqual(values["nasl-url"], "rsync://foo.bar/nasl")
self.assertEqual(
values["scap-data-destination"], Path("/usr/lib/scap-data")
)
self.assertEqual(values["scap-data-url"], "rsync://foo.bar/scap-data")
self.assertEqual(
values["cert-data-destination"], Path("/usr/lib/cert-data")
)
self.assertEqual(values["cert-data-url"], "rsync://foo.bar/cert-data")
self.assertEqual(
values["report-formats-destination"],
Path("/usr/lib/report-formats"),
)
self.assertEqual(
values["report-formats-url"], "rsync://foo.bar/report-formats"
)
self.assertEqual(
values["scan-configs-destination"],
Path("/usr/lib/scan-configs"),
)
self.assertEqual(
values["scan-configs-url"], "rsync://foo.bar/scan-configs"
)
self.assertEqual(
values["port-lists-destination"],
Path("/usr/lib/port-lists"),
)
self.assertEqual(values["port-lists-url"], "rsync://foo.bar/port-lists")
self.assertEqual(
values["openvas-lock-file"],
Path("/usr/lib/openvas.lock"),
)
self.assertEqual(values["gvmd-lock-file"], Path("/usr/lib/gvmd.lock"))
self.assertEqual(values["wait-interval"], 100)
self.assertTrue(values["no-wait"])
self.assertEqual(values["compression-level"], 1)
self.assertEqual(values["private-directory"], Path("keep-this"))
self.assertEqual(values["verbose"], 5)
self.assertTrue(values["fail-fast"])
self.assertEqual(values["rsync-timeout"], 120)
self.assertEqual(
values["greenbone-enterprise-feed-key"], Path("/tmp/some.key")
)
self.assertEqual(values["feed-release"], "1.2.3")
def test_feed_release(self):
feed_release = "1.2.3"
content = f"""[greenbone-feed-sync]
feed-release = "{feed_release}"
"""
path_mock = MagicMock(spec=Path)
path_mock.read_text.return_value = content
values = Config.load(path_mock)
self.assertEqual(
values["gvmd-data-destination"],
Path(DEFAULT_DESTINATION_PREFIX)
/ "gvm"
/ "data-objects"
/ "gvmd"
/ feed_release,
)
self.assertEqual(
values["gvmd-data-url"],
f"{DEFAULT_RSYNC_URL}/data-feed/{feed_release}/",
)
self.assertEqual(values["feed-url"], DEFAULT_RSYNC_URL)
self.assertEqual(
values["notus-destination"],
Path(DEFAULT_DESTINATION_PREFIX) / "notus",
)
self.assertEqual(
values["notus-url"],
f"{DEFAULT_RSYNC_URL}/vulnerability-feed/{feed_release}/vt-data/notus/",
)
self.assertEqual(
values["nasl-destination"],
Path(DEFAULT_DESTINATION_PREFIX) / "openvas" / "plugins",
)
self.assertEqual(
values["nasl-url"],
f"{DEFAULT_RSYNC_URL}/vulnerability-feed/{feed_release}/vt-data/nasl/",
)
self.assertEqual(
values["scap-data-destination"],
Path(DEFAULT_DESTINATION_PREFIX) / "gvm" / "scap-data",
)
self.assertEqual(
values["scap-data-url"],
f"{DEFAULT_RSYNC_URL}/vulnerability-feed/{feed_release}/scap-data/",
)
self.assertEqual(
values["cert-data-destination"],
Path(DEFAULT_DESTINATION_PREFIX) / "gvm" / "cert-data",
)
self.assertEqual(
values["cert-data-url"],
f"{DEFAULT_RSYNC_URL}/vulnerability-feed/{feed_release}/cert-data/",
)
self.assertEqual(
values["report-formats-destination"],
Path(DEFAULT_DESTINATION_PREFIX)
/ "gvm"
/ "data-objects"
/ "gvmd"
/ feed_release
/ "report-formats",
)
self.assertEqual(
values["report-formats-url"],
f"{DEFAULT_RSYNC_URL}/data-feed/{feed_release}/report-formats/",
)
self.assertEqual(
values["scan-configs-destination"],
Path(DEFAULT_DESTINATION_PREFIX)
/ "gvm"
/ "data-objects"
/ "gvmd"
/ feed_release
/ "scan-configs",
)
self.assertEqual(
values["scan-configs-url"],
f"{DEFAULT_RSYNC_URL}/data-feed/{feed_release}/scan-configs/",
)
self.assertEqual(
values["port-lists-destination"],
Path(DEFAULT_DESTINATION_PREFIX)
/ "gvm"
/ "data-objects"
/ "gvmd"
/ feed_release
/ "port-lists",
)
self.assertEqual(
values["port-lists-url"],
f"{DEFAULT_RSYNC_URL}/data-feed/{feed_release}/port-lists/",
)
def test_invalid_feed_release(self):
feed_release = "abc"
content = f"""[greenbone-feed-sync]
feed-release = "{feed_release}"
"""
path_mock = MagicMock(spec=Path)
path_mock.read_text.return_value = content
with self.assertRaisesRegex(
ConfigError, "Invalid feed release format: abc"
):
Config.load(path_mock)
feed_release = "a.b"
content = f"""[greenbone-feed-sync]
feed-release = "{feed_release}"
"""
path_mock = MagicMock(spec=Path)
path_mock.read_text.return_value = content
with self.assertRaisesRegex(
ConfigError, "Invalid feed release format: a.b"
):
Config.load(path_mock)
def test_invalid_toml(self):
content = "This is not TOML"
path_mock = MagicMock(spec=Path)
path_mock.read_text.return_value = content
path_mock.absolute.return_value = "/foo/bar.toml"
with self.assertRaisesRegex(
ConfigFileError,
"Can't load config file. /foo/bar.toml is not a valid TOML file.",
):
Config.load(path_mock)
def test_load_ioerror(self):
with self.assertRaisesRegex(
ConfigFileError,
r"Can't load config file .*foo\.toml\. Error was .*",
):
Config.load(Path("foo.toml"))
def test_getitem(self):
content = """[greenbone-feed-sync]
no-wait = false
compression-level = 7
private-directory = "private"
"""
path_mock = MagicMock(spec=Path)
path_mock.read_text.return_value = content
values = Config.load(path_mock)
self.assertFalse(values["no-wait"])
self.assertEqual(values["compression-level"], 7)
self.assertEqual(values["private-directory"], Path("private"))
def test_setitem(self):
config = Config()
config["no-wait"] = True
config["compression-level"] = 7
config["private-directory"] = "private"
self.assertTrue(config["no-wait"])
self.assertEqual(config["compression-level"], 7)
self.assertEqual(config["private-directory"], "private")
class EnterpriseSettingsTestCase(unittest.TestCase):
def test_from_key(self):
content = """a_user@some.feed.server:/feed/
Lorem ipsum dolor sit amet,
consetetur sadipscing elitr,
sed diam nonumy eirmod tempor
"""
with temp_file(content=content, name="enterprise.key") as f:
settings = EnterpriseSettings.from_key(f)
self.assertEqual(settings.key, f)
self.assertEqual(settings.host, "some.feed.server")
self.assertEqual(settings.user, "a_user")
def test_feed_url(self):
key = Path("/tmp/some.key")
settings = EnterpriseSettings("foo", "some.server", key)
self.assertEqual(
settings.feed_url(), "ssh://foo@some.server/enterprise"
)
greenbone-feed-sync-25.1.0/tests/test_helper.py 0000664 0000000 0000000 00000017025 14752631415 0021465 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2023-2024 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# pylint: disable=protected-access
import errno
import unittest
from io import StringIO
from unittest.mock import MagicMock, call, patch
from pontos.testing import temp_directory
from rich.console import Console
from greenbone.feed.sync.errors import FileLockingError, GreenboneFeedSyncError
from greenbone.feed.sync.helper import (
Spinner,
change_user_and_group,
flock_wait,
is_root,
)
class FlockTestCase(unittest.IsolatedAsyncioTestCase):
async def test_locking(self):
with temp_directory() as temp_dir:
lock_file = temp_dir / "file.lock"
self.assertFalse(lock_file.exists())
async with flock_wait(lock_file):
self.assertTrue(lock_file.exists())
with self.assertRaises(FileLockingError):
async with flock_wait(lock_file, wait_interval=None):
pass
async def test_can_not_create_parent_dirs(self):
with temp_directory() as temp_dir:
lock_file = temp_dir / "foo" / "file.lock"
temp_dir.chmod(0)
with self.assertRaisesRegex(
FileLockingError, "Could not create parent directories for "
):
async with flock_wait(lock_file):
pass
async def test_console_output(self):
with temp_directory() as temp_dir:
lock_file = temp_dir / "file.lock"
console = MagicMock(spec=Console)
async with flock_wait(lock_file, console=console):
pass
console.print.assert_has_calls(
[
call(f"Trying to acquire lock on {lock_file.absolute()}"),
call(f"Acquired lock on {lock_file.absolute()}"),
call(f"Releasing lock on {lock_file.absolute()}"),
]
)
@patch("greenbone.feed.sync.helper.fcntl.flock", autospec=True)
async def test_retry(self, flock_mock: MagicMock):
e = OSError()
e.errno = errno.EACCES
flock_mock.side_effect = [e, None, None]
with temp_directory() as temp_dir:
lock_file = temp_dir / "file.lock"
console = MagicMock(spec=Console)
async with flock_wait(
lock_file,
console=console,
wait_interval=0.5,
):
pass
console.print.assert_has_calls(
[
call(f"Trying to acquire lock on {lock_file.absolute()}"),
call(
f"{lock_file.absolute()} is locked by another process."
" Waiting 0.5 seconds before next try."
),
call(f"Trying to acquire lock on {lock_file.absolute()}"),
call(f"Acquired lock on {lock_file.absolute()}"),
call(f"Releasing lock on {lock_file.absolute()}"),
]
)
@patch("greenbone.feed.sync.helper.fcntl.flock", autospec=True)
async def test_lock_failure(self, flock_mock: MagicMock):
e = OSError()
e.errno = errno.EACCES
flock_mock.side_effect = e
with temp_directory() as temp_dir:
lock_file = temp_dir / "file.lock"
with self.assertRaisesRegex(
FileLockingError,
f"{lock_file.absolute()} is locked. Another process related "
"to the feed update may already running.",
):
async with flock_wait(
lock_file,
wait_interval=None,
):
pass
@patch("greenbone.feed.sync.helper.fcntl.flock", autospec=True)
async def test_lock_other_failure(self, flock_mock: MagicMock):
e = OSError("Other OSError")
flock_mock.side_effect = e
with temp_directory() as temp_dir:
lock_file = temp_dir / "file.lock"
with self.assertRaisesRegex(OSError, "Other OSError"):
async with flock_wait(
lock_file,
wait_interval=None,
):
pass
@patch("greenbone.feed.sync.helper.fcntl.flock", autospec=True)
async def test_unlock_oserror(self, flock_mock: MagicMock):
flock_mock.side_effect = [None, OSError]
with temp_directory() as temp_dir:
lock_file = temp_dir / "file.lock"
async with flock_wait(
lock_file,
):
pass
async def test_permission_error(self):
with temp_directory() as temp_dir:
lock_file = temp_dir / "file.lock"
lock_file.touch()
lock_file.chmod(0)
with self.assertRaisesRegex(
FileLockingError,
f"^Permission error while trying to open the lock file {lock_file.absolute()}$",
):
async with flock_wait(
lock_file,
):
pass
class SpinnerTestCase(unittest.TestCase):
@patch("greenbone.feed.sync.helper.Live", autospec=True)
def test_context_manager(self, live_mock: MagicMock):
console = MagicMock(spec=Console)
with Spinner(console, "Some Text"):
pass
live_mock_instance = live_mock.return_value
live_mock_instance.start.assert_called_once_with()
live_mock_instance.stop.assert_called_once_with()
def test_render(self):
out = StringIO()
console = Console(file=out)
with Spinner(console, "Some Text"):
pass
self.assertEqual("⠋ Some Text", out.getvalue())
class IsRootTestCase(unittest.TestCase):
@patch("greenbone.feed.sync.helper.os.geteuid", autospec=True)
def test_not_root(self, geteuid_mock: MagicMock):
geteuid_mock.return_value = 123
self.assertFalse(is_root())
@patch("greenbone.feed.sync.helper.os.geteuid", autospec=True)
def test_root(self, geteuid_mock: MagicMock):
geteuid_mock.return_value = 0
self.assertTrue(is_root())
class ChangeUserAndGroupTestCase(unittest.TestCase):
@patch("greenbone.feed.sync.helper.os", autospec=True)
def test_change(self, os_mock: MagicMock):
# root user should exist on all systems
change_user_and_group("root", "root")
os_mock.seteuid.assert_called_once_with(0)
os_mock.setegid.assert_called_once_with(0)
@patch("greenbone.feed.sync.helper.shutil", autospec=True)
@patch("greenbone.feed.sync.helper.os", autospec=True)
def test_change_with_unknown_user(
self, os_mock: MagicMock, shutil_mock: MagicMock
):
shutil_mock._get_uid.return_value = None
with self.assertRaisesRegex(
GreenboneFeedSyncError, "Can't run as user 'foo'.*"
):
change_user_and_group("foo", "bar")
os_mock.seteuid.assert_not_called()
os_mock.setegid.assert_not_called()
@patch("greenbone.feed.sync.helper.shutil", autospec=True)
@patch("greenbone.feed.sync.helper.os", autospec=True)
def test_change_with_unknown_group(
self, os_mock: MagicMock, shutil_mock: MagicMock
):
shutil_mock._get_uid.return_value = 123
shutil_mock._get_gid.return_value = None
with self.assertRaisesRegex(
GreenboneFeedSyncError, "Can't run as group 'bar'.*"
):
change_user_and_group("foo", "bar")
os_mock.seteuid.assert_not_called()
os_mock.setegid.assert_not_called()
greenbone-feed-sync-25.1.0/tests/test_main.py 0000664 0000000 0000000 00000041521 14752631415 0021130 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2023-2024 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
import sys
import unittest
from pathlib import Path
from unittest.mock import MagicMock, call, patch
from pontos.testing import temp_directory
from greenbone.feed.sync.config import DEFAULT_FEED_RELEASE
from greenbone.feed.sync.errors import GreenboneFeedSyncError, RsyncError
from greenbone.feed.sync.main import (
Sync,
do_selftest,
feed_sync,
filter_syncs,
main,
)
class FilterSyncsTestCase(unittest.TestCase):
def test_filter_syncs(self):
sync_a = Sync(name="a", types=["foo", "bar"], url="a", destination="a")
sync_b = Sync(name="b", types=["foo", "baz"], url="b", destination="b")
sync_c = Sync(name="c", types=["bar", "baz"], url="c", destination="c")
sync_list = filter_syncs(
"file.lock",
"foo",
sync_a,
sync_b,
sync_c,
)
self.assertEqual(len(sync_list.syncs), 2)
self.assertEqual(sync_list.lock_file, "file.lock")
self.assertEqual(sync_list.syncs[0], sync_a)
self.assertEqual(sync_list.syncs[1], sync_b)
class DoSelftestTestCase(unittest.TestCase):
@patch("greenbone.feed.sync.main.subprocess.run")
def test_do_selftest_success(self, mock_subprocess_run: MagicMock):
mock_subprocess_run.side_effect = [""]
do_selftest()
@patch("greenbone.feed.sync.main.subprocess.run")
def test_do_selftest_rsync_fail(self, mock_subprocess_run: MagicMock):
mock_subprocess_run.side_effect = [PermissionError]
with self.assertRaisesRegex(
GreenboneFeedSyncError, "The rsync binary could not be found."
):
do_selftest()
class FeedSyncTestCase(unittest.IsolatedAsyncioTestCase):
@patch("greenbone.feed.sync.main.Rsync", autospec=True)
@patch("greenbone.feed.sync.main.change_user_and_group", autospec=True)
@patch("greenbone.feed.sync.main.is_root", autospec=True)
async def test_do_not_run_as_root(
self,
is_root_mock: MagicMock,
change_user_mock: MagicMock,
rsync_mock: MagicMock,
):
is_root_mock.return_value = True
console = MagicMock()
rsync_mock_instance = rsync_mock.return_value
with (
temp_directory() as temp_dir,
patch.dict(
"os.environ",
{"GREENBONE_FEED_SYNC_DESTINATION_PREFIX": str(temp_dir)},
),
patch.object(
sys,
"argv",
[
"greenbone-feed-sync",
"--type",
"nvt",
],
),
):
ret = await feed_sync(console=console, error_console=console)
self.assertEqual(ret, 0)
change_user_mock.assert_called_once_with("gvm", "gvm")
rsync_mock.assert_called_once_with(
private_subdir=None,
verbose=False,
compression_level=9,
ssh_key=Path("/etc/gvm/greenbone-enterprise-feed-key"),
)
console.print.assert_has_calls(
[
call(
"Trying to acquire lock on "
f"{temp_dir}/openvas/feed-update.lock"
),
call(f"Acquired lock on {temp_dir}/openvas/feed-update.lock"),
call(f"Releasing lock on {temp_dir}/openvas/feed-update.lock"),
call(),
]
)
rsync_mock_instance.sync.assert_has_awaits(
[
call(
url="rsync://feed.community.greenbone.net/community/"
f"vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/notus/",
destination=temp_dir / "notus",
),
call(
url="rsync://feed.community.greenbone.net/community/"
f"vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/nasl/",
destination=temp_dir / "openvas/plugins",
),
]
)
@patch("greenbone.feed.sync.main.Rsync", autospec=True)
async def test_sync_nvts(self, rsync_mock: MagicMock):
console = MagicMock()
rsync_mock_instance = rsync_mock.return_value
with (
temp_directory() as temp_dir,
patch.dict(
"os.environ",
{"GREENBONE_FEED_SYNC_DESTINATION_PREFIX": str(temp_dir)},
),
patch.object(
sys,
"argv",
[
"greenbone-feed-sync",
"--type",
"nvt",
],
),
):
ret = await feed_sync(console=console, error_console=console)
self.assertEqual(ret, 0)
rsync_mock.assert_called_once_with(
private_subdir=None,
verbose=False,
compression_level=9,
ssh_key=Path("/etc/gvm/greenbone-enterprise-feed-key"),
)
console.print.assert_has_calls(
[
call(
"Trying to acquire lock on "
f"{temp_dir}/openvas/feed-update.lock"
),
call(
f"Acquired lock on {temp_dir}/openvas/feed-update.lock"
),
call(
f"Releasing lock on {temp_dir}/openvas/feed-update.lock"
),
call(),
]
)
rsync_mock_instance.sync.assert_has_awaits(
[
call(
url="rsync://feed.community.greenbone.net/community/"
f"vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/notus/",
destination=temp_dir / "notus",
),
call(
url="rsync://feed.community.greenbone.net/community/"
f"vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/nasl/",
destination=temp_dir / "openvas/plugins",
),
]
)
@patch("greenbone.feed.sync.main.Rsync", autospec=True)
async def test_sync_nvts_verbose(self, rsync_mock: MagicMock):
console = MagicMock()
rsync_mock_instance = rsync_mock.return_value
with (
temp_directory() as temp_dir,
patch.dict(
"os.environ",
{"GREENBONE_FEED_SYNC_DESTINATION_PREFIX": str(temp_dir)},
),
patch.object(
sys,
"argv",
["greenbone-feed-sync", "--type", "nvt", "-vvv"],
),
):
ret = await feed_sync(console=console, error_console=console)
self.assertEqual(ret, 0)
rsync_mock.assert_called_once_with(
private_subdir=None,
verbose=True,
compression_level=9,
ssh_key=Path("/etc/gvm/greenbone-enterprise-feed-key"),
)
console.print.assert_has_calls(
[
call(
"Trying to acquire lock on "
f"{temp_dir}/openvas/feed-update.lock"
),
call(
f"Acquired lock on {temp_dir}/openvas/feed-update.lock"
),
call(
"Downloading Notus files from "
"rsync://feed.community.greenbone.net/community/"
f"vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/notus/ "
f"to {temp_dir}/notus"
),
call(),
call(
"Downloading NASL files from "
"rsync://feed.community.greenbone.net/community/"
f"vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/nasl/ "
f"to {temp_dir}/openvas/plugins"
),
call(),
call(
f"Releasing lock on {temp_dir}/openvas/feed-update.lock"
),
call(),
]
)
rsync_mock_instance.sync.assert_has_awaits(
[
call(
url="rsync://feed.community.greenbone.net/community/"
f"vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/notus/",
destination=temp_dir / "notus",
),
call(
url="rsync://feed.community.greenbone.net/community/"
f"vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/nasl/",
destination=temp_dir / "openvas/plugins",
),
]
)
@patch("greenbone.feed.sync.main.Rsync", autospec=True)
async def test_sync_nvts_quiet(self, rsync_mock: MagicMock):
console = MagicMock()
rsync_mock_instance = rsync_mock.return_value
with (
temp_directory() as temp_dir,
patch.dict(
"os.environ",
{"GREENBONE_FEED_SYNC_DESTINATION_PREFIX": str(temp_dir)},
),
patch.object(
sys,
"argv",
["greenbone-feed-sync", "--type", "nvt", "--quiet"],
),
):
ret = await feed_sync(console=console, error_console=console)
self.assertEqual(ret, 0)
rsync_mock.assert_called_once_with(
private_subdir=None,
verbose=False,
compression_level=9,
ssh_key=Path("/etc/gvm/greenbone-enterprise-feed-key"),
)
console.print.assert_not_called()
rsync_mock_instance.sync.assert_has_awaits(
[
call(
url="rsync://feed.community.greenbone.net/community/"
f"vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/notus/",
destination=temp_dir / "notus",
),
call(
url="rsync://feed.community.greenbone.net/community/"
f"vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/nasl/",
destination=temp_dir / "openvas/plugins",
),
]
)
@patch("greenbone.feed.sync.main.Rsync", autospec=True)
async def test_sync_nvts_rsync_error(self, rsync_mock: MagicMock):
console = MagicMock()
rsync_mock_instance = rsync_mock.return_value
rsync_mock_instance.sync.side_effect = RsyncError(
2, [], b"An rsync error"
)
with (
temp_directory() as temp_dir,
patch.dict(
"os.environ",
{"GREENBONE_FEED_SYNC_DESTINATION_PREFIX": str(temp_dir)},
),
patch.object(
sys,
"argv",
["greenbone-feed-sync", "--type", "nvt", "--fail-fast"],
),
):
ret = await feed_sync(console=console, error_console=console)
self.assertEqual(ret, 1)
rsync_mock.assert_called_once_with(
private_subdir=None,
verbose=False,
compression_level=9,
ssh_key=Path("/etc/gvm/greenbone-enterprise-feed-key"),
)
console.print.assert_has_calls(
[
call(
"Trying to acquire lock on "
f"{temp_dir}/openvas/feed-update.lock"
),
call(
f"Acquired lock on {temp_dir}/openvas/feed-update.lock"
),
call("An rsync error"),
call(
f"Releasing lock on {temp_dir}/openvas/feed-update.lock"
),
]
)
rsync_mock_instance.sync.assert_has_awaits(
[
call(
url="rsync://feed.community.greenbone.net/community/"
f"vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/notus/",
destination=temp_dir / "notus",
),
]
)
class MainFunctionTestCase(unittest.TestCase):
@patch("greenbone.feed.sync.main.Console")
@patch("greenbone.feed.sync.main.Rsync", autospec=True)
def test_sync_nvts(self, rsync_mock: MagicMock, console_mock: MagicMock):
rsync_mock_instance = rsync_mock.return_value
console_mock_instance = console_mock.return_value
with (
temp_directory() as temp_dir,
patch.dict(
"os.environ",
{"GREENBONE_FEED_SYNC_DESTINATION_PREFIX": str(temp_dir)},
),
patch.object(
sys,
"argv",
[
"greenbone-feed-sync",
"--type",
"nvt",
],
),
):
with self.assertRaises(SystemExit) as cm:
main()
self.assertEqual(cm.exception.code, 0)
rsync_mock.assert_called_once_with(
private_subdir=None,
verbose=False,
compression_level=9,
ssh_key=Path("/etc/gvm/greenbone-enterprise-feed-key"),
)
console_mock_instance.print.assert_has_calls(
[
call(
"Trying to acquire lock on "
f"{temp_dir}/openvas/feed-update.lock"
),
call(
f"Acquired lock on {temp_dir}/openvas/feed-update.lock"
),
call(
f"Releasing lock on {temp_dir}/openvas/feed-update.lock"
),
call(),
]
)
rsync_mock_instance.sync.assert_has_awaits(
[
call(
url="rsync://feed.community.greenbone.net/community/"
f"vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/notus/",
destination=temp_dir / "notus",
),
call(
url="rsync://feed.community.greenbone.net/community/"
f"vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/nasl/",
destination=temp_dir / "openvas/plugins",
),
]
)
@patch("greenbone.feed.sync.main.Console")
@patch("greenbone.feed.sync.main.Rsync", autospec=True)
def test_sync_nvts_error(
self, rsync_mock: MagicMock, console_mock: MagicMock
):
rsync_mock_instance = rsync_mock.return_value
console_mock_instance = console_mock.return_value
rsync_mock_instance.sync.side_effect = GreenboneFeedSyncError(
"An error"
)
with (
temp_directory() as temp_dir,
patch.dict(
"os.environ",
{"GREENBONE_FEED_SYNC_DESTINATION_PREFIX": str(temp_dir)},
),
patch.object(
sys,
"argv",
["greenbone-feed-sync", "--type", "nvt", "--fail-fast"],
),
):
with self.assertRaises(SystemExit) as cm:
main()
self.assertEqual(cm.exception.code, 1)
rsync_mock.assert_called_once_with(
private_subdir=None,
verbose=False,
compression_level=9,
ssh_key=Path("/etc/gvm/greenbone-enterprise-feed-key"),
)
console_mock_instance.print.assert_has_calls(
[
call(
"Trying to acquire lock on "
f"{temp_dir}/openvas/feed-update.lock"
),
call(
f"Acquired lock on {temp_dir}/openvas/feed-update.lock"
),
call(
f"Releasing lock on {temp_dir}/openvas/feed-update.lock"
),
call("[red]❌[/red]Error: An error"),
]
)
rsync_mock_instance.sync.assert_has_awaits(
[
call(
url="rsync://feed.community.greenbone.net/community/"
f"vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/notus/",
destination=temp_dir / "notus",
),
]
)
greenbone-feed-sync-25.1.0/tests/test_parser.py 0000664 0000000 0000000 00000114145 14752631415 0021503 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2023-2024 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# pylint: disable=line-too-long, too-many-lines
import io
import sys
import unittest
from contextlib import redirect_stderr, redirect_stdout
from pathlib import Path
from unittest.mock import MagicMock, patch
from pontos.testing import temp_file
from greenbone.feed.sync.config import (
DEFAULT_CONFIG_FILE,
DEFAULT_DESTINATION_PREFIX,
DEFAULT_ENTERPRISE_KEY_PATH,
DEFAULT_FEED_RELEASE,
DEFAULT_GVMD_LOCK_FILE_PATH,
DEFAULT_OPENVAS_LOCK_FILE_PATH,
DEFAULT_USER_CONFIG_FILE,
)
from greenbone.feed.sync.errors import ConfigFileError
from greenbone.feed.sync.helper import DEFAULT_FLOCK_WAIT_INTERVAL
from greenbone.feed.sync.parser import CliParser, feed_type
from greenbone.feed.sync.rsync import (
DEFAULT_RSYNC_COMPRESSION_LEVEL,
DEFAULT_RSYNC_URL,
)
class FeedTypeTestCase(unittest.TestCase):
def test_nvt(self):
self.assertEqual("nvt", feed_type("nvt"))
self.assertEqual("nvt", feed_type("nvts"))
self.assertEqual("nvt", feed_type("NVT"))
self.assertEqual("nvt", feed_type("NVTS"))
def test_report_format(self):
self.assertEqual("report-format", feed_type("report-format"))
self.assertEqual("report-format", feed_type("report-formats"))
self.assertEqual("report-format", feed_type("report_format"))
self.assertEqual("report-format", feed_type("report_formats"))
self.assertEqual("report-format", feed_type("REPORT_FORMAT"))
self.assertEqual("report-format", feed_type("REPORT_FORMATS"))
self.assertEqual("report-format", feed_type("REPORT-FORMAT"))
self.assertEqual("report-format", feed_type("REPORT-FORMATS"))
def test_port_list(self):
self.assertEqual("port-list", feed_type("port-list"))
self.assertEqual("port-list", feed_type("port-lists"))
self.assertEqual("port-list", feed_type("port_list"))
self.assertEqual("port-list", feed_type("port_lists"))
self.assertEqual("port-list", feed_type("PORT_LIST"))
self.assertEqual("port-list", feed_type("PORT_LISTS"))
self.assertEqual("port-list", feed_type("PORT-LIST"))
self.assertEqual("port-list", feed_type("PORT-LISTS"))
def test_scan_config(self):
self.assertEqual("scan-config", feed_type("scan-config"))
self.assertEqual("scan-config", feed_type("scan-configs"))
self.assertEqual("scan-config", feed_type("scan_config"))
self.assertEqual("scan-config", feed_type("scan_configs"))
self.assertEqual("scan-config", feed_type("SCAN_CONFIG"))
self.assertEqual("scan-config", feed_type("SCAN_CONFIGS"))
self.assertEqual("scan-config", feed_type("SCAN-CONFIG"))
self.assertEqual("scan-config", feed_type("SCAN-CONFIGS"))
def test_gvmd_data(self):
self.assertEqual("gvmd-data", feed_type("gvmd-data"))
self.assertEqual("gvmd-data", feed_type("gvmd_data"))
self.assertEqual("gvmd-data", feed_type("GVMD-DATA"))
self.assertEqual("gvmd-data", feed_type("GVMD_DATA"))
class CliParserTestCase(unittest.TestCase):
def test_output_group(self):
parser = CliParser()
with redirect_stderr(io.StringIO()) as f, self.assertRaises(SystemExit):
parser.parse_arguments(["-vvv", "--quiet"])
self.assertIn(
"argument --quiet: not allowed with argument --verbose/-v",
f.getvalue(),
)
def test_wait_group(self):
parser = CliParser()
with redirect_stderr(io.StringIO()) as f, self.assertRaises(SystemExit):
parser.parse_arguments(["--no-wait", "--wait-interval", "20"])
self.assertIn(
"argument --wait-interval: not allowed with argument --no-wait",
f.getvalue(),
)
def test_defaults(self):
parser = CliParser()
args = parser.parse_arguments([])
self.assertEqual(args.type, "all")
self.assertEqual(
args.destination_prefix, Path(DEFAULT_DESTINATION_PREFIX)
)
self.assertEqual(args.feed_url, DEFAULT_RSYNC_URL)
self.assertEqual(
args.gvmd_data_destination,
Path(DEFAULT_DESTINATION_PREFIX) / "gvm" / "data-objects" / "gvmd",
)
self.assertEqual(
args.gvmd_data_url,
f"{DEFAULT_RSYNC_URL}/data-feed/{DEFAULT_FEED_RELEASE}/",
)
self.assertEqual(
args.notus_destination,
Path(DEFAULT_DESTINATION_PREFIX) / "notus",
)
self.assertEqual(
args.notus_url,
f"{DEFAULT_RSYNC_URL}/vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/notus/",
)
self.assertEqual(
args.nasl_destination,
Path(DEFAULT_DESTINATION_PREFIX) / "openvas" / "plugins",
)
self.assertEqual(
args.nasl_url,
f"{DEFAULT_RSYNC_URL}/vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/nasl/",
)
self.assertEqual(
args.scap_data_destination,
Path(DEFAULT_DESTINATION_PREFIX) / "gvm" / "scap-data",
)
self.assertEqual(
args.scap_data_url,
f"{DEFAULT_RSYNC_URL}/vulnerability-feed/{DEFAULT_FEED_RELEASE}/scap-data/",
)
self.assertEqual(
args.cert_data_destination,
Path(DEFAULT_DESTINATION_PREFIX) / "gvm" / "cert-data",
)
self.assertEqual(
args.cert_data_url,
f"{DEFAULT_RSYNC_URL}/vulnerability-feed/{DEFAULT_FEED_RELEASE}/cert-data/",
)
self.assertEqual(
args.report_formats_destination,
Path(DEFAULT_DESTINATION_PREFIX)
/ "gvm"
/ "data-objects"
/ "gvmd"
/ "report-formats",
)
self.assertEqual(
args.report_formats_url,
f"{DEFAULT_RSYNC_URL}/data-feed/{DEFAULT_FEED_RELEASE}/report-formats/",
)
self.assertEqual(
args.scan_configs_destination,
Path(DEFAULT_DESTINATION_PREFIX)
/ "gvm"
/ "data-objects"
/ "gvmd"
/ "scan-configs",
)
self.assertEqual(
args.scan_configs_url,
f"{DEFAULT_RSYNC_URL}/data-feed/{DEFAULT_FEED_RELEASE}/scan-configs/",
)
self.assertEqual(
args.port_lists_destination,
Path(DEFAULT_DESTINATION_PREFIX)
/ "gvm"
/ "data-objects"
/ "gvmd"
/ "port-lists",
)
self.assertEqual(
args.port_lists_url,
f"{DEFAULT_RSYNC_URL}/data-feed/{DEFAULT_FEED_RELEASE}/port-lists/",
)
self.assertEqual(
args.gvmd_lock_file,
Path(DEFAULT_DESTINATION_PREFIX) / DEFAULT_GVMD_LOCK_FILE_PATH,
)
self.assertEqual(
args.openvas_lock_file,
Path(DEFAULT_DESTINATION_PREFIX) / DEFAULT_OPENVAS_LOCK_FILE_PATH,
)
self.assertEqual(args.wait_interval, DEFAULT_FLOCK_WAIT_INTERVAL)
self.assertFalse(args.no_wait)
self.assertEqual(
args.compression_level, DEFAULT_RSYNC_COMPRESSION_LEVEL
)
self.assertIsNone(args.private_directory)
self.assertIsNone(args.verbose)
self.assertFalse(args.fail_fast)
self.assertIsNone(args.rsync_timeout)
self.assertEqual(
args.greenbone_enterprise_feed_key,
Path(DEFAULT_ENTERPRISE_KEY_PATH),
)
self.assertEqual(args.feed_release, DEFAULT_FEED_RELEASE)
def test_help(self):
parser = CliParser()
with (
redirect_stdout(io.StringIO()) as f,
self.assertRaises(SystemExit) as cm,
):
parser.parse_arguments(["--help"])
self.assertEqual(cm.exception.code, 0)
self.assertTrue(f.getvalue().startswith("usage: "))
def test_verbose(self):
parser = CliParser()
args = parser.parse_arguments(["-v"])
self.assertEqual(args.verbose, 1)
args = parser.parse_arguments(["--verbose"])
self.assertEqual(args.verbose, 1)
args = parser.parse_arguments(["-vv"])
self.assertEqual(args.verbose, 2)
args = parser.parse_arguments(["-vvv"])
self.assertEqual(args.verbose, 3)
args = parser.parse_arguments(["-vvvv"])
self.assertEqual(args.verbose, 4)
def test_quiet(self):
parser = CliParser()
args = parser.parse_arguments(["--quiet"])
self.assertTrue(args.quiet)
def test_selftest(self):
parser = CliParser()
args = parser.parse_arguments(["--selftest"])
self.assertTrue(args.selftest)
@patch("greenbone.feed.sync.parser.Path")
def test_use_default_config_files(self, path_mock):
path_mock_instance = path_mock.return_value
path_mock_instance.expanduser.return_value = path_mock_instance
path_mock_instance.resolve.return_value = path_mock_instance
path_mock_instance.exists.return_value = False
parser = CliParser()
parser.parse_arguments([])
path_mock.assert_any_call(DEFAULT_USER_CONFIG_FILE)
path_mock.assert_any_call(DEFAULT_CONFIG_FILE)
def test_private_directory(self):
parser = CliParser()
args = parser.parse_arguments(["--private-directory", "foobar"])
self.assertEqual(args.private_directory, Path("foobar"))
def test_compression_level(self):
parser = CliParser()
args = parser.parse_arguments(["--compression-level", "0"])
self.assertEqual(args.compression_level, 0)
args = parser.parse_arguments(["--compression-level", "1"])
self.assertEqual(args.compression_level, 1)
args = parser.parse_arguments(["--compression-level", "2"])
self.assertEqual(args.compression_level, 2)
args = parser.parse_arguments(["--compression-level", "3"])
self.assertEqual(args.compression_level, 3)
args = parser.parse_arguments(["--compression-level", "4"])
self.assertEqual(args.compression_level, 4)
args = parser.parse_arguments(["--compression-level", "5"])
self.assertEqual(args.compression_level, 5)
args = parser.parse_arguments(["--compression-level", "6"])
self.assertEqual(args.compression_level, 6)
args = parser.parse_arguments(["--compression-level", "7"])
self.assertEqual(args.compression_level, 7)
args = parser.parse_arguments(["--compression-level", "8"])
self.assertEqual(args.compression_level, 8)
args = parser.parse_arguments(["--compression-level", "9"])
self.assertEqual(args.compression_level, 9)
with redirect_stderr(io.StringIO()) as f, self.assertRaises(SystemExit):
parser.parse_arguments(["--compression-level", "10"])
self.assertIn(
"error: argument --compression-level: invalid choice:",
f.getvalue(),
)
def test_gvmd_data_destination(self):
parser = CliParser()
args = parser.parse_arguments(["--gvmd-data-destination", "foo/bar"])
self.assertEqual(args.gvmd_data_destination, Path("foo/bar"))
def test_gvmd_data_url(self):
parser = CliParser()
args = parser.parse_arguments(
["--gvmd-data-url", "rsync://foo.bar/gvmd-data"]
)
self.assertEqual(args.gvmd_data_url, "rsync://foo.bar/gvmd-data")
def test_notus_destination(self):
parser = CliParser()
args = parser.parse_arguments(["--notus-destination", "foo/bar"])
self.assertEqual(args.notus_destination, Path("foo/bar"))
def test_notus_url(self):
parser = CliParser()
args = parser.parse_arguments(["--notus-url", "rsync://foo.bar/notus"])
self.assertEqual(args.notus_url, "rsync://foo.bar/notus")
def test_nasl_destination(self):
parser = CliParser()
args = parser.parse_arguments(["--nasl-destination", "foo/bar"])
self.assertEqual(args.nasl_destination, Path("foo/bar"))
def test_nasl_url(self):
parser = CliParser()
args = parser.parse_arguments(["--nasl-url", "rsync://foo.bar/nasl"])
self.assertEqual(args.nasl_url, "rsync://foo.bar/nasl")
def test_scap_data_destination(self):
parser = CliParser()
args = parser.parse_arguments(["--scap-data-destination", "foo/bar"])
self.assertEqual(args.scap_data_destination, Path("foo/bar"))
def test_scap_data_url(self):
parser = CliParser()
args = parser.parse_arguments(
["--scap-data-url", "rsync://foo.bar/scap-data"]
)
self.assertEqual(args.scap_data_url, "rsync://foo.bar/scap-data")
def test_cert_data_destination(self):
parser = CliParser()
args = parser.parse_arguments(["--cert-data-destination", "foo/bar"])
self.assertEqual(args.cert_data_destination, Path("foo/bar"))
def test_cert_data_url(self):
parser = CliParser()
args = parser.parse_arguments(
["--cert-data-url", "rsync://foo.bar/cert-data"]
)
self.assertEqual(args.cert_data_url, "rsync://foo.bar/cert-data")
def test_report_formats_destination(self):
parser = CliParser()
args = parser.parse_arguments(
["--report-formats-destination", "foo/bar"]
)
self.assertEqual(args.report_formats_destination, Path("foo/bar"))
def test_report_formats_url(self):
parser = CliParser()
args = parser.parse_arguments(
["--report-formats-url", "rsync://foo.bar/report-formats"]
)
self.assertEqual(
args.report_formats_url, "rsync://foo.bar/report-formats"
)
def test_scan_configs_destination(self):
parser = CliParser()
args = parser.parse_arguments(["--scan-configs-destination", "foo/bar"])
self.assertEqual(args.scan_configs_destination, Path("foo/bar"))
def test_scan_configs_url(self):
parser = CliParser()
args = parser.parse_arguments(
["--scan-configs-url", "rsync://foo.bar/scan-configs"]
)
self.assertEqual(args.scan_configs_url, "rsync://foo.bar/scan-configs")
def test_port_lists_destination(self):
parser = CliParser()
args = parser.parse_arguments(["--port-lists-destination", "foo/bar"])
self.assertEqual(args.port_lists_destination, Path("foo/bar"))
def test_port_lists_url(self):
parser = CliParser()
args = parser.parse_arguments(
["--port-lists-url", "rsync://foo.bar/port-lists"]
)
self.assertEqual(args.port_lists_url, "rsync://foo.bar/port-lists")
def test_gvmd_lock_file(self):
parser = CliParser()
args = parser.parse_arguments(["--gvmd-lock-file", "/run/gvmd.lock"])
self.assertEqual(args.gvmd_lock_file, Path("/run/gvmd.lock"))
def test_openvas_lock_file(self):
parser = CliParser()
args = parser.parse_arguments(
["--openvas-lock-file", "/run/openvas.lock"]
)
self.assertEqual(args.openvas_lock_file, Path("/run/openvas.lock"))
def test_fail_fast(self):
parser = CliParser()
args = parser.parse_arguments(["--fail-fast"])
self.assertTrue(args.fail_fast)
args = parser.parse_arguments(["--failfast"])
self.assertTrue(args.fail_fast)
def test_no_wait(self):
parser = CliParser()
args = parser.parse_arguments(["--no-wait"])
self.assertTrue(args.no_wait)
def test_wait_interval(self):
parser = CliParser()
args = parser.parse_arguments(["--wait-interval", "100"])
self.assertEqual(args.wait_interval, 100)
def test_rsync_timeout(self):
parser = CliParser()
args = parser.parse_arguments(["--rsync-timeout", "120"])
self.assertEqual(args.rsync_timeout, 120)
def test_greenbone_enterprise_feed_key(self):
parser = CliParser()
args = parser.parse_arguments(
["--greenbone-enterprise-feed-key", "/tmp/some.key"]
)
self.assertEqual(
args.greenbone_enterprise_feed_key, Path("/tmp/some.key")
)
def test_other(self):
parser = CliParser()
with (
redirect_stderr(io.StringIO()) as f,
self.assertRaises(SystemExit) as cm,
):
parser.parse_arguments(["--foo-bar", "10"])
self.assertIn("error: unrecognized arguments: --foo-bar", f.getvalue())
self.assertEqual(cm.exception.code, 2)
@patch("greenbone.feed.sync.parser.Path")
def test_config(self, path_mock: MagicMock):
content = """[greenbone-feed-sync]
verbose = 3
feed-url = "rsync://foo.bar"
destination-prefix = "/usr/lib"
"""
path_mock_instance = path_mock.return_value
path_mock_instance.absolute.return_value = "/foo/bar/foo.toml"
path_mock_instance.expanduser.return_value = path_mock_instance
path_mock_instance.resolve.return_value = path_mock_instance
path_mock_instance.exists.return_value = True
path_mock_instance.read_text.return_value = content
parser = CliParser()
args = parser.parse_arguments(["--config", "foo.toml"])
self.assertEqual(args.verbose, 3)
self.assertEqual(args.feed_url, "rsync://foo.bar")
self.assertEqual(args.destination_prefix, Path("/usr/lib"))
@patch("greenbone.feed.sync.parser.Path")
def test_load_from_default_config(self, path_mock: MagicMock):
content = """[greenbone-feed-sync]
verbose = 3
feed-url = "rsync://foo.bar"
destination-prefix = "/usr/lib"
"""
path_mock_instance = path_mock.return_value
path_mock_instance.absolute.return_value = (
"/foo/bar/.config/greenbone-feed-sync.toml"
)
path_mock_instance.expanduser.return_value = path_mock_instance
path_mock_instance.resolve.return_value = path_mock_instance
path_mock_instance.exists.return_value = True
path_mock_instance.read_text.return_value = content
parser = CliParser()
args = parser.parse_arguments([])
self.assertEqual(args.verbose, 3)
self.assertEqual(args.feed_url, "rsync://foo.bar")
self.assertEqual(args.destination_prefix, Path("/usr/lib"))
@patch.dict(
"os.environ",
{
"GREENBONE_FEED_SYNC_DESTINATION_PREFIX": "/usr/lib",
"GREENBONE_FEED_SYNC_URL": "rsync://foo.bar",
"GREENBONE_FEED_SYNC_VERBOSE": "3",
},
)
def test_from_environment(self):
parser = CliParser()
args = parser.parse_arguments([])
self.assertEqual(args.verbose, 3)
self.assertEqual(args.feed_url, "rsync://foo.bar")
self.assertEqual(args.destination_prefix, Path("/usr/lib"))
@patch.dict(
"os.environ",
{
"GREENBONE_FEED_SYNC_DESTINATION_PREFIX": "/usr/lib",
"GREENBONE_FEED_SYNC_URL": "rsync://foo.bar",
"GREENBONE_FEED_SYNC_VERBOSE": "3",
},
)
@patch("greenbone.feed.sync.parser.Path")
def test_environment_takes_precedence(self, path_mock):
content = """[greenbone-feed-sync]
verbose = 9
feed-url = "rsync://lorem.ipsum"
destination-prefix = "/opt/lib"
wait-interval = 100
"""
path_mock_instance = path_mock.return_value
path_mock_instance.absolute.return_value = (
"/foo/bar/.config/greenbone-feed-sync.toml"
)
path_mock_instance.expanduser.return_value = path_mock_instance
path_mock_instance.resolve.return_value = path_mock_instance
path_mock_instance.exists.return_value = True
path_mock_instance.read_text.return_value = content
parser = CliParser()
args = parser.parse_arguments([])
self.assertEqual(args.verbose, 3)
self.assertEqual(args.feed_url, "rsync://foo.bar")
self.assertEqual(args.destination_prefix, Path("/usr/lib"))
self.assertEqual(args.wait_interval, 100)
@patch.dict(
"os.environ",
{
"GREENBONE_FEED_SYNC_DESTINATION_PREFIX": "/usr/lib",
"GREENBONE_FEED_SYNC_URL": "rsync://foo.bar",
"GREENBONE_FEED_SYNC_VERBOSE": "3",
},
)
@patch("greenbone.feed.sync.parser.Path")
def test_argument_takes_precedence(self, path_mock):
content = """[greenbone-feed-sync]
verbose = 9
feed-url = "rsync://lorem.ipsum"
destination-prefix = "/opt/lib"
wait-interval = 100
"""
path_mock_instance = path_mock.return_value
path_mock_instance.absolute.return_value = (
"/foo/bar/.config/greenbone-feed-sync.toml"
)
path_mock_instance.expanduser.return_value = path_mock_instance
path_mock_instance.resolve.return_value = path_mock_instance
path_mock_instance.exists.return_value = True
path_mock_instance.read_text.return_value = content
parser = CliParser()
args = parser.parse_arguments(
[
"--wait-interval",
"90",
]
)
self.assertEqual(args.verbose, 3)
self.assertEqual(args.feed_url, "rsync://foo.bar")
self.assertEqual(args.destination_prefix, Path("/usr/lib"))
self.assertEqual(args.wait_interval, 90)
def test_config_file_not_exists(self):
parser = CliParser()
with self.assertRaisesRegex(
ConfigFileError, "Config file foo.bar does not exist."
):
parser.parse_arguments(["--config", "foo.bar"])
def test_type(self):
parser = CliParser()
args = parser.parse_arguments(["--type", "nvt"])
self.assertEqual(args.type, "nvt")
args = parser.parse_arguments(["--type", "nvts"])
self.assertEqual(args.type, "nvt")
args = parser.parse_arguments(["--type", "NVT"])
self.assertEqual(args.type, "nvt")
args = parser.parse_arguments(["--type", "NVTS"])
self.assertEqual(args.type, "nvt")
args = parser.parse_arguments(["--type", "notus"])
self.assertEqual(args.type, "notus")
args = parser.parse_arguments(["--type", "NOTUS"])
self.assertEqual(args.type, "notus")
args = parser.parse_arguments(["--type", "NoTuS"])
self.assertEqual(args.type, "notus")
args = parser.parse_arguments(["--type", "nasl"])
self.assertEqual(args.type, "nasl")
args = parser.parse_arguments(["--type", "NASL"])
self.assertEqual(args.type, "nasl")
args = parser.parse_arguments(["--type", "NaSl"])
self.assertEqual(args.type, "nasl")
args = parser.parse_arguments(["--type", "scap"])
self.assertEqual(args.type, "scap")
args = parser.parse_arguments(["--type", "SCAP"])
self.assertEqual(args.type, "scap")
args = parser.parse_arguments(["--type", "ScAp"])
self.assertEqual(args.type, "scap")
args = parser.parse_arguments(["--type", "cert"])
self.assertEqual(args.type, "cert")
args = parser.parse_arguments(["--type", "CERT"])
self.assertEqual(args.type, "cert")
args = parser.parse_arguments(["--type", "CeRt"])
self.assertEqual(args.type, "cert")
args = parser.parse_arguments(["--type", "all"])
self.assertEqual(args.type, "all")
args = parser.parse_arguments(["--type", "ALL"])
self.assertEqual(args.type, "all")
args = parser.parse_arguments(["--type", "AlL"])
self.assertEqual(args.type, "all")
args = parser.parse_arguments(["--type", "report-format"])
self.assertEqual(args.type, "report-format")
args = parser.parse_arguments(["--type", "REPORT-FORMAT"])
self.assertEqual(args.type, "report-format")
args = parser.parse_arguments(["--type", "report_format"])
self.assertEqual(args.type, "report-format")
args = parser.parse_arguments(["--type", "REPORT_FORMAT"])
self.assertEqual(args.type, "report-format")
args = parser.parse_arguments(["--type", "Report-Format"])
self.assertEqual(args.type, "report-format")
args = parser.parse_arguments(["--type", "report-formats"])
self.assertEqual(args.type, "report-format")
args = parser.parse_arguments(["--type", "REPORT_FORMATS"])
self.assertEqual(args.type, "report-format")
args = parser.parse_arguments(["--type", "scan-config"])
self.assertEqual(args.type, "scan-config")
args = parser.parse_arguments(["--type", "SCAN-CONFIG"])
self.assertEqual(args.type, "scan-config")
args = parser.parse_arguments(["--type", "scan_config"])
self.assertEqual(args.type, "scan-config")
args = parser.parse_arguments(["--type", "SCAN_config"])
self.assertEqual(args.type, "scan-config")
args = parser.parse_arguments(["--type", "Scan-Config"])
self.assertEqual(args.type, "scan-config")
args = parser.parse_arguments(["--type", "scan-configs"])
self.assertEqual(args.type, "scan-config")
args = parser.parse_arguments(["--type", "SCAN_CONFIGS"])
self.assertEqual(args.type, "scan-config")
args = parser.parse_arguments(["--type", "port-list"])
self.assertEqual(args.type, "port-list")
args = parser.parse_arguments(["--type", "PORT-LIST"])
self.assertEqual(args.type, "port-list")
args = parser.parse_arguments(["--type", "port_list"])
self.assertEqual(args.type, "port-list")
args = parser.parse_arguments(["--type", "PORT_LIST"])
self.assertEqual(args.type, "port-list")
args = parser.parse_arguments(["--type", "port-list"])
self.assertEqual(args.type, "port-list")
args = parser.parse_arguments(["--type", "port-lists"])
self.assertEqual(args.type, "port-list")
args = parser.parse_arguments(["--type", "PORT_LISTS"])
self.assertEqual(args.type, "port-list")
args = parser.parse_arguments(["--type", "gvmd-data"])
self.assertEqual(args.type, "gvmd-data")
args = parser.parse_arguments(["--type", "GVMD-DATA"])
self.assertEqual(args.type, "gvmd-data")
args = parser.parse_arguments(["--type", "gvmd_data"])
self.assertEqual(args.type, "gvmd-data")
args = parser.parse_arguments(["--type", "GVMD_DATA"])
self.assertEqual(args.type, "gvmd-data")
args = parser.parse_arguments(["--type", "gvmd-data"])
self.assertEqual(args.type, "gvmd-data")
def test_group(self):
parser = CliParser()
args = parser.parse_arguments(["--group", "some_group"])
self.assertEqual(args.group, "some_group")
args = parser.parse_arguments(["--group", "123"])
self.assertEqual(args.group, 123)
def test_user(self):
parser = CliParser()
args = parser.parse_arguments(["--user", "some_user"])
self.assertEqual(args.user, "some_user")
args = parser.parse_arguments(["--user", "123"])
self.assertEqual(args.user, 123)
def test_feed_url_from_enterprise_feed_key(self):
parser = CliParser()
content = """a_user@some.feed.server:/feed/
Lorem ipsum dolor sit amet,
consetetur sadipscing elitr,
sed diam nonumy eirmod tempor
"""
with temp_file(content=content, name="enterprise.key") as f:
args = parser.parse_arguments(
["--greenbone-enterprise-feed-key", str(f)]
)
self.assertEqual(
args.feed_url, "ssh://a_user@some.feed.server/enterprise"
)
self.assertEqual(
args.gvmd_data_url,
f"ssh://a_user@some.feed.server/enterprise/data-feed/{DEFAULT_FEED_RELEASE}/",
)
self.assertEqual(
args.port_lists_url,
f"ssh://a_user@some.feed.server/enterprise/data-feed/{DEFAULT_FEED_RELEASE}/port-lists/",
)
self.assertEqual(
args.report_formats_url,
f"ssh://a_user@some.feed.server/enterprise/data-feed/{DEFAULT_FEED_RELEASE}/report-formats/",
)
self.assertEqual(
args.scan_configs_url,
f"ssh://a_user@some.feed.server/enterprise/data-feed/{DEFAULT_FEED_RELEASE}/scan-configs/",
)
self.assertEqual(
args.notus_url,
f"ssh://a_user@some.feed.server/enterprise/vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/notus/",
)
self.assertEqual(
args.nasl_url,
f"ssh://a_user@some.feed.server/enterprise/vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/nasl/",
)
self.assertEqual(
args.scap_data_url,
f"ssh://a_user@some.feed.server/enterprise/vulnerability-feed/{DEFAULT_FEED_RELEASE}/scap-data/",
)
self.assertEqual(
args.cert_data_url,
f"ssh://a_user@some.feed.server/enterprise/vulnerability-feed/{DEFAULT_FEED_RELEASE}/cert-data/",
)
def test_ignore_non_existing_enterprise_feed_key(self):
parser = CliParser()
args = parser.parse_arguments(
["--greenbone-enterprise-feed-key", "/tmp/some.key"]
)
self.assertEqual(
args.feed_url, "rsync://feed.community.greenbone.net/community"
)
self.assertEqual(
args.gvmd_data_url,
f"rsync://feed.community.greenbone.net/community/data-feed/{DEFAULT_FEED_RELEASE}/",
)
self.assertEqual(
args.port_lists_url,
f"rsync://feed.community.greenbone.net/community/data-feed/{DEFAULT_FEED_RELEASE}/port-lists/",
)
self.assertEqual(
args.report_formats_url,
f"rsync://feed.community.greenbone.net/community/data-feed/{DEFAULT_FEED_RELEASE}/report-formats/",
)
self.assertEqual(
args.scan_configs_url,
f"rsync://feed.community.greenbone.net/community/data-feed/{DEFAULT_FEED_RELEASE}/scan-configs/",
)
self.assertEqual(
args.notus_url,
f"rsync://feed.community.greenbone.net/community/vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/notus/",
)
self.assertEqual(
args.nasl_url,
f"rsync://feed.community.greenbone.net/community/vulnerability-feed/{DEFAULT_FEED_RELEASE}/vt-data/nasl/",
)
self.assertEqual(
args.scap_data_url,
f"rsync://feed.community.greenbone.net/community/vulnerability-feed/{DEFAULT_FEED_RELEASE}/scap-data/",
)
self.assertEqual(
args.cert_data_url,
f"rsync://feed.community.greenbone.net/community/vulnerability-feed/{DEFAULT_FEED_RELEASE}/cert-data/",
)
@patch.object(sys, "argv", ["greenbone-nvt-sync"])
def test_greenbone_nvt_sync(self):
parser = CliParser()
args = parser.parse_arguments([])
self.assertEqual(args.type, "nvt")
@patch.object(sys, "argv", ["greenbone-scapdata-sync"])
def test_greenbone_scap_data_sync(self):
parser = CliParser()
args = parser.parse_arguments([])
self.assertEqual(args.type, "scap")
@patch.object(sys, "argv", ["greenbone-certdata-sync"])
def test_greenbone_cert_data_sync(self):
parser = CliParser()
args = parser.parse_arguments([])
self.assertEqual(args.type, "cert")
def test_feed_release(self):
parser = CliParser()
feed_release = "1.2.3"
args = parser.parse_arguments(["--feed-release", feed_release])
self.assertTrue(args.feed_release, "1.2.3")
self.assertEqual(
args.feed_url, "rsync://feed.community.greenbone.net/community"
)
self.assertEqual(
args.gvmd_data_url,
f"rsync://feed.community.greenbone.net/community/data-feed/{feed_release}/",
)
self.assertEqual(
args.port_lists_url,
f"rsync://feed.community.greenbone.net/community/data-feed/{feed_release}/port-lists/",
)
self.assertEqual(
args.report_formats_url,
f"rsync://feed.community.greenbone.net/community/data-feed/{feed_release}/report-formats/",
)
self.assertEqual(
args.scan_configs_url,
f"rsync://feed.community.greenbone.net/community/data-feed/{feed_release}/scan-configs/",
)
self.assertEqual(
args.notus_url,
f"rsync://feed.community.greenbone.net/community/vulnerability-feed/{feed_release}/vt-data/notus/",
)
self.assertEqual(
args.nasl_url,
f"rsync://feed.community.greenbone.net/community/vulnerability-feed/{feed_release}/vt-data/nasl/",
)
self.assertEqual(
args.scap_data_url,
f"rsync://feed.community.greenbone.net/community/vulnerability-feed/{feed_release}/scap-data/",
)
self.assertEqual(
args.cert_data_url,
f"rsync://feed.community.greenbone.net/community/vulnerability-feed/{feed_release}/cert-data/",
)
def test_feed_version(self):
parser = CliParser()
feed_release = "1.2.3"
args = parser.parse_arguments(["--feed-version", feed_release])
self.assertTrue(args.feed_version, "1.2.3")
self.assertTrue(args.feed_release, "1.2.3")
self.assertEqual(
args.feed_url, "rsync://feed.community.greenbone.net/community"
)
self.assertEqual(
args.gvmd_data_url,
f"rsync://feed.community.greenbone.net/community/data-feed/{feed_release}/",
)
self.assertEqual(
args.port_lists_url,
f"rsync://feed.community.greenbone.net/community/data-feed/{feed_release}/port-lists/",
)
self.assertEqual(
args.report_formats_url,
f"rsync://feed.community.greenbone.net/community/data-feed/{feed_release}/report-formats/",
)
self.assertEqual(
args.scan_configs_url,
f"rsync://feed.community.greenbone.net/community/data-feed/{feed_release}/scan-configs/",
)
self.assertEqual(
args.notus_url,
f"rsync://feed.community.greenbone.net/community/vulnerability-feed/{feed_release}/vt-data/notus/",
)
self.assertEqual(
args.nasl_url,
f"rsync://feed.community.greenbone.net/community/vulnerability-feed/{feed_release}/vt-data/nasl/",
)
self.assertEqual(
args.scap_data_url,
f"rsync://feed.community.greenbone.net/community/vulnerability-feed/{feed_release}/scap-data/",
)
self.assertEqual(
args.cert_data_url,
f"rsync://feed.community.greenbone.net/community/vulnerability-feed/{feed_release}/cert-data/",
)
def test_feed_release_overrules_version(self):
parser = CliParser()
feed_release = "1.2.3"
args = parser.parse_arguments(
["--feed-version", "2.3.4", "--feed-release", feed_release]
)
self.assertTrue(args.feed_version, "2.3.4")
self.assertTrue(args.feed_release, "1.2.3")
self.assertEqual(
args.feed_url, "rsync://feed.community.greenbone.net/community"
)
self.assertEqual(
args.gvmd_data_url,
f"rsync://feed.community.greenbone.net/community/data-feed/{feed_release}/",
)
self.assertEqual(
args.port_lists_url,
f"rsync://feed.community.greenbone.net/community/data-feed/{feed_release}/port-lists/",
)
self.assertEqual(
args.report_formats_url,
f"rsync://feed.community.greenbone.net/community/data-feed/{feed_release}/report-formats/",
)
self.assertEqual(
args.scan_configs_url,
f"rsync://feed.community.greenbone.net/community/data-feed/{feed_release}/scan-configs/",
)
self.assertEqual(
args.notus_url,
f"rsync://feed.community.greenbone.net/community/vulnerability-feed/{feed_release}/vt-data/notus/",
)
self.assertEqual(
args.nasl_url,
f"rsync://feed.community.greenbone.net/community/vulnerability-feed/{feed_release}/vt-data/nasl/",
)
self.assertEqual(
args.scap_data_url,
f"rsync://feed.community.greenbone.net/community/vulnerability-feed/{feed_release}/scap-data/",
)
self.assertEqual(
args.cert_data_url,
f"rsync://feed.community.greenbone.net/community/vulnerability-feed/{feed_release}/cert-data/",
)
def test_destination_prefix(self):
parser = CliParser()
destination_prefix = "/tmp/foo/bar"
args = parser.parse_arguments(
["--destination-prefix", destination_prefix]
)
self.assertEqual(args.type, "all")
self.assertEqual(args.destination_prefix, Path(destination_prefix))
self.assertEqual(
args.gvmd_data_destination,
Path(destination_prefix) / "gvm" / "data-objects" / "gvmd",
)
self.assertEqual(
args.notus_destination,
Path(destination_prefix) / "notus",
)
self.assertEqual(
args.nasl_destination,
Path(destination_prefix) / "openvas" / "plugins",
)
self.assertEqual(
args.scap_data_destination,
Path(destination_prefix) / "gvm" / "scap-data",
)
self.assertEqual(
args.cert_data_destination,
Path(destination_prefix) / "gvm" / "cert-data",
)
self.assertEqual(
args.report_formats_destination,
Path(destination_prefix)
/ "gvm"
/ "data-objects"
/ "gvmd"
/ "report-formats",
)
self.assertEqual(
args.scan_configs_destination,
Path(destination_prefix)
/ "gvm"
/ "data-objects"
/ "gvmd"
/ "scan-configs",
)
self.assertEqual(
args.port_lists_destination,
Path(destination_prefix)
/ "gvm"
/ "data-objects"
/ "gvmd"
/ "port-lists",
)
self.assertEqual(
args.gvmd_lock_file,
Path(destination_prefix) / DEFAULT_GVMD_LOCK_FILE_PATH,
)
self.assertEqual(
args.openvas_lock_file,
Path(destination_prefix) / DEFAULT_OPENVAS_LOCK_FILE_PATH,
)
greenbone-feed-sync-25.1.0/tests/test_rsync.py 0000664 0000000 0000000 00000016355 14752631415 0021351 0 ustar 00root root 0000000 0000000 # SPDX-FileCopyrightText: 2023-2024 Greenbone AG
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
import asyncio
import unittest
from asyncio.subprocess import Process
from pathlib import Path
from unittest.mock import AsyncMock, patch
from greenbone.feed.sync.errors import RsyncError
from greenbone.feed.sync.rsync import Rsync, exec_rsync
class RsyncTestCase(unittest.IsolatedAsyncioTestCase):
@patch("greenbone.feed.sync.rsync.exec_rsync", autospec=True)
async def test_rsync_with_defaults(self, exec_mock: AsyncMock):
rsync = Rsync()
await rsync.sync("rsync://foo.bar/baz", "/tmp/baz")
exec_mock.assert_awaited_once_with(
"--links",
"--times",
"--omit-dir-times",
"--recursive",
"--partial",
"--progress",
"-q",
"--compress-level=9",
"--delete",
"--perms",
"--chmod=Fugo+r,Fug+w,Dugo-s,Dugo+rx,Dug+w",
"--copy-unsafe-links",
"--hard-links",
"rsync://foo.bar/baz",
"/tmp/baz",
)
@patch("greenbone.feed.sync.rsync.exec_rsync", autospec=True)
async def test_rsync_with_private_subdir(self, exec_mock: AsyncMock):
rsync = Rsync(private_subdir="private")
await rsync.sync("rsync://foo.bar/baz", "/tmp/baz")
exec_mock.assert_awaited_once_with(
"--links",
"--times",
"--omit-dir-times",
"--recursive",
"--partial",
"--progress",
"-q",
"--compress-level=9",
"--delete",
"--exclude",
"private",
"--perms",
"--chmod=Fugo+r,Fug+w,Dugo-s,Dugo+rx,Dug+w",
"--copy-unsafe-links",
"--hard-links",
"rsync://foo.bar/baz",
"/tmp/baz",
)
@patch("greenbone.feed.sync.rsync.exec_rsync", autospec=True)
async def test_rsync_with_verbose(self, exec_mock: AsyncMock):
rsync = Rsync(verbose=True)
await rsync.sync("rsync://foo.bar/baz", "/tmp/baz")
exec_mock.assert_awaited_once_with(
"--links",
"--times",
"--omit-dir-times",
"--recursive",
"--partial",
"--progress",
"-v",
"--compress-level=9",
"--delete",
"--perms",
"--chmod=Fugo+r,Fug+w,Dugo-s,Dugo+rx,Dug+w",
"--copy-unsafe-links",
"--hard-links",
"rsync://foo.bar/baz",
"/tmp/baz",
)
@patch("greenbone.feed.sync.rsync.exec_rsync", autospec=True)
async def test_rsync_with_compression_level(self, exec_mock: AsyncMock):
rsync = Rsync(compression_level=1)
await rsync.sync("rsync://foo.bar/baz", "/tmp/baz")
exec_mock.assert_awaited_once_with(
"--links",
"--times",
"--omit-dir-times",
"--recursive",
"--partial",
"--progress",
"-q",
"--compress-level=1",
"--delete",
"--perms",
"--chmod=Fugo+r,Fug+w,Dugo-s,Dugo+rx,Dug+w",
"--copy-unsafe-links",
"--hard-links",
"rsync://foo.bar/baz",
"/tmp/baz",
)
@patch("greenbone.feed.sync.rsync.exec_rsync", autospec=True)
async def test_rsync_with_exclude(self, exec_mock: AsyncMock):
rsync = Rsync(exclude=["foo", Path("exclude/this")])
await rsync.sync("rsync://foo.bar/baz", "/tmp/baz")
exec_mock.assert_awaited_once_with(
"--links",
"--times",
"--omit-dir-times",
"--recursive",
"--partial",
"--progress",
"-q",
"--compress-level=9",
"--delete",
"--exclude",
"foo",
"--exclude",
"exclude/this",
"--perms",
"--chmod=Fugo+r,Fug+w,Dugo-s,Dugo+rx,Dug+w",
"--copy-unsafe-links",
"--hard-links",
"rsync://foo.bar/baz",
"/tmp/baz",
)
class ExecRsyncTestCase(unittest.IsolatedAsyncioTestCase):
@patch(
"greenbone.feed.sync.rsync.asyncio.create_subprocess_exec",
autospec=True,
)
async def test_failure(self, exec_mock: AsyncMock):
process_mock = AsyncMock(spec=Process)
process_mock.communicate.return_value = (None, b"An error occurred")
process_mock.wait.return_value = 1
exec_mock.return_value = process_mock
with self.assertRaises(RsyncError) as cm:
await exec_rsync("foo", "bar")
exec_mock.assert_awaited_once_with(
"rsync", "foo", "bar", stderr=asyncio.subprocess.PIPE
)
self.assertEqual(cm.exception.returncode, 1)
self.assertEqual(cm.exception.stderr, "An error occurred")
self.assertEqual(cm.exception.cmd, ["rsync", "foo", "bar"])
self.assertIsNone(cm.exception.stout)
self.assertEqual(
str(cm.exception),
"'rsync foo bar' returned non-zero exit status 1.",
)
@patch(
"greenbone.feed.sync.rsync.asyncio.create_subprocess_exec",
autospec=True,
)
async def test_success(self, exec_mock: AsyncMock):
process_mock = AsyncMock(spec=Process)
process_mock.communicate.return_value = (None, None)
process_mock.wait.return_value = 0
exec_mock.return_value = process_mock
await exec_rsync("foo", "bar")
exec_mock.assert_awaited_once_with(
"rsync", "foo", "bar", stderr=asyncio.subprocess.PIPE
)
@patch("greenbone.feed.sync.rsync.exec_rsync", autospec=True)
async def test_rsync_with_timeout(self, exec_mock: AsyncMock):
rsync = Rsync(timeout=120)
await rsync.sync("rsync://foo.bar/baz", "/tmp/baz")
exec_mock.assert_awaited_once_with(
"--links",
"--times",
"--omit-dir-times",
"--recursive",
"--partial",
"--progress",
"--timeout=120",
"-q",
"--compress-level=9",
"--delete",
"--perms",
"--chmod=Fugo+r,Fug+w,Dugo-s,Dugo+rx,Dug+w",
"--copy-unsafe-links",
"--hard-links",
"rsync://foo.bar/baz",
"/tmp/baz",
)
@patch("greenbone.feed.sync.rsync.exec_rsync", autospec=True)
async def test_rsync_with_ssh(self, exec_mock: AsyncMock):
ssh_key = Path("/tmp/ssh.key")
rsync = Rsync(ssh_key=ssh_key)
await rsync.sync("ssh://user@foo.bar/baz", "/tmp/baz")
exec_mock.assert_awaited_once_with(
"--links",
"--times",
"--omit-dir-times",
"--recursive",
"--partial",
"--progress",
"-e",
"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 24 -i '/tmp/ssh.key'", # pylint: disable=line-too-long # noqa: E501
"-q",
"--compress-level=9",
"--delete",
"--perms",
"--chmod=Fugo+r,Fug+w,Dugo-s,Dugo+rx,Dug+w",
"--copy-unsafe-links",
"--hard-links",
"user@foo.bar:/baz",
"/tmp/baz",
)