Skip to content

Commit

Permalink
Preparing release
Browse files Browse the repository at this point in the history
  • Loading branch information
k1nd0ne committed Jun 7, 2024
1 parent c2d8648 commit 4d39a59
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 41 deletions.
83 changes: 82 additions & 1 deletion cases/static/js/case.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$(document).ready(function () {
$("#loading-content").addClass("d-none");
$("#main-content").removeClass("d-none");
case_id = $("#case").attr("value");
const case_id = $("#case").attr("value");
connectWebSocket(case_id);
get_indicators(case_id, null);

Expand Down Expand Up @@ -40,6 +40,87 @@ $(document).ready(function () {
});
});

$(".evidence_bind").on("click", function () {
$("#modal_evidence_bind").modal("show");
});

$("#bind-button").on("click", function () {
const evidence_name = $("#id_bind_dump_name").val();
const evidence_os = $("#id_bind_dump_os").val();
const dump_source = $("#id_bind_dump_source").val();
const dump_access_key_id = $("#id_bind_dump_access_key_id").val();
const dump_access_key = $("#id_bind_dump_access_key").val();
const dump_region = $("#id_bind_dump_region").val();
const dump_url = $("#id_bind_dump_url").val();
const dump_endpoint = $("#id_bind_dump_endpoint").val();

var formData = {
dump_name: evidence_name,
dump_os: evidence_os,
dump_name: evidence_name,
dump_access_key_id: dump_access_key_id,
dump_access_key: dump_access_key,
dump_endpoint: dump_endpoint,
dump_source: dump_source,
dump_linked_case: case_id,
dump_url: dump_url,
dump_region: dump_region,
};

if (evidence_name === "") {
$("#form-bind-error").text("Please enter a name for the evidence.");
return;
}

if (evidence_os === "") {
$("#form-bind-error").text("Please select an os for this evidence");
return;
}

if (dump_source === "") {
$("#form-bind-error").text("Please select a data source.");
return;
}

if (dump_access_key_id === "") {
$("#form-bind-error").text("Please enter the access key id");
return;
}

if (dump_access_key === "") {
$("#form-bind-error").text("Please enter the access key.");
return;
}

if (dump_endpoint === "" && dump_source === "MINIO") {
$("#form-bind-error").text("Please enter the endpoint of MinIO.");
return;
}

if (dump_region === "" && dump_source === "AWS") {
$("#form-bind-error").text("Please enter the AWS region.");
return;
}

if (dump_url === "") {
$("#form-bind-error").text("Please enter the url of your evidence.");
return;
}
$("#form-bind-error").text("");
bind_and_create_evidence(formData);
});

$("#id_bind_dump_source").on("change", function () {
if (this.value === "AWS") {
$("#aws-region-form").attr("class", "mb-3");
$("#minio-endpoint-form").attr("class", "d-none");
}
if (this.value === "MINIO") {
$("#aws-region-form").attr("class", "d-none");
$("#minio-endpoint-form").attr("class", "mb-3");
}
});

$("#delete_evidence").on("click", function () {
$(".modal_evidence_review").modal("hide");
$(".modal_evidence_delete").modal("show");
Expand Down
9 changes: 9 additions & 0 deletions cases/templates/cases/case.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@
</div>
</a>

<a class="nav-link evidence_bind m-1 border" href="#">
<div class="align-items-center d-flex">
<i
class="fas fa-link icon icon-shape icon-sm border-radius-md d-flex align-items-center justify-content-center me-2 text-center shadow"
></i>
<span class="ms-1">Bind evidence</span>
</div>
</a>

<a class="nav-link stix_bundle_create m-1 border" href="#">
<div class="align-items-center d-flex">
<i
Expand Down
5 changes: 3 additions & 2 deletions cases/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from cases.serializers import CaseSerializer
from cases.forms import CaseForm
from cases.models import Case
from evidences.forms import EvidenceForm
from evidences.forms import EvidenceForm, BindEvidenceForm
from minio import Minio
import uuid, urllib3, ssl

Expand All @@ -25,8 +25,9 @@ def case(request, case_id):
"""
case = Case.objects.get(case_id=case_id)
evidence_form = EvidenceForm()
bind_evidence_form = BindEvidenceForm()
return render(
request, "cases/case.html", {"case": case, "evidence_form": evidence_form}
request, "cases/case.html", {"case": case, "evidence_form": evidence_form, "bind_evidence_form":bind_evidence_form}
)


Expand Down
19 changes: 4 additions & 15 deletions docker/docker-compose-aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ services:
- POSTGRES_DB=${POSTGRES_DB}
image: postgres:14.1
restart: always
ports:
- 5432:5432
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- backend

volweb-redis:
container_name: volweb-redis
Expand All @@ -20,8 +20,8 @@ services:
command: ["redis-server", "--appendonly", "yes"]
volumes:
- "redis-data:/data"
networks:
- backend
ports:
- "6379:6379"

volweb-platform:
container_name: volweb-platform
Expand Down Expand Up @@ -53,8 +53,6 @@ services:
volumes:
- staticfiles:/home/app/web/staticfiles
- media:/home/app/web/media
networks:
- backend

volweb-workers:
environment:
Expand Down Expand Up @@ -86,8 +84,6 @@ services:
deploy:
mode: replicated
replicas: 1 # Warning: see the documentation if you want to add more replicas.
networks:
- backend

nginx:
container_name: volweb_nginx
Expand All @@ -103,17 +99,10 @@ services:
- media:/home/app/web/media
depends_on:
- volweb-platform
networks:
- frontend
- backend

volumes:
minio_storage:
postgres-data:
redis-data:
staticfiles:
media:

networks:
frontend:
backend:
23 changes: 5 additions & 18 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ services:
- POSTGRES_DB=${POSTGRES_DB}
image: postgres:14.1
restart: always
ports:
- 5432:5432
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- backend

volweb-redis:
container_name: volweb-redis
Expand All @@ -20,12 +20,13 @@ services:
command: ["redis-server", "--appendonly", "yes"]
volumes:
- "redis-data:/data"
networks:
- backend
ports:
- "6379:6379"

volweb-minio:
container_name: volweb-minio
image: minio/minio
network_mode: "host"
restart: always
volumes:
- minio_storage:/data
Expand All @@ -35,9 +36,6 @@ services:
- MINIO_ROOT_USER=${AWS_ACCESS_KEY_ID}
- MINIO_ROOT_PASSWORD=${AWS_SECRET_ACCESS_KEY}
command: server --console-address ":9001" /data
networks:
- frontend
- backend

volweb-platform:
container_name: volweb-platform
Expand Down Expand Up @@ -72,8 +70,6 @@ services:
- staticfiles:/home/app/web/staticfiles
- ./minio/fullchain.pem:/etc/ssl/certs/minio.pem
- media:/home/app/web/media
networks:
- backend

volweb-workers:
environment:
Expand Down Expand Up @@ -108,8 +104,6 @@ services:
deploy:
mode: replicated
replicas: 1 # Warning: see the documentation if you want to add more replicas.
networks:
- backend

nginx:
container_name: volweb_nginx
Expand All @@ -125,17 +119,10 @@ services:
- media:/home/app/web/media
depends_on:
- volweb-platform
networks:
- frontend
- backend

volumes:
minio_storage:
postgres-data:
redis-data:
staticfiles:
media:

networks:
frontend:
backend:
7 changes: 4 additions & 3 deletions evidences/forms.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from evidences.models import Evidence
from cases.models import Case
from django import forms
from django.forms import TextInput, Select
from django.forms import TextInput, Select, PasswordInput


class EvidenceForm(forms.ModelForm):
Expand Down Expand Up @@ -65,12 +65,13 @@ class Meta:
"id": "id_bind_dump_access_key_id",
}
),
"dump_access_key": TextInput(
"dump_access_key": PasswordInput(
attrs={
"class": "form-control form-control-sm",
"type": "text",
"type": "password",
"required": "",
"id": "id_bind_dump_access_key",
"aria-describedby":"access_key_help",
}
),
"dump_url": TextInput(
Expand Down
6 changes: 4 additions & 2 deletions evidences/templates/evidences/modals.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ <h1 class="modal-title fs-5 p-2" id="modal_case_number">
<div class="mb-3">
<label class="form-label">Bucket access key*</label>
{{bind_evidence_form.dump_access_key}}
<div id="access_key_help" class="form-text">
For AWS, you can find your bucket access key in the 'IAM' (Identity and Access Management) section of the AWS Management Console, while for MinIO, it can be generated and found in the MinIO Console or configuration file.
</div>
</div>

<div class="mb-3 d-none" id="aws-region-form">
Expand Down Expand Up @@ -182,8 +185,7 @@ <h1 class="modal-title evidence_info fs-5 placeholder evidence_name"></h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
You are about to delete the evidence, the memory image <b>will not
be deleted</b> from the bucket. Are you sure ?
You are about to delete the evidence. Are you sure ?
</div>
<div class="modal-footer">
<button type="button" id="delete_evidence_confirmed"
Expand Down

0 comments on commit 4d39a59

Please sign in to comment.