Skip to content

taranis-ai/cybersec-classifier

Repository files navigation

Taranis AI cybersec-classifier Bot

A Bot that can classify texts into Cybersecurity/Not-Cybersecurity

Available models:

Pre-requisites

Create a python venv and install the necessary packages for the bot to run.

uv venv
source .venv/bin/activate
uv sync --all-extras --dev

Usage

You can run your bot locally with

quart run --port 5500
# or
granian --interface asgi app --port 5500

You can set configs either via a .env file or by setting environment variables directly. available configs are in the config.py You can select the model via the MODEL env var. E.g.:

MODEL=cybersec_mlp flask run

Docker

You can also create a Docker image out of this bot. For this, you first need to build the image with the build_container.sh

You can specify which model the image should be built with the MODEL environment variable. If you omit it, the image will be built with the default model.

MODEL=<model_name> ./build_container.sh

then you can run it with:

docker run -p 5500:8000 <image_name>:<tag>

If you encounter errors, make sure that port 5500 is not in use by another application.

Test the bot

Once the bot is running, you can send test data to it on which it runs its inference method:

curl -X POST http://127.0.0.1:5500 -H "Content-Type: application/json" -d '{"text": "A text about cybersecurity"}'
{"cybersecurity":0.9999910593032837,"non-cybersecurity":8.940696716308594e-06}

You can also set up authorization via the API_KEY env var. In this case, you need to send the API_KEY as an Authorization header:

curl -X POST http://127.0.0.1:5500/  -H "Authorization: Bearer api_key" -H "Content-Type: application/json" -d '{"text": "In West Philadelphia born and raised"}'
"cybersecurity":8.931287447921932e-05,"non-cybersecurity":0.9999107122421265}

Development

If you want to contribute to the development of this bot, make sure you set up your pre-commit hooks correctly:

License

EUROPEAN UNION PUBLIC LICENCE v. 1.2

About

A Bot classifying News Items into Cybersecurity/Non-Cybersecurity

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors