Skip to content
Merged

V2 #8

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Crawler Settings
CRAWLER_CIDR=0.0.0.0/0 # Warning: This is a broad range; adjust as needed
CRAWLER_DISCOVERY_TOP_PORTS=1000 # Options: number (e.g., 100, 1000) or 'full'
CRAWLER_FINGERPRINT_FAST_MODE=false # true to only scan services default ports

# MAXMIND for GeoIP and ASN lookups
MAXMIND_ACCOUNT_ID=your_user_id_here
MAXMIND_LICENSE_KEY=your_license_key_here
98 changes: 81 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,92 @@
name: pre-commit checks
name: Go Tests

on:
pull_request:
push:
branches:
- main
branches: [ main, develop ]
paths:
- 'rigour/**'
- '.github/workflows/go-tests.yml'
pull_request:
branches: [ main, develop ]
paths:
- 'rigour/**'

jobs:
pre-commit:
test:
name: Test Go Services
runs-on: ubuntu-latest

strategy:
matrix:
go-version: ['1.25.5']

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: rigour/go.sum

- name: Install libpcap-dev
run: |
sudo apt-get update
sudo apt-get install -y libpcap-dev

- name: Verify dependencies
working-directory: ./rigour
run: |
go mod verify
go mod download

- name: Run go vet
working-directory: ./rigour
run: |
# Exclude third_party directory which contains code with testing.T/B calls from goroutines
go vet ./cmd/...
go vet ./internal/...
go vet ./pkg/...

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Run go fmt check
working-directory: ./rigour
run: |
fmt_output=$(gofmt -l .)
if [ -n "$fmt_output" ]; then
echo "The following files are not formatted:"
echo "$fmt_output"
exit 1
fi

- name: Install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Run tests
working-directory: ./rigour
run: |
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...

- name: Run pre-commit
run: pre-commit run --all-files
- name: Generate coverage report
working-directory: ./rigour
run: go tool cover -html=coverage.out -o coverage.html

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./rigour/coverage.out
flags: unittests
name: codecov-rigour
fail_ci_if_error: false

- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report-go${{ matrix.go-version }}
path: rigour/coverage.html

build:
name: Build Docker Images
runs-on: ubuntu-latest
needs: [test]

steps:
- name: Checkout code
uses: actions/checkout@v4
173 changes: 22 additions & 151 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,162 +1,33 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# MacOS filesysem files
.DS_Store

# C extensions
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# Test binary, built with `go test -c`
*.test

# 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
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Dependency directories (remove the comment below to include it)
# vendor/

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Go workspace file
go.work

# Translations
*.mo
*.pot
# Dev folders
.vscode
.idea

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# rigour binary
rigour/rigour

# 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

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
# env
.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/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
/data
34 changes: 0 additions & 34 deletions .pre-commit-config.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions .vscode/settings.json

This file was deleted.

Loading