-
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.
- Loading branch information
0 parents
commit cdee143
Showing
285 changed files
with
60,962 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,59 @@ | ||
name: paradrop | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install Python Dependencies | ||
run: | | ||
make pip | ||
- name: Run Linters | ||
run: | | ||
make lint | ||
- name: Provision Paradrop Stack with Seed Data | ||
run: | | ||
make elk | ||
# Tests not working in GH Action seed data isn't working | ||
# - name: Test with Python unittest | ||
# run: | | ||
# make pytest | ||
|
||
- name: Build API and UI Containers | ||
run: | | ||
make cbuilds | ||
- name: Run Vulnerability Scanner on Paradrop_api image | ||
uses: aquasecurity/[email protected] | ||
with: | ||
image-ref: paradrop_api | ||
exit-code: 0 | ||
severity: HIGH,CRITICAL,UNKNOWN,LOW,MEDIUM | ||
|
||
- name: Run Vulnerability Scanner on Paradrop_ui image | ||
uses: aquasecurity/[email protected] | ||
with: | ||
image-ref: paradrop_ui | ||
exit-code: 0 | ||
severity: HIGH,CRITICAL,UNKNOWN,LOW,MEDIUM | ||
|
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,164 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
package-lock.json | ||
|
||
# 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/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
.pybuilder/ | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
# For a library or package, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# .python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# 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/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# pytype static type analyzer | ||
.pytype/ | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
*.key | ||
*.pem | ||
logs | ||
*.log | ||
|
||
*_log | ||
flask_session/ | ||
node_modules/ | ||
ui/static/css_min | ||
ui/static/js_min | ||
.vscode | ||
*.exe | ||
*.test | ||
*.prof | ||
cmon | ||
cmon.yml | ||
cmon-* | ||
vendor | ||
*.rpm | ||
*.deb | ||
.vagrant* | ||
*.box | ||
|
||
# macOS Specific | ||
.DS_Store |
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,106 @@ | ||
API_NAME := paradrop_api | ||
UI_NAME := paradrop_ui | ||
|
||
.PHONY: api elk superlinter develop docs | ||
|
||
default: docker | ||
|
||
mkcert: | ||
openssl req -x509 -newkey rsa:4096 -nodes -keyout ui/localhost.key -out ui/localhost.pem -days 365 -sha256 -subj '/CN=127.0.0.1' -addext 'subjectAltName=IP:127.0.0.1' | ||
cp -f ./ui/localhost.* ./api/ | ||
|
||
npm: | ||
cd ui && npm run test | ||
|
||
docs: | ||
cd docs && npm install | ||
|
||
docker: npm mkcert docs | ||
sudo docker compose down --remove-orphans | ||
sudo URL='https:\/\/127.0.0.1' docker compose up --build -d | ||
sleep 60 | ||
cd ./elk && ./seed.sh | ||
|
||
demo: npm mkcert docs | ||
sudo docker compose down --remove-orphans | ||
sudo URL='https:\/\/demo.paradrop.io' docker compose up --build -d | ||
sleep 60 | ||
cd ./elk && ./seed.sh | ||
|
||
develop: npm mkcert docs | ||
sudo docker compose down --remove-orphans | ||
sudo URL='https:\/\/develop.paradrop.io' docker compose up --build -d | ||
sleep 60 | ||
cd ./elk && ./seed.sh | ||
|
||
ui: npm | ||
./ui/http_server.py | ||
|
||
api: pip | ||
rm -f ./api/localhost.* | ||
./api/app.py | ||
|
||
down: | ||
sudo docker compose down --remove-orphans | ||
|
||
up: | ||
sudo URL='https:\/\/127.0.0.1' docker compose up --build -d | ||
|
||
seed: | ||
cd ./elk && ./seed.sh | ||
|
||
elk: | ||
sudo docker rm -f opensearch | ||
sudo docker rm -f opensearch_dashboards | ||
|
||
sudo docker run -d --restart=always --name opensearch -p 127.0.0.1:9200:9200 \ | ||
-e "discovery.type=single-node" -e "network.host=0.0.0.0" -e "http.cors.enabled=false" \ | ||
-v "${PWD}"/elk/internal_users.yml:/usr/share/opensearch/config/opensearch-security/internal_users.yml \ | ||
opensearchproject/opensearch:2.11.1 | ||
|
||
sleep 60 | ||
|
||
sudo docker run -d --restart=always --name opensearch_dashboards -p 127.0.0.1:5601:5601 \ | ||
-e "SERVER_HOST=0.0.0.0" \ | ||
-v "${PWD}"/elk/opensearch_dashboards.yml:/usr/share/opensearch-dashboards/config/opensearch_dashboards.yml \ | ||
opensearchproject/opensearch-dashboards:2.11.1 | ||
|
||
cd ./elk && ./seed.sh | ||
|
||
cbuilds: npm mkcert | ||
cd ./api && sudo docker build -t $(API_NAME) . | ||
cd ./ui && sudo docker build --build-arg URL='https:\/\/127.0.0.1' -t $(UI_NAME) . | ||
|
||
crun: elk cbuilds | ||
sudo docker rm -f "$(API_NAME)" | ||
sudo docker run -d --net=host --restart=always --name="$(API_NAME)" "$(API_NAME)" | ||
sudo docker rm -f "$(UI_NAME)" | ||
sudo docker run -d --net=host --restart=always --name="$(UI_NAME)" "$(UI_NAME)" | ||
|
||
clean: | ||
sudo docker compose down --remove-orphans | ||
sudo docker rm -f opensearch | ||
sudo docker rm -f opensearch_dashboards | ||
sudo docker rm -f paradrop_ui | ||
sudo docker rm -f paradrop_api | ||
sudo docker system prune -af | ||
rm -rf ./super-linter.log ./error_log.log ./api/error_log.log ./ui/package-lock.json ./build.log ./ui/build.log ./api/.pyre ./api/test_log ./api/test_log.log ./ui/static/css_min ./ui/static/js_min || true | ||
find . -type d -name '.mypy_cache' -exec rm -rf {} \; || true | ||
find . -type d -name 'flask_session' -exec rm -rf {} \; || true | ||
find . -type d -name '__pycache__' -exec rm -rf {} \; || true | ||
find . -type d -name 'node_modules' -exec rm -rf {} \; || true | ||
find . -type f -name 'localhost.*' -exec rm -f {} \; || true | ||
|
||
pip: | ||
pip3 install -r ./api/requirements.txt | ||
|
||
pytest: | ||
cd ./api && python3 -m unittest | ||
|
||
lint: | ||
pip3 install --upgrade autopep8 pyflakes pyre-check | ||
./lint.sh | ||
|
||
superlinter: | ||
sudo docker run --name=superlinter -e RUN_LOCAL=true -e VALIDATE_CSS=false -v $(PWD):/tmp/lint github/super-linter | ||
sudo docker logs superlinter 2>./superlinter.log |
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,63 @@ | ||
<p align="center"> | ||
<img width="214" height="42" src="./ui/static/assets/logo-red.png"> | ||
</p> | ||
|
||
<h3 align="center">Simple, Easy Infrastructure Scanning</h3> | ||
|
||
--- | ||
|
||
## Provision Elasticsearch and Kibana Docker Containers With Seed Data | ||
|
||
From your local terminal in the paradrop directory: | ||
|
||
```sh | ||
cd elk | ||
sudo ./seed.sh | ||
``` | ||
|
||
## Access Elasticsearch and Kibana | ||
|
||
Kibana - open your browser to <http://localhost:5601/> | ||
|
||
Username: `admin` | ||
|
||
Password: `dtYe2cKY2YtyBEJ49a` | ||
|
||
The same username and password is used to access Elasticsearch. | ||
|
||
Example GET request: | ||
|
||
```sh | ||
curl -k -u 'admin:dtYe2cKY2YtyBEJ49a' -H 'Content-Type: application/json' 'https://localhost:9200/' | ||
``` | ||
|
||
## Lint Code | ||
|
||
From your local terminal in the paradrop directory: | ||
|
||
```sh | ||
./lint.sh | ||
``` | ||
|
||
## Build API Docker Container | ||
|
||
From your local terminal in the paradrop directory: | ||
|
||
```sh | ||
sudo ./start.sh | ||
``` | ||
|
||
## Build UI Docker Container | ||
|
||
From your local terminal in the paradrop directory: | ||
|
||
```sh | ||
cd ui | ||
sudo ./start.sh | ||
``` | ||
|
||
## Default Username and Password In paradrop_users Index | ||
|
||
Username/Email: `[email protected]` | ||
|
||
Password: `Paradrop789!` |
Oops, something went wrong.