wazuhtester 0.1.0rc1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. wazuhtester-0.1.0rc1/.github/workflows/ci.yml +42 -0
  2. wazuhtester-0.1.0rc1/.github/workflows/codeql.yml +99 -0
  3. wazuhtester-0.1.0rc1/.github/workflows/devskim.yml +34 -0
  4. wazuhtester-0.1.0rc1/.github/workflows/publish.yml +162 -0
  5. wazuhtester-0.1.0rc1/.gitignore +215 -0
  6. wazuhtester-0.1.0rc1/LICENSE +339 -0
  7. wazuhtester-0.1.0rc1/PKG-INFO +590 -0
  8. wazuhtester-0.1.0rc1/README.md +220 -0
  9. wazuhtester-0.1.0rc1/ROADMAP.md +91 -0
  10. wazuhtester-0.1.0rc1/publish.ps1 +54 -0
  11. wazuhtester-0.1.0rc1/pyproject.toml +56 -0
  12. wazuhtester-0.1.0rc1/src/wazuhtester/__init__.py +53 -0
  13. wazuhtester-0.1.0rc1/src/wazuhtester/__main__.py +6 -0
  14. wazuhtester-0.1.0rc1/src/wazuhtester/api.py +70 -0
  15. wazuhtester-0.1.0rc1/src/wazuhtester/cli.py +93 -0
  16. wazuhtester-0.1.0rc1/src/wazuhtester/config.py +30 -0
  17. wazuhtester-0.1.0rc1/src/wazuhtester/errors.py +38 -0
  18. wazuhtester-0.1.0rc1/src/wazuhtester/logtest.py +18 -0
  19. wazuhtester-0.1.0rc1/src/wazuhtester/protocol.py +119 -0
  20. wazuhtester-0.1.0rc1/src/wazuhtester/py.typed +0 -0
  21. wazuhtester-0.1.0rc1/src/wazuhtester/pytest_plugin.py +114 -0
  22. wazuhtester-0.1.0rc1/src/wazuhtester/response.py +188 -0
  23. wazuhtester-0.1.0rc1/src/wazuhtester/session.py +120 -0
  24. wazuhtester-0.1.0rc1/tests/conftest.py +110 -0
  25. wazuhtester-0.1.0rc1/tests/test_api.py +116 -0
  26. wazuhtester-0.1.0rc1/tests/test_cli.py +132 -0
  27. wazuhtester-0.1.0rc1/tests/test_package.py +28 -0
  28. wazuhtester-0.1.0rc1/tests/test_protocol.py +137 -0
  29. wazuhtester-0.1.0rc1/tests/test_pytest_plugin.py +51 -0
  30. wazuhtester-0.1.0rc1/tests/test_response.py +166 -0
  31. wazuhtester-0.1.0rc1/tests/test_session.py +124 -0
@@ -0,0 +1,42 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
16
+ steps:
17
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
18
+
19
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
20
+ with:
21
+ python-version: ${{ matrix.python-version }}
22
+
23
+ - name: Install package with dev dependencies
24
+ run: |
25
+ python -m pip install --upgrade pip
26
+ pip install -e ".[dev]"
27
+
28
+ - name: Type check
29
+ run: mypy src/wazuhtester
30
+
31
+ - name: Test
32
+ run: pytest -v
33
+
34
+ - name: Build and smoke-test installed wheel
35
+ if: matrix.python-version == '3.13'
36
+ run: |
37
+ python -m pip install build
38
+ python -m build
39
+ python -m pip install --force-reinstall --no-deps dist/*.whl
40
+ python -c "from importlib.metadata import version; import wazuhtester; assert wazuhtester.__version__ == version('wazuhtester'); print(wazuhtester.__version__)"
41
+ wazuhtester --help
42
+ python -m wazuhtester --help
@@ -0,0 +1,99 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL Advanced"
13
+
14
+ on:
15
+ push:
16
+ branches: [ "main" ]
17
+ pull_request:
18
+ branches: [ "main" ]
19
+ schedule:
20
+ - cron: '30 3 * * 5'
21
+
22
+ jobs:
23
+ analyze:
24
+ name: Analyze (${{ matrix.language }})
25
+ # Runner size impacts CodeQL analysis time. To learn more, please see:
26
+ # - https://gh.io/recommended-hardware-resources-for-running-codeql
27
+ # - https://gh.io/supported-runners-and-hardware-resources
28
+ # - https://gh.io/using-larger-runners (GitHub.com only)
29
+ # Consider using larger runners or machines with greater resources for possible analysis time improvements.
30
+ runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
31
+ permissions:
32
+ # required for all workflows
33
+ security-events: write
34
+
35
+ # required to fetch internal or private CodeQL packs
36
+ packages: read
37
+
38
+ # only required for workflows in private repositories
39
+ actions: read
40
+ contents: read
41
+
42
+ strategy:
43
+ fail-fast: false
44
+ matrix:
45
+ include:
46
+ - language: python
47
+ build-mode: none
48
+ # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
49
+ # Use `c-cpp` to analyze code written in C, C++ or both
50
+ # Use 'java-kotlin' to analyze code written in Java, Kotlin or both
51
+ # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
52
+ # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
53
+ # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
54
+ # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
55
+ # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
56
+ steps:
57
+ - name: Checkout repository
58
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
59
+
60
+ # Add any setup steps before running the `github/codeql-action/init` action.
61
+ # This includes steps like installing compilers or runtimes (`actions/setup-node`
62
+ # or others). This is typically only required for manual builds.
63
+ # - name: Setup runtime (example)
64
+ # uses: actions/setup-example@v1
65
+
66
+ # Initializes the CodeQL tools for scanning.
67
+ - name: Initialize CodeQL
68
+ uses: github/codeql-action/init@1c5b675653bb5c22dbe9b12b556ec555138e09fd # v4.38.1
69
+ with:
70
+ languages: ${{ matrix.language }}
71
+ build-mode: ${{ matrix.build-mode }}
72
+ # If you wish to specify custom queries, you can do so here or in a config file.
73
+ # By default, queries listed here will override any specified in a config file.
74
+ # Prefix the list here with "+" to use these queries and those in the config file.
75
+
76
+ # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
77
+ # queries: security-extended,security-and-quality
78
+
79
+ # If the analyze step fails for one of the languages you are analyzing with
80
+ # "We were unable to automatically build your code", modify the matrix above
81
+ # to set the build mode to "manual" for that language. Then modify this step
82
+ # to build your code.
83
+ # ℹ️ Command-line programs to run using the OS shell.
84
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
85
+ - name: Run manual build steps
86
+ if: matrix.build-mode == 'manual'
87
+ shell: bash
88
+ run: |
89
+ echo 'If you are using a "manual" build mode for one or more of the' \
90
+ 'languages you are analyzing, replace this with the commands to build' \
91
+ 'your code, for example:'
92
+ echo ' make bootstrap'
93
+ echo ' make release'
94
+ exit 1
95
+
96
+ - name: Perform CodeQL Analysis
97
+ uses: github/codeql-action/analyze@1c5b675653bb5c22dbe9b12b556ec555138e09fd # v4.38.1
98
+ with:
99
+ category: "/language:${{matrix.language}}"
@@ -0,0 +1,34 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+
6
+ name: DevSkim
7
+
8
+ on:
9
+ push:
10
+ branches: [ "main" ]
11
+ pull_request:
12
+ branches: [ "main" ]
13
+ schedule:
14
+ - cron: '39 14 * * 4'
15
+
16
+ jobs:
17
+ lint:
18
+ name: DevSkim
19
+ runs-on: ubuntu-latest
20
+ permissions:
21
+ actions: read
22
+ contents: read
23
+ security-events: write
24
+ steps:
25
+ - name: Checkout code
26
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
27
+
28
+ - name: Run DevSkim scanner
29
+ uses: microsoft/DevSkim-Action@4b5047945a44163b94642a1cecc0d93a3f428cc6 # v1.0.16
30
+
31
+ - name: Upload DevSkim scan results to GitHub Security tab
32
+ uses: github/codeql-action/upload-sarif@1c5b675653bb5c22dbe9b12b556ec555138e09fd # v4.38.1
33
+ with:
34
+ sarif_file: devskim-results.sarif
@@ -0,0 +1,162 @@
1
+ name: Publish
2
+
3
+ # Uses PyPI Trusted Publishing (OIDC) - no API token stored in repository
4
+ # secrets. Requires a one-time manual step on pypi.org/test.pypi.org:
5
+ # add this repository + workflow file + environment name as a trusted
6
+ # publisher for the wazuhtester project.
7
+
8
+ on:
9
+ release:
10
+ types: [published]
11
+ workflow_dispatch:
12
+ inputs:
13
+ publish-testpypi:
14
+ description: Publish the qualified artifact to TestPyPI
15
+ required: true
16
+ default: false
17
+ type: boolean
18
+
19
+ jobs:
20
+ test:
21
+ runs-on: ubuntu-latest
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
26
+ steps:
27
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
28
+
29
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
30
+ with:
31
+ python-version: ${{ matrix.python-version }}
32
+
33
+ - name: Install package with dev dependencies
34
+ run: |
35
+ python -m pip install --upgrade pip
36
+ python -m pip install -e ".[dev]"
37
+
38
+ - name: Type check
39
+ run: mypy src/wazuhtester
40
+
41
+ - name: Test
42
+ run: pytest -v
43
+
44
+ build:
45
+ needs: test
46
+ runs-on: ubuntu-latest
47
+ steps:
48
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
49
+
50
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
51
+ with:
52
+ python-version: "3.12"
53
+
54
+ - name: Validate release tag version
55
+ if: github.event_name == 'release'
56
+ run: |
57
+ package_version=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
58
+ tag_version="${GITHUB_REF_NAME#v}"
59
+ test "$package_version" = "$tag_version" || {
60
+ echo "Release tag $GITHUB_REF_NAME does not match package version $package_version" >&2
61
+ exit 1
62
+ }
63
+
64
+ - name: Build sdist and wheel
65
+ run: |
66
+ python -m pip install --upgrade build
67
+ python -m build
68
+
69
+ - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
70
+ with:
71
+ name: dist
72
+ path: dist/
73
+
74
+ integration:
75
+ needs: build
76
+ runs-on: ubuntu-latest
77
+ steps:
78
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
79
+ with:
80
+ repository: zbalkan/wazuh-rule-tests
81
+ ref: main
82
+ path: rule-tests
83
+
84
+ - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
85
+ with:
86
+ python-version: "3.13"
87
+
88
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
89
+ with:
90
+ name: dist
91
+ path: dist/
92
+
93
+ - name: Install exact release candidate wheel
94
+ run: |
95
+ python -m pip install --upgrade pip
96
+ python -m pip install pytest "dist/"*.whl
97
+ python -c "import wazuhtester; print(wazuhtester.__version__)"
98
+ wazuhtester --help
99
+
100
+ - name: Install Wazuh manager
101
+ env:
102
+ WAZUH_VERSION: "4.14.8-1"
103
+ run: |
104
+ sudo apt-get update
105
+ sudo apt-get install -y curl gnupg apt-transport-https
106
+ curl -fsSL https://packages.wazuh.com/key/GPG-KEY-WAZUH |
107
+ gpg --dearmor |
108
+ sudo tee /usr/share/keyrings/wazuh.gpg >/dev/null
109
+ echo "deb [signed-by=/usr/share/keyrings/wazuh.gpg] https://packages.wazuh.com/4.x/apt/ stable main" |
110
+ sudo tee /etc/apt/sources.list.d/wazuh.list >/dev/null
111
+ sudo apt-get update
112
+ sudo apt-get install -y "wazuh-manager=$WAZUH_VERSION"
113
+ sudo systemctl enable --now wazuh-manager
114
+
115
+ - name: Wait for wazuh-logtest
116
+ run: |
117
+ for attempt in $(seq 1 120); do
118
+ if sudo test -S /var/ossec/queue/sockets/logtest; then
119
+ exit 0
120
+ fi
121
+ sleep 1
122
+ done
123
+ sudo systemctl status wazuh-manager --no-pager || true
124
+ sudo journalctl -u wazuh-manager --no-pager -n 100 || true
125
+ exit 1
126
+
127
+ - name: Run external regression corpus
128
+ run: |
129
+ python_path=$(command -v python)
130
+ sg wazuh -c "$python_path -m pytest rule-tests/tests -v --wazuh-require-logtest"
131
+
132
+ publish-testpypi:
133
+ if: github.event_name == 'workflow_dispatch' && inputs.publish-testpypi
134
+ needs: integration
135
+ runs-on: ubuntu-latest
136
+ environment: testpypi
137
+ permissions:
138
+ id-token: write
139
+ steps:
140
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
141
+ with:
142
+ name: dist
143
+ path: dist/
144
+
145
+ - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
146
+ with:
147
+ repository-url: https://test.pypi.org/legacy/
148
+
149
+ publish-pypi:
150
+ if: github.event_name == 'release' && !github.event.release.prerelease
151
+ needs: integration
152
+ runs-on: ubuntu-latest
153
+ environment: pypi
154
+ permissions:
155
+ id-token: write
156
+ steps:
157
+ - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
158
+ with:
159
+ name: dist
160
+ path: dist/
161
+
162
+ - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
@@ -0,0 +1,215 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # PyPI configuration file
207
+ .pypirc
208
+
209
+ # Marimo
210
+ marimo/_static/
211
+ marimo/_lsp/
212
+ __marimo__/
213
+
214
+ # Streamlit
215
+ .streamlit/secrets.toml