Skip to content

Commit

Permalink
Initial script and CI/CD work.
Browse files Browse the repository at this point in the history
  • Loading branch information
svnscha committed Nov 7, 2023
1 parent a1b64ec commit 6556eb5
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 222 deletions.
19 changes: 3 additions & 16 deletions .github/workflows/Coverage.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
name: Update model.json for gh-pages branch.
name: Update gh-pages.

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'

jobs:
build:
runs-on: ubuntu-latest

env:
PYTHONUNBUFFERED: 1
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.RULE_COVERAGE_SVC_PAT}}

steps:
- name: Checkout sigma-rule-coverage
uses: actions/checkout@v2
Expand Down Expand Up @@ -61,15 +57,6 @@ jobs:
# Prepare Git environment
git config --global user.email "github.action@localhost.local"
git config --global user.name "CI"
git config --global --add safe.directory /github/workspace
echo "machine github.com" > "$HOME/.netrc"
echo " login $GITHUB_ACTOR" >> "$HOME/.netrc"
echo " password $GITHUB_TOKEN" >> "$HOME/.netrc"
echo "machine api.github.com" >> "$HOME/.netrc"
echo " login $GITHUB_ACTOR" >> "$HOME/.netrc"
echo " password $GITHUB_TOKEN" >> "$HOME/.netrc"
# Git add and commit.
git add .
Expand Down
12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,5 @@ The script imports all Sigma rules and evaluates the creation of rules for every
Run the script:

```
python rule-coverage.py
```

## Run the test webserver.

### Converting to the latest uberAgent version
To preview the static website including the metadata about rules simply run:

```
cd www
python -m http.server
python rule-coverage.py --rules /path/to/rules --output model.json
```
179 changes: 1 addition & 178 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ pysigma-backend-uberagent = "^0.3.47"

[tool.poetry.dev-dependencies]

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.0"
pytest-cov = "^4.1.0"
coverage = "^7.3.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
2 changes: 1 addition & 1 deletion rule-coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def get_rule_yaml(file_path: str) -> dict:
rule_yaml = rule_yaml[0]
result["id"] = rule_yaml["id"]
result["title"] = rule_yaml["title"]
result["file"] = os.path.relpath(path, utility.get_rule_directory()).replace("\\", "/")
result["file"] = os.path.relpath(path, os.getcwd()).replace("\\", "/")

if "status" in rule_yaml:
result["status"] = rule_yaml["status"]
Expand Down
9 changes: 0 additions & 9 deletions tests/test_rule_coverage.py

This file was deleted.

2 changes: 0 additions & 2 deletions util/utility.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import os
from typing import List

def get_rule_directory():
return os.path.join(os.getcwd(), "rules")

def get_rule_paths(path) -> List[str]:

Expand Down

0 comments on commit 6556eb5

Please sign in to comment.