Skip to content
Merged
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
82 changes: 82 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ jobs:
- name: secrets-scanner
type: go
path: PROJECTS/intermediate/secrets-scanner
# Nim
- name: credential-enumeration
type: nim
path: PROJECTS/intermediate/credential-enumeration

defaults:
run:
Expand Down Expand Up @@ -147,6 +151,17 @@ jobs:
if: matrix.type == 'go'
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest

# Nim Setup
- name: Setup Nim
if: matrix.type == 'nim'
uses: jiro4989/setup-nim-action@v2
with:
nim-version: '2.2.x'

- name: Install nph
if: matrix.type == 'nim'
run: nimble install -y nph

# Ruff Linting
- name: Run ruff
if: matrix.type == 'ruff'
Expand Down Expand Up @@ -195,6 +210,37 @@ jobs:
cat golangci-output.txt
continue-on-error: true

# Nim Linting
- name: Run nph and nim check
if: matrix.type == 'nim'
id: nim
run: |
echo "Running nph format check..."
NPH_OK=true
NIM_OK=true
if nph --check src/ > nim-output.txt 2>&1; then
echo "nph: no formatting issues"
else
NPH_OK=false
echo "nph: formatting issues found"
fi
echo "Running nim check..."
if nim check src/harvester.nim >> nim-output.txt 2>&1; then
echo "nim check: passed"
else
NIM_OK=false
echo "nim check: failed"
fi
if [[ "$NPH_OK" == "true" && "$NIM_OK" == "true" ]]; then
echo "NIM_PASSED=true" >> $GITHUB_ENV
echo "All Nim checks passed!"
else
echo "NIM_PASSED=false" >> $GITHUB_ENV
echo "Nim checks found issues"
fi
cat nim-output.txt
continue-on-error: true

# Create Summary for Ruff
- name: Create Ruff Lint Summary
if: matrix.type == 'ruff'
Expand Down Expand Up @@ -288,6 +334,37 @@ jobs:
fi
} >> $GITHUB_STEP_SUMMARY

# Create Summary for Nim
- name: Create Nim Lint Summary
if: matrix.type == 'nim'
run: |
{
echo "## Lint Results: ${{ matrix.name }}"
echo ''

if [[ "${{ env.NIM_PASSED }}" == "true" ]]; then
echo '### nph + nim check: **Passed**'
echo 'No Nim issues found.'
else
echo '### nph + nim check: **Issues Found**'
echo '<details><summary>View Nim output</summary>'
echo ''
echo '```'
head -100 nim-output.txt
echo '```'
echo '</details>'
fi
echo ''

if [[ "${{ env.NIM_PASSED }}" == "true" ]]; then
echo '---'
echo '### All checks passed!'
else
echo '---'
echo '### Review the issues above'
fi
} >> $GITHUB_STEP_SUMMARY

# Exit with proper status
- name: Check lint status
run: |
Expand All @@ -306,5 +383,10 @@ jobs:
echo "Go lint checks failed"
exit 1
fi
elif [[ "${{ matrix.type }}" == "nim" ]]; then
if [[ "${{ env.NIM_PASSED }}" == "false" ]]; then
echo "Nim lint checks failed"
exit 1
fi
fi
echo "All lint checks passed"
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ repos:
files: ^PROJECTS/advanced/encrypted-p2p-chat/frontend/src/
pass_filenames: false

# Nim nph Checks
- repo: local
hooks:
- id: nph-credential-enumeration
name: nph check (credential-enumeration)
entry: bash -c 'cd PROJECTS/intermediate/credential-enumeration && nph --check src/'
language: system
files: ^PROJECTS/intermediate/credential-enumeration/src/
pass_filenames: false

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
Expand Down
Empty file.
10 changes: 10 additions & 0 deletions PROJECTS/intermediate/credential-enumeration/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ©AngelaMos | 2026
# .gitignore

docs/
bin/
nimcache/
credenum
*.exe
*.out
tests/docker/planted/
124 changes: 124 additions & 0 deletions PROJECTS/intermediate/credential-enumeration/Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# =============================================================================
# ©AngelaMos | 2026
# Justfile
# =============================================================================
# credenum — Post-access credential exposure detection for Linux systems
# =============================================================================

set export
set shell := ["bash", "-uc"]

bin := "bin/credenum"
src := "src/harvester.nim"
version := `git describe --tags --always 2>/dev/null || echo "dev"`

# =============================================================================
# Default
# =============================================================================

default:
@just --list --unsorted

# =============================================================================
# Development
# =============================================================================

[group('dev')]
build:
@mkdir -p bin
nim c -o:{{bin}} {{src}}
@echo "Built: {{bin}} ($(du -h {{bin}} | cut -f1))"

[group('dev')]
run *ARGS: build
./{{bin}} {{ARGS}}

[group('dev')]
scan *ARGS: build
./{{bin}} --target $HOME {{ARGS}}

[group('dev')]
check:
nim check {{src}}

# =============================================================================
# Build (Production)
# =============================================================================

[group('prod')]
release:
@mkdir -p bin
nim c -d:release -d:lto --opt:size -o:{{bin}} {{src}}
strip -s {{bin}} 2>/dev/null || true
@echo "Release: {{bin}} ($(du -h {{bin}} | cut -f1))"

[group('prod')]
release-static:
@mkdir -p bin
nim c -d:release -d:musl -d:lto --opt:size -o:{{bin}} {{src}}
strip -s {{bin}} 2>/dev/null || true
@echo "Static release: {{bin}} ($(du -h {{bin}} | cut -f1))"

[group('prod')]
release-small: release-static
upx --best {{bin}}
@echo "Compressed: {{bin}} ($(du -h {{bin}} | cut -f1))"

[group('prod')]
build-x86:
@mkdir -p bin
nim c -d:release -d:zigcc -d:crossX86 -d:lto --opt:size -o:bin/credenum-x86_64 {{src}}
@echo "Cross-compiled: bin/credenum-x86_64"

[group('prod')]
build-arm64:
@mkdir -p bin
nim c -d:release -d:zigcc -d:crossArm64 -d:lto --opt:size -o:bin/credenum-aarch64 {{src}}
@echo "Cross-compiled: bin/credenum-aarch64"

# =============================================================================
# Testing
# =============================================================================

[group('test')]
test:
nim c -r --path:src tests/test_all.nim

[group('test')]
docker-build:
docker build -t credenum-test -f tests/docker/Dockerfile .

[group('test')]
docker-test: docker-build
docker run --rm credenum-test

# =============================================================================
# Formatting
# =============================================================================

[group('lint')]
fmt:
nph src/

[group('lint')]
fmt-check:
nph --check src/

# =============================================================================
# Utilities
# =============================================================================

[group('util')]
info:
@echo "Project: credential-enumeration"
@echo "Version: {{version}}"
@echo "Nim: $(nim --version | head -1)"
@echo "OS: {{os()}} ({{arch()}})"
@echo "Binary: {{bin}}"
@test -f {{bin}} && echo "Size: $(du -h {{bin}} | cut -f1)" || echo "Size: (not built)"

[group('util')]
clean:
-rm -rf bin/ nimcache/
-find . -name "nimcache" -type d -exec rm -rf {} + 2>/dev/null
@echo "Cleaned build artifacts."
Loading
Loading