-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from vipyrsec/br/init-repo
Init project
- Loading branch information
Showing
35 changed files
with
986 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"features": { | ||
"ghcr.io/devcontainers/features/powershell:1": { | ||
"version": "1.3.4", | ||
"resolved": "ghcr.io/devcontainers/features/powershell@sha256:3645db9e9598f04fc405c8c38aac0d60561b5697cc2268f801ff88f0afe0ca6c", | ||
"integrity": "sha256:3645db9e9598f04fc405c8c38aac0d60561b5697cc2268f801ff88f0afe0ca6c" | ||
}, | ||
"ghcr.io/devcontainers/features/python:1": { | ||
"version": "1.4.2", | ||
"resolved": "ghcr.io/devcontainers/features/python@sha256:bf021f1800543f08bf029c449a3f25341be782b620802befa1f8e6ee51cf6cf6", | ||
"integrity": "sha256:bf021f1800543f08bf029c449a3f25341be782b620802befa1f8e6ee51cf6cf6" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"image": "mcr.microsoft.com/devcontainers/universal:2", | ||
"features": { | ||
"ghcr.io/devcontainers/features/python:1": { | ||
"version": "3.12", | ||
"installTools": false | ||
}, | ||
"ghcr.io/devcontainers/features/powershell:1": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "devcontainers" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
groups: | ||
ci-dependencies: | ||
patterns: | ||
- "*" | ||
|
||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
groups: | ||
python-dependencies: | ||
patterns: | ||
- "*" | ||
|
||
- package-ecosystem: "docker" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
groups: | ||
docker-dependencies: | ||
patterns: | ||
- "*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Container Build and Push | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v* | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
# This is used to complete the identity challenge | ||
# with sigstore/fulcio. | ||
id-token: write | ||
|
||
jobs: | ||
build-push: | ||
uses: darbiadev/.github/.github/workflows/docker-build-push.yaml@ea97d99e1520c46080c4c9032a69552e491474ac # v13.0.0 | ||
with: | ||
file-name: Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Dependency Review | ||
|
||
on: [ pull_request ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
dependency-review: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 | ||
|
||
- name: Dependency Review | ||
uses: actions/dependency-review-action@5bbc3ba658137598168acb2ab73b21c432dd411b # v4.2.5 | ||
with: | ||
config-file: darbiadev/.github/.github/dependency-review-config.yaml@main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: "Python CI" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
pre-commit: | ||
uses: darbiadev/.github/.github/workflows/generic-precommit.yaml@29197a38ef3741064f47b623ede0c1ad22402c57 # v13.0.3 | ||
|
||
lint: | ||
needs: pre-commit | ||
uses: darbiadev/.github/.github/workflows/python-lint.yaml@29197a38ef3741064f47b623ede0c1ad22402c57 # v13.0.3 | ||
|
||
test: | ||
needs: lint | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest ] | ||
python-version: [ "3.12" ] | ||
|
||
uses: darbiadev/.github/.github/workflows/python-test.yaml@29197a38ef3741064f47b623ede0c1ad22402c57 # v13.0.3 | ||
with: | ||
os: ${{ matrix.os }} | ||
python-version: ${{ matrix.python-version }} | ||
|
||
docs: | ||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
uses: darbiadev/.github/.github/workflows/github-pages-python-sphinx.yaml@29197a38ef3741064f47b623ede0c1ad22402c57 # v13.0.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: "Sentry release" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
sentry-release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: "Checkout repository" | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- name: "Create Sentry release" | ||
uses: getsentry/action-release@e769183448303de84c5a06aaaddf9da7be26d6c7 # v1.7.0 | ||
env: | ||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | ||
SENTRY_ORG: ${{ vars.SENTRY_ORG }} | ||
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }} | ||
with: | ||
version_prefix: "${{ vars.SENTRY_PROJECT }}@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# JetBrains | ||
.idea | ||
|
||
# Packaging | ||
*.egg-info | ||
dist | ||
|
||
# Cache | ||
__pycache__ | ||
|
||
# Docs | ||
docs/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-case-conflict | ||
- id: check-merge-conflict | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: check-json | ||
- id: trailing-whitespace | ||
args: [ --markdown-linebreak-ext=md ] | ||
- id: mixed-line-ending | ||
args: [ --fix=lf ] | ||
- id: end-of-file-fixer | ||
exclude: .devcontainer/devcontainer-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM python:3.12-slim@sha256:43a49c9cc2e614468e3d1a903aabe17a97a4c788c76cf5337b5cdc3535b07d4f | ||
|
||
# Define Git SHA build argument for sentry | ||
ARG git_sha="development" | ||
ENV GIT_SHA=$git_sha | ||
|
||
WORKDIR /home/zipalyzer | ||
|
||
COPY requirements/requirements.txt . | ||
RUN python -m pip install --requirement requirements.txt | ||
|
||
COPY pyproject.toml pyproject.toml | ||
COPY src/ src/ | ||
RUN python -m pip install . | ||
|
||
RUN adduser --disabled-password zipalyzer | ||
USER zipalyzer | ||
|
||
# HTTP | ||
EXPOSE 8080 | ||
|
||
CMD ["uvicorn", "zipalyzer.server:app", "--host", "0.0.0.0", "--port", "8080"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# zipalyzer-api | ||
|
||
An API for analyzing zip files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = source | ||
BUILDDIR = build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
@ECHO OFF | ||
|
||
pushd %~dp0 | ||
|
||
REM Command file for Sphinx documentation | ||
|
||
if "%SPHINXBUILD%" == "" ( | ||
set SPHINXBUILD=sphinx-build | ||
) | ||
set SOURCEDIR=source | ||
set BUILDDIR=build | ||
|
||
%SPHINXBUILD% >NUL 2>NUL | ||
if errorlevel 9009 ( | ||
echo. | ||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
echo.installed, then set the SPHINXBUILD environment variable to point | ||
echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
echo.may add the Sphinx directory to PATH. | ||
echo. | ||
echo.If you don't have Sphinx installed, grab it from | ||
echo.https://www.sphinx-doc.org/ | ||
exit /b 1 | ||
) | ||
|
||
if "%1" == "" goto help | ||
|
||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
goto end | ||
|
||
:help | ||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
||
:end | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Changelog | ||
========= | ||
|
||
- :release:`0.1.0 <3rd April 2023>` | ||
- :feature:`1` Initialize package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
"""Configuration file for the Sphinx documentation builder. | ||
For the full list of built-in configuration values, see the documentation: | ||
https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
""" | ||
|
||
from importlib.metadata import metadata | ||
|
||
project_metadata = metadata("zipalyzer") | ||
project: str = project_metadata["Name"] | ||
release: str = project_metadata["Version"] | ||
REPO_LINK: str = project_metadata["Project-URL"].replace("repository, ", "") | ||
copyright: str = "Vipyr Security" # noqa: A001 | ||
author: str = "Vipyr Security Developers" | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom | ||
# ones. | ||
extensions = [ | ||
"sphinx.ext.autodoc", | ||
"sphinx.ext.linkcode", | ||
"sphinx.ext.intersphinx", | ||
"sphinx.ext.napoleon", | ||
"autoapi.extension", | ||
"releases", | ||
] | ||
|
||
autoapi_type: str = "python" | ||
autoapi_dirs: list[str] = ["../../src"] | ||
|
||
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)} | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
templates_path: list[str] = ["_templates"] | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This pattern also affects html_static_path and html_extra_path. | ||
exclude_patterns: list[str] = ["_build", "Thumbs.db", ".DS_Store"] | ||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
html_theme: str = "furo" | ||
|
||
# Add any paths that contain custom static files (such as style sheets) here, | ||
# relative to this directory. They are copied after the builtin static files, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
html_static_path: list[str] = ["_static"] | ||
|
||
releases_github_path = REPO_LINK.removeprefix("https://github.com/") | ||
releases_release_uri = f"{REPO_LINK}/releases/tag/v%s" | ||
|
||
|
||
def linkcode_resolve(domain: str, info: dict) -> str | None: | ||
"""linkcode_resolve.""" | ||
if domain != "py": | ||
return None | ||
if not info["module"]: | ||
return None | ||
|
||
import importlib # noqa: PLC0415 | ||
import inspect # noqa: PLC0415 | ||
import types # noqa: PLC0415 | ||
|
||
mod = importlib.import_module(info["module"]) | ||
|
||
val = mod | ||
for k in info["fullname"].split("."): | ||
val = getattr(val, k, None) | ||
if val is None: | ||
break | ||
|
||
filename = info["module"].replace(".", "/") + ".py" | ||
|
||
if isinstance( | ||
val, | ||
types.ModuleType | ||
| types.MethodType | ||
| types.FunctionType | ||
| types.TracebackType | ||
| types.FrameType | ||
| types.CodeType, | ||
): | ||
try: | ||
lines, first = inspect.getsourcelines(val) | ||
last = first + len(lines) - 1 | ||
filename += f"#L{first}-L{last}" | ||
except (OSError, TypeError): | ||
pass | ||
|
||
return f"{REPO_LINK}/blob/main/src/{filename}" |
Oops, something went wrong.