Skip to content

Commit

Permalink
Merge branch 'upgrade_core' of https://github.com/multiflexi/Taranis-NG
Browse files Browse the repository at this point in the history
… into upgrade_core
  • Loading branch information
multiflexi committed Jul 30, 2024
2 parents a55fe50 + 200475e commit dc4c928
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 8 deletions.
53 changes: 45 additions & 8 deletions src/core/manage.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,56 @@
#! /usr/bin/env python
"""This script is used to manage user accounts, roles, and collectors in the Taranis-NG application."""

"""Module for managing the application from the command line."""

from os import abort, getenv, read
from flask import Flask
"""This script is used to manage user accounts, roles, and collectors in the Taranis-NG application.
Usage:
python manage.py account [options]
python manage.py role [options]
python manage.py collector [options]
Options:
account:
--list, -l List all user accounts.
--create, -c Create a new user account.
--edit, -e Edit an existing user account.
--delete, -d Delete an existing user account.
--username Username of the user account.
--name Name of the user.
--password Password of the user account.
--roles Roles assigned to the user account.
role:
--list, -l List all roles.
--create, -c Create a new role.
--edit, -e Edit an existing role.
--delete, -d Delete an existing role.
--filter, -f Filter roles by name.
--id ID of the role.
--name Name of the role.
--description Description of the role.
--permissions Permissions assigned to the role.
collector:
--list, -l List all collectors.
--create, -c Create a new collector.
--edit, -e Edit an existing collector.
--delete, -d Delete an existing collector.
--update, -u Update collectors.
--all, -a Update all collectors.
--show-api-key Show API key in the output.
--id ID of the collector.
--name Name of the collector.
--description Description of the collector.
--api-url API URL of the collector.
--api-key API key of the collector.
"""
import random
import socket
import string
import time
import logging
import click
import traceback

from os import abort, getenv, read
from flask import Flask
from managers import db_manager
from model import user, role, permission, collectors_node, collector, attribute, apikey
from remote.collectors_api import CollectorsApi
Expand Down Expand Up @@ -379,7 +417,6 @@ def dictionary_management(upload_cve, upload_cpe):
upload_cve (bool): Indicates whether to upload the CVE file and load the CVE dictionary.
upload_cpe (bool): Indicates whether to upload the CPE file and load the CPE dictionary.
"""

if upload_cve:
cve_update_file = getenv("CVE_UPDATE_FILE")
if cve_update_file is None:
Expand Down
1 change: 1 addition & 0 deletions src/core/managers/auth_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
get_user_from_jwt_token: Try to authenticate the user by JWT token.
get_perm_from_jwt_token: Get user permissions from JWT token.
"""

import os
from datetime import datetime, timedelta
from enum import Enum, auto
Expand Down

0 comments on commit dc4c928

Please sign in to comment.