Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #118 from glenda1015/glenda1015/updated-docs
Browse files Browse the repository at this point in the history
Updated documentation of the triage portal
  • Loading branch information
Cyber-JiuJiteria authored Aug 28, 2023
2 parents b5e7510 + c9aab5e commit a7079ce
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 4 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ button. A new widow will open. This is needed because VS Code launch settings ar
within the omega/triage-portal folder.

You can then run the Django launch task to start the application. Navigate to
<http://localhost:0/admin> and enter the default credentials (admin/admin), then
navigate back to <http://localhost:8001>.
<http://localhost:8001/admin/login/?next=/admin/> and enter the default credentials that you created (admin/admin),
then navigate back to <http://localhost:8001>.

## Local Development

Expand Down Expand Up @@ -55,7 +55,16 @@ Issues enabling python virtualenv

https://stackoverflow.com/questions/69605313/vs-code-terminal-activate-ps1-cannot-be-loaded-because-running-scripts-is-disa

### Azure Development Environment

## The API Connecting The Omega Analyser And Triage Portal

The documentation for the API that connects the Omega Analyzer and Triage Portal is housed within the GraphiQL IDE, which is basically a playground
offered by GraphQL to facilitate interactions with its APIs. It is conveniently accessible through the `http://localhost:8001/graphql` endpoint.
This documentation becomes available after the application is successfully deployed.

**_File Size:_** Please be aware that the current file size limitation for the API stands at `200 MB`. This constraint should be considered when handling file uploads or other data interactions within the Triage Portal's API.

## Azure Development Environment

The Proof of concept webapp is available at https://otpdev1.eastus.cloudapp.azure.com/admin

Expand Down
48 changes: 48 additions & 0 deletions src/triage/docs/mapping-of-database.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Visualizing The Database of Omega Triage Portal
This document provides instructions on how to create a visualization of the database for the Triage Portal.

## Instructions
Make sure you have the following packages installed or specified in your project's `requirements.txt`.
- django-extensions
- https://pypi.org/project/django-extensions/
- pydot
- https://pypi.org/project/pydot/

### Default Settings
In your Django project's `setting.py` file, add the following configurations:
```bash
INSTALLED_APPS = (
# ...
'django_extensions',
# ...
)

GRAPH_MODELS = {
'all_applications': True,
'group_models': True,
}
```

### Docker Setup
If you are using Docker, add graphviz to your `Dockerfile` to install necessary packages and set up the environment:
```bash
RUN apt-get update && apt-get install -y --no-install-recommends \
# ...
graphviz \
# ...
&& apt-get clean && rm -rf /var/lib/apt/lists/*
```

### Obtaining The Graph
Have the containers running and inside the Docker container for your Triage Portal application named `omega-triage-portal`,
execute the following command to generate the database visualization as a PNG image.
In this case, this will generate a PNG file named myapp_models.png.

```bash
python manage.py graph_models -a -o myapp_models.png
```

After the command is successfully executed, to access the generated image, you can download it from inside the Docker container.

### Helpful link
Documentation link: https://django-extensions.readthedocs.io/en/latest/graph_models.html
Binary file added src/triage/docs/triage_db_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/triage/models/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def get_filter_function(cls, function_body: str, the_type: str) -> Any | None:
if Filter.is_safe_function(function_str):
return compile(function_str, the_type, "exec")
raise Exception("Function is not safe.")
except Exception as msg: # pylint: disable=broad-except
# pylint: disable=broad-except
except Exception as msg:
logger.warning("Invalid %s function: %s", the_type, msg)
return None

Expand Down

0 comments on commit a7079ce

Please sign in to comment.