Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Commit

Permalink
Contribute Invadium to Open Source
Browse files Browse the repository at this point in the history
Co-authored-by: Florian Keintzel <[email protected]>
Co-authored-by: Jakob Rathberger <[email protected]>
Co-authored-by: Markus Remplbauer <[email protected]>
  • Loading branch information
4 people committed Aug 31, 2022
0 parents commit 12537f3
Show file tree
Hide file tree
Showing 95 changed files with 13,489 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EditorConfig is awesome: https://EditorConfig.org

root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.py]
charset = utf-8
indent_size = 4
indent_style = space
trim_trailing_whitespace = true

[*.{js,jsx,ts,tsx,css}]
charset = utf-8
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ensure that all shell scripts have LF line endings
*.sh eol=lf
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This file is used to assign reviewers to PRs based on ownerships
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

* @blu3r4y @Magier @sachleitner
62 changes: 62 additions & 0 deletions .github/workflows/build-exploits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: build-exploits

on:
pull_request:
paths:
- "exploits/containers/**"
push:
branches:
- main
tags:
- v*
paths:
- "exploits/containers/**"

env:
SQLMAP_VERSION: 1.6.8
SQLMAP_IMAGE: ghcr.io/dynatrace-oss/invadium-sqlmap
NMAP_VERSION: 7.92
NMAP_IMAGE: ghcr.io/dynatrace-oss/invadium-nmap

jobs:
build-exploits:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push sqlmap
uses: docker/build-push-action@v3
with:
context: exploits/containers/sqlmap
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.SQLMAP_IMAGE }}:v${{ env.SQLMAP_VERSION }}
${{ env.SQLMAP_IMAGE }}:latest
build-args: |
SQLMAP_VERSION=${{ env.SQLMAP_VERSION }}
cache-from: type=registry,ref=${{ env.SQLMAP_IMAGE }}:buildcache
cache-to: type=registry,ref=${{ env.SQLMAP_IMAGE }}:buildcache,mode=max

- name: Build and push nmap
uses: docker/build-push-action@v3
with:
context: exploits/containers/nmap
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.NMAP_IMAGE }}:v${{ env.NMAP_VERSION }}
${{ env.NMAP_IMAGE }}:latest
build-args: |
NMAP_VERSION=${{ env.NMAP_VERSION }}
cache-from: type=registry,ref=${{ env.NMAP_IMAGE }}:buildcache
cache-to: type=registry,ref=${{ env.NMAP_IMAGE }}:buildcache,mode=max
139 changes: 139 additions & 0 deletions .github/workflows/build-invadium.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: build-invadium

on:
pull_request:
push:
branches:
- main
tags:
- v*

env:
BACKEND_IMAGE: ghcr.io/dynatrace-oss/invadium-backend
FRONTEND_IMAGE: ghcr.io/dynatrace-oss/invadium-frontend

jobs:
pre-commit-hooks:
runs-on: ubuntu-latest
container:
image: nikolaik/python-nodejs:python3.10-nodejs18
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Cache pip packages
id: cache-pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache npm packages
id: cache-npm
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache pre-commit environments
id: cache-pre-commit
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-
- name: Install pre-commit hooks
run: python -m pip install --upgrade pre-commit

- name: Install npm dependencies for frontend hooks
working-directory: frontend
run: npm install

- name: Run pre-commit hooks
run: pre-commit run -v --all-files --show-diff-on-failure

build-backend:
needs: pre-commit-hooks
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Extract metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.BACKEND_IMAGE }}
tags: |
type=sha
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push images
uses: docker/build-push-action@v3
with:
context: backend
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.BACKEND_IMAGE }}:buildcache
cache-to: type=registry,ref=${{ env.BACKEND_IMAGE }}:buildcache,mode=max

build-frontend:
needs: pre-commit-hooks
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Extract metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.FRONTEND_IMAGE }}
tags: |
type=sha
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push images
uses: docker/build-push-action@v3
with:
context: frontend
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.FRONTEND_IMAGE }}:buildcache
cache-to: type=registry,ref=${{ env.FRONTEND_IMAGE }}:buildcache,mode=max
95 changes: 95 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# (c) https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
######################################################################################

.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

# (c) https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
###############################################################################

**/.idea/

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
71 changes: 71 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
repos:
# general pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-case-conflict
- id: check-json
- id: check-toml
- id: check-xml
- id: check-yaml
args: [--allow-multiple-documents]
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: requirements-txt-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]

# license checks
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.3.0
hooks:
- id: insert-license
name: add license header (frontend)
files: (?<!\.config)\.[jt]sx?$
args: [--license-filepath, LICENSE_HEADER.txt, --comment-style, "//"]
- id: insert-license
name: add license header (backend)
files: (?<!__init__)\.py$
args: [--license-filepath, LICENSE_HEADER.txt, --comment-style, "#"]

# python projects
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
name: format imports with isort
language_version: python3
args: ["--profile", "black"]
files: \.py$
- repo: https://github.com/ambv/black
rev: 22.6.0
hooks:
- id: black
name: format with black
language_version: python3
files: \.py$
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
name: lint with flake8
args: [--config, tox.ini]
files: \.py$

# javascript and typescript projects
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier
name: format with prettier
files: ^frontend\/.*
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.21.0
hooks:
- id: eslint
name: lint with eslint
files: \.[jt]sx?$
types: [file]
Loading

0 comments on commit 12537f3

Please sign in to comment.