diff --git a/.gitignore b/.gitignore
index 73a9de33..aa37b9aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,14 +1,16 @@
-.idea
-.fleet
-venv
__pycache__/
+.fleet
+.idea
+.venv
+.env
*/__pycache__/
-testing_platform/__pycache__/
db.sqlite3
db/db.sqlite3
-static
+docs/_build/
files
node_modules/
poetry.lock
poetry.lock*
-docs/_build/
+static
+testing_platform/__pycache__/
+venv
diff --git a/compose/staging/.env b/compose/staging/.env
deleted file mode 100644
index 30500860..00000000
--- a/compose/staging/.env
+++ /dev/null
@@ -1,3 +0,0 @@
-ONEKEY_API_EMAIL="romain.kieffer@nc3.lu"
-ONEKEY_API_PASSWORD="testing_platform_1key!"
-
diff --git a/compose/staging/Dockerfile b/compose/staging/Dockerfile
index bd1e3af9..a04611d2 100644
--- a/compose/staging/Dockerfile
+++ b/compose/staging/Dockerfile
@@ -1,14 +1,14 @@
-ARG PYTHON_VERSION
-FROM python:${PYTHON_VERSION}
-ARG DEBUG
+FROM python:latest
+
ENV PYTHONUNBUFFERED 1
ENV APP_ROOT /var/www/testing_platform
WORKDIR ${APP_ROOT}
-COPY ../../requirements.txt ${APP_ROOT}
+COPY ../.. ${APP_ROOT}
-RUN pip3 install -r ${APP_ROOT}/requirements.txt
+RUN pip install --upgrade pip && \
+ pip install -r ${APP_ROOT}/requirements.in
RUN apt-get update && \
apt-get install -y --no-install-recommends \
iputils-ping nmap && \
@@ -17,7 +17,6 @@ RUN apt-get update && \
EXPOSE 8000
-COPY ../.. ${APP_ROOT}
COPY compose/staging/entrypoint.sh ${APP_ROOT}
-ENTRYPOINT [ "/var/www/testing_platform/entrypoint.sh" ]
+ENTRYPOINT ${APP_ROOT}/entrypoint.sh
\ No newline at end of file
diff --git a/compose/staging/docker-compose.yml b/compose/staging/docker-compose.yml
index eeeb1f31..ecf9cbf2 100644
--- a/compose/staging/docker-compose.yml
+++ b/compose/staging/docker-compose.yml
@@ -4,12 +4,15 @@ services:
build:
context: ../..
dockerfile: compose/staging/Dockerfile
- args:
- - DEBUG=1
- - PYTHON_VERSION=3.12
cache_from:
- testing-platform:app
image: "testing-platform:app"
+ restart: unless-stopped
+ environment:
+ POSTGRES_HOST: db
+ POSTGRES_DB: testing_platform
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: change_me
command: gunicorn testing_platform.wsgi:application --bind 0.0.0.0:8000
volumes:
- ../../static:/var/www/testing_platform/static
@@ -22,6 +25,7 @@ services:
cache_from:
- testing-platform:nginx
image: "testing-platform:nginx"
+ restart: unless-stopped
volumes:
- ../../static:/var/www/testing_platform/static
ports:
@@ -29,5 +33,16 @@ services:
depends_on:
- testing-platform
+ db:
+ image: postgres
+ restart: unless-stopped
+ environment:
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: change_me
+ POSTGRES_DB: testing_platform
+ volumes:
+ - pgdata:/var/lib/postgresql
+
volumes:
static:
+ pgdata:
diff --git a/iot_inspector/admin.py b/iot_inspector/admin.py
index be6f64ba..61aabf9b 100644
--- a/iot_inspector/admin.py
+++ b/iot_inspector/admin.py
@@ -10,7 +10,6 @@
client_generate_report,
client_get_report_link,
client_login,
- client_upload_firmware,
get_default_product_group,
)
from .models import AnalysisRequest, IOTUser
@@ -35,9 +34,7 @@ def validate_status(self, request, queryset):
if not analysis_request.firmware_uuid:
client = client_login(iot_user)
default_product_group = get_default_product_group(client)
- firmware = client_upload_firmware(
- client, analysis_request, default_product_group
- )
+ firmware = {"id": "REMOVED"} # TODO: find replacement for ONEKEY
firmware_uuid = firmware["id"]
analysis_request.firmware_uuid = firmware_uuid
analysis_request.status = True
diff --git a/iot_inspector/helpers.py b/iot_inspector/helpers.py
index 6d978f90..d89caf12 100644
--- a/iot_inspector/helpers.py
+++ b/iot_inspector/helpers.py
@@ -7,7 +7,6 @@
from decouple import config
from django.core.files.storage import FileSystemStorage
from django.core.signing import Signer
-from onekey_client import Client, FirmwareMetadata
from testing_platform import settings
@@ -111,18 +110,6 @@ def get_default_product_group(client):
return default_product_group
-def client_upload_firmware(client, analysis_request, default_product_group):
- metadata = FirmwareMetadata(
- name=analysis_request.name,
- vendor_name=analysis_request.vendor_name,
- product_name=analysis_request.product_name,
- product_group_id=default_product_group["id"],
- )
- firmware_path = Path(analysis_request.file.path)
- res = client.upload_firmware(metadata, firmware_path, enable_monitoring=True)
- return res
-
-
def client_get_or_generate_report_config(client):
GET_ALL_REPORT_CONFIGS = """
query {
diff --git a/iot_inspector/helpers_old.py b/iot_inspector/helpers_old.py
index 6d978f90..d89caf12 100644
--- a/iot_inspector/helpers_old.py
+++ b/iot_inspector/helpers_old.py
@@ -7,7 +7,6 @@
from decouple import config
from django.core.files.storage import FileSystemStorage
from django.core.signing import Signer
-from onekey_client import Client, FirmwareMetadata
from testing_platform import settings
@@ -111,18 +110,6 @@ def get_default_product_group(client):
return default_product_group
-def client_upload_firmware(client, analysis_request, default_product_group):
- metadata = FirmwareMetadata(
- name=analysis_request.name,
- vendor_name=analysis_request.vendor_name,
- product_name=analysis_request.product_name,
- product_group_id=default_product_group["id"],
- )
- firmware_path = Path(analysis_request.file.path)
- res = client.upload_firmware(metadata, firmware_path, enable_monitoring=True)
- return res
-
-
def client_get_or_generate_report_config(client):
GET_ALL_REPORT_CONFIGS = """
query {
diff --git a/landing_page/templates/dashboard.html b/landing_page/templates/dashboard.html
index cfb40196..87fff18c 100644
--- a/landing_page/templates/dashboard.html
+++ b/landing_page/templates/dashboard.html
@@ -62,12 +62,12 @@
Toolbox
Create DMARC and/or SPF policies which help you to enhance your e-mail security!
-
+
IOT Firmware Testing
-
Check your IOT firmware binary!
+
Under maintenance ...
diff --git a/manage.py b/manage.py
new file mode 100644
index 00000000..b09132ba
--- /dev/null
+++ b/manage.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+"""Django's command-line utility for administrative tasks."""
+import os
+import sys
+
+
+def main():
+ """Run administrative tasks."""
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testing_platform.settings")
+ try:
+ from django.core.management import execute_from_command_line
+ except ImportError as exc:
+ raise ImportError(
+ "Couldn't import Django. Are you sure it's installed and "
+ "available on your PYTHONPATH environment variable? Did you "
+ "forget to activate a virtual environment?"
+ ) from exc
+ execute_from_command_line(sys.argv)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/nginx/Dockerfile b/nginx/Dockerfile
index a7afc00d..17db4324 100644
--- a/nginx/Dockerfile
+++ b/nginx/Dockerfile
@@ -1,4 +1,3 @@
-FROM nginx:1.27.5-alpine
+FROM nginx:latest
-RUN rm /etc/nginx/conf.d/default.conf
-COPY nginx.conf /etc/nginx/conf.d
+COPY nginx.conf /etc/nginx/conf.d/default.conf
diff --git a/nginx/nginx.conf b/nginx/nginx.conf
index 789094d9..793de16d 100644
--- a/nginx/nginx.conf
+++ b/nginx/nginx.conf
@@ -5,6 +5,7 @@ upstream testing-platform {
server {
listen 80;
server_name testing.office.lhc.lu;
+ server_tokens off;
location / {
proxy_pass http://testing-platform;
diff --git a/onekey/__init__.py b/onekey/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/onekey/admin.py b/onekey/admin.py
deleted file mode 100644
index 3841c4b7..00000000
--- a/onekey/admin.py
+++ /dev/null
@@ -1,39 +0,0 @@
-from django.contrib import admin, messages
-
-from .helpers import api_login, client_upload_firmware, get_default_product_group
-from .models import FirmwareAnalysisRequest
-
-# Register your models here.
-
-
-@admin.register(FirmwareAnalysisRequest)
-class FirmwareAnalysisRequestAdmin(admin.ModelAdmin):
- actions = [
- "validate_status",
- "decline_status",
- "pending_status",
- ]
-
- @admin.action(description="Validate")
- def validate_status(self, request, queryset):
- for analysis_request in queryset:
- if not analysis_request.firmware_uuid:
- client = api_login()
- default_product_group = get_default_product_group(client)
- firmware = client_upload_firmware(
- client, analysis_request, default_product_group
- )
- firmware_uuid = firmware["id"]
- analysis_request.firmware_uuid = firmware_uuid
- analysis_request.status = True
- analysis_request.save()
- else:
- messages.error(request, "This request was already made.")
-
- @admin.action(description="Decline")
- def decline_status(self, request, queryset):
- queryset.update(status=False)
-
- @admin.action(description="Set to pending")
- def pending_status(self, request, queryset):
- queryset.update(status=None)
diff --git a/onekey/apps.py b/onekey/apps.py
deleted file mode 100644
index a36b4f87..00000000
--- a/onekey/apps.py
+++ /dev/null
@@ -1,6 +0,0 @@
-from django.apps import AppConfig
-
-
-class OnekeyConfig(AppConfig):
- default_auto_field = "django.db.models.BigAutoField"
- name = "onekey"
diff --git a/onekey/forms.py b/onekey/forms.py
deleted file mode 100644
index dc8f85e6..00000000
--- a/onekey/forms.py
+++ /dev/null
@@ -1,19 +0,0 @@
-from django import forms
-
-from .models import FirmwareAnalysisRequest
-
-
-class FirmwareAnalysisRequestForm(forms.ModelForm):
- class Meta:
- model = FirmwareAnalysisRequest
- fields = [
- "firmware_name",
- "firmware_vendor_name",
- "firmware_product_name",
- "firmware_file",
- ]
-
- def __init__(self, *args, **kwargs):
- super().__init__(*args, **kwargs)
- for visible in self.visible_fields():
- visible.field.widget.attrs["class"] = "form_control"
diff --git a/onekey/helpers.py b/onekey/helpers.py
deleted file mode 100644
index 520795bb..00000000
--- a/onekey/helpers.py
+++ /dev/null
@@ -1,198 +0,0 @@
-import json
-import secrets
-from pathlib import Path
-
-import jwt
-import requests
-from decouple import config
-from django.core.files.storage import FileSystemStorage
-from django.core.signing import Signer
-from onekey_client import Client, FirmwareMetadata
-
-from testing_platform import settings
-
-
-def api_login():
- client = Client(api_url=settings.ONEKEY_API_URL)
- signer = Signer()
- try:
- client.login(settings.ONEKEY_API_EMAIL, settings.ONEKEY_API_PASSWORD)
- tenant = client.get_tenant("Luxembourg House of Cybersecurity")
- client.use_tenant(tenant)
- except Exception as e:
- raise e
- return client
-
-
-def get_default_product_group(client):
- GET_PRODUCT_GROUPS = """
- query {
- allProductGroups {
- id
- name
- }
- }
- """
- res = client.query(GET_PRODUCT_GROUPS)
- default_product_group = next(
- pg for pg in res["allProductGroups"] if pg["name"] == "Default"
- )
- return default_product_group
-
-
-def client_upload_firmware(client, firmware_analysis_request, default_product_group):
- metadata = FirmwareMetadata(
- name=firmware_analysis_request.firmware_name,
- vendor_name=firmware_analysis_request.firmware_vendor_name,
- product_name=firmware_analysis_request.firmware_product_name,
- product_group_id=default_product_group["id"],
- )
- firmware_path = Path(firmware_analysis_request.firmware_file.path)
- res = client.upload_firmware(metadata, firmware_path, enable_monitoring=True)
- return res
-
-
-def client_get_or_generate_report_config(client):
- GET_ALL_REPORT_CONFIGS = """
- query {
- allReportConfigurations { id, name }
- }
- """
- GENERATE_REPORT_CONFIG = """
- mutation {
- createReportConfiguration(input: {
- name: "TP Report",
- issueSeverities: [CRITICAL, HIGH, MEDIUM, INFORMATIONAL, LOW],
- complianceGuidelineIds: ["f3463279-0234-46d0-9f02-68c941b8b107",
- "d74e4b79-7613-4e13-bc20-d88f3bfe6b4b",
- "9f09232a-f66b-4046-9f2a-3ca44e776deb",
- "af2c4a04-42bd-437b-9982-e98e46dddc30",
- "6956638d-428f-44d0-85c7-459c1544436c",
- "45f2094e-904b-47c8-8042-0964b1d09f7e"],
- analysisTechniqueDetails: true,
- includeComments: true
- }) {
- ... on ReportConfiguration {
- id,
- }
- ...on MutationError {
- count
- errors {
- message
- code
- ...on ValidationError {
- fieldPath
- }
- }
- }
- }
- }
- """
- res = client.query(GET_ALL_REPORT_CONFIGS)
- print(res)
- try:
- report_config = next(
- cfg for cfg in res["allReportConfigurations"] if cfg["name"] == "TP Report"
- )
- except StopIteration:
- report_config = None
- if report_config:
- return report_config
- else:
- client.query(GENERATE_REPORT_CONFIG)
- res = client.query(GET_ALL_REPORT_CONFIGS)
- print(res)
- report_config = next(
- cfg for cfg in res["allReportConfigurations"] if cfg["name"] == "TP Report"
- )
- return report_config
-
-
-def client_generate_report(client, firmware_uuid, report_title):
- report_config = client_get_or_generate_report_config(client)
- report_config = report_config["id"]
- GENERATE_REPORT = """
- mutation M {{
- generateReport(input: {{
- reportConfigurationId: "{}",
- firmwareIds: [
- "{}"
- ],
- title: "{}",
-
- }}) {{
- ... on Report {{
- id,
- title,
- generatedTime,
- downloadUrl,
- size,
-
- }}
- ... on MutationError {{
- count
- errors {{
- message
- code
- ... on ValidationError {{
- fieldPath
- }}
- }}
- }}
- }}
- }}
- """.format(
- report_config, firmware_uuid, report_title
- )
- res = client.query(GENERATE_REPORT)
- report = res["generateReport"]
- print(report)
- return report
-
-
-def client_request_link(client, report_uuid):
- GENERATE_REPORT_LINK = """
- mutation M {{
- createReportLink (input: {{
- reportId: "{}",
- validity: 86400
- }}) {{
- ... on CreatedReportLink {{
- downloadUrl
- id
- validUntil
- }}
- ... on MutationError {{
- count
- errors {{
- message
- code
- fieldPath
- }}
- }}
- }}
- }}
- """.format(
- report_uuid
- )
- res = client.query(GENERATE_REPORT_LINK)
- return res["createReportLink"]
-
-
-def client_get_all_reports_states(client, analysis_requests):
- GET_ALL_REPORTS = """
- query {
- allReports { id, state }
- }
- """
- res = client.query(GET_ALL_REPORTS)
- states = []
- for req in analysis_requests:
- if req.report_uuid:
- state = next(
- rep for rep in res["allReports"] if rep["id"] == str(req.report_uuid)
- )["state"]
- else:
- state = "Pending"
- states.append(state.capitalize())
- return zip(analysis_requests, states)
diff --git a/onekey/migrations/0001_initial.py b/onekey/migrations/0001_initial.py
deleted file mode 100644
index cd132d17..00000000
--- a/onekey/migrations/0001_initial.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# Generated by Django 4.2.3 on 2023-10-05 07:58
-
-import django.db.models.deletion
-from django.conf import settings
-from django.db import migrations, models
-
-import onekey.models
-
-
-class Migration(migrations.Migration):
- initial = True
-
- dependencies = [
- migrations.swappable_dependency(settings.AUTH_USER_MODEL),
- ]
-
- operations = [
- migrations.CreateModel(
- name="FirmwareAnalysisRequest",
- fields=[
- (
- "id",
- models.BigAutoField(
- auto_created=True,
- primary_key=True,
- serialize=False,
- verbose_name="ID",
- ),
- ),
- ("request_nb", models.CharField(max_length=12)),
- ("firmware_name", models.CharField(max_length=200)),
- ("firmware_vendor_name", models.CharField(max_length=200)),
- ("firmware_product_name", models.CharField(max_length=200)),
- (
- "firmware_file",
- models.FileField(upload_to=onekey.models.get_upload_path),
- ),
- (
- "firmware_uuid",
- models.UUIDField(blank=True, default=None, null=True),
- ),
- ("status", models.BooleanField(blank=True, default=None, null=True)),
- ("report_uuid", models.UUIDField(blank=True, default=None, null=True)),
- ("report_link", models.URLField(blank=True, default=None, null=True)),
- (
- "user",
- models.ForeignKey(
- on_delete=django.db.models.deletion.CASCADE,
- to=settings.AUTH_USER_MODEL,
- ),
- ),
- ],
- ),
- ]
diff --git a/onekey/migrations/__init__.py b/onekey/migrations/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/onekey/models.py b/onekey/models.py
deleted file mode 100644
index 885f6aeb..00000000
--- a/onekey/models.py
+++ /dev/null
@@ -1,61 +0,0 @@
-import datetime
-import os
-
-from django.db import models
-
-from authentication.models import User
-
-
-def get_upload_path(instance, filename):
- return f"user_{instance.user.id}/{filename}"
-
-
-class FirmwareAnalysisRequest(models.Model):
- user = models.ForeignKey(User, on_delete=models.CASCADE)
- request_nb = models.CharField(max_length=12)
- firmware_name = models.CharField(max_length=200, blank=False, null=False)
- firmware_vendor_name = models.CharField(max_length=200, blank=False, null=False)
- firmware_product_name = models.CharField(max_length=200, blank=False, null=False)
- firmware_file = models.FileField(upload_to=get_upload_path)
- firmware_uuid = models.UUIDField(default=None, blank=True, null=True)
- status = models.BooleanField(default=None, blank=True, null=True)
- report_uuid = models.UUIDField(default=None, blank=True, null=True)
- report_link = models.URLField(default=None, blank=True, null=True)
-
- @property
- def filename(self):
- return os.path.basename(self.firmware_file.name)
-
- def status_prop(self):
- if self.status is False:
- alert = "Declined"
- elif self.status is None:
- alert = "Pending"
- else:
- alert = "Validated"
- return alert
-
- status_field = property(status_prop)
-
- def __str__(self):
- return f"Request {self.request_nb}"
-
- def save(self, *args, **kwargs):
- request_date = datetime.date.today()
- if not self.request_nb:
- try:
- request_id = int(
- FirmwareAnalysisRequest.objects.order_by("id").last().request_nb
- )
- if request_id:
- self.request_nb = request_id + 1
- else:
- pass
- except Exception:
- request_id = 1
- self.request_nb = (
- f'{request_date.year}{request_date.month}{(2-len(str(request_date.day)))*"0"}'
- f'{request_date.day}{(3-len(str(request_id)))*"0"}{request_id}'
- )
-
- super().save(*args, **kwargs)
diff --git a/onekey/templates/onekey_index.html b/onekey/templates/onekey_index.html
deleted file mode 100644
index d4a4906e..00000000
--- a/onekey/templates/onekey_index.html
+++ /dev/null
@@ -1,80 +0,0 @@
-{% extends "base.html" %}
-{% load i18n static %}
-{% block content %}
-
-
-
-
-
-
- ONEKEY IoT firmware analysis
-
-
Test the firmware of your IoT devices against modern norms, recommendations and guidelines.
-
-
- In order to design proper security controls adapted to your specific environment, you need to know
- what are the intrinsic vulnerabilities of the IoT devices you are using. To do so, we have
- partnered with ONEKEY GmbH whose solution is particularly advanced and comprehensive,
- and generates detailed firmware analysis reports.
-
-
-
-
-
-
-
- Here you can upload firmware images from your IoT devices to have them analyzed and receive a
- detailed report of the found vulnerabilities, compliance with major IoT standards, and more.
-
-
-
-
-
-
-
My ongoing requests
-
- {% if requests %}
-
-
- Request number
- Request name
- Request status
- Firmware UUID
- Report status
- Link to the report
-
- {% for request, status in requests %}
-
- {{ request.request_nb }}
- {{ request.firmware_name }}
- {{ request.status_field }}
- {{ request.firmware_uuid }}
- {{ status }}
- {% if status == "Finished" and request.report_link %}
- Download report
- {% elif not request.report_uuid %}
- No report available yet. Generate a report
- {% elif status == "Finished" and not request.report_link %}
- Report available. Generate a download link
- {% elif status == "Generating" %}
- Report is generating
- {% endif %}
-
- {% endfor %}
-
- {% else %}
-
No request registered
- {% endif %}
-
-
-
-
-
-
-
-{% endblock %}
diff --git a/onekey/templates/onekey_request.html b/onekey/templates/onekey_request.html
deleted file mode 100644
index c729995a..00000000
--- a/onekey/templates/onekey_request.html
+++ /dev/null
@@ -1,55 +0,0 @@
-{% extends "base.html" %}
-{% load i18n static %}
-{% block content %}
-
-
-
-
-
-
- ONEKEY IoT firmware analysis
-
-
Test the firmware of your IoT devices against modern norms, recommendations and guidelines.
-
-
- In order to design proper security controls adapted to your specific environment, you need to know
- what are the intrinsic vulnerabilities of the IoT devices you are using. To do so, we have
- partnered with ONEKEY GmbH whose solution is particularly advanced and comprehensive,
- and generates detailed firmware analysis reports.
-
-
-
-
-
-
-
-
Request Firmware Analysis
-
-
-
-
-
-{% endblock %}
diff --git a/onekey/tests.py b/onekey/tests.py
deleted file mode 100644
index 7ce503c2..00000000
--- a/onekey/tests.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.test import TestCase
-
-# Create your tests here.
diff --git a/onekey/urls.py b/onekey/urls.py
deleted file mode 100644
index 25ec8a18..00000000
--- a/onekey/urls.py
+++ /dev/null
@@ -1,19 +0,0 @@
-from django.urls import path
-
-from . import views
-
-urlpatterns = [
- path("", views.index, name="iot_index"),
- path("request/", views.analysis_request, name="analysis_request"),
- path(
- "generate_report/firmware=",
- views.generate_report,
- name="generate_report",
- ),
- path(
- "generate_link/report=", views.generate_link, name="generate_link"
- ),
- path(
- "download/report=", views.download_report, name="download_report"
- ),
-]
diff --git a/onekey/views.py b/onekey/views.py
deleted file mode 100644
index 367d0209..00000000
--- a/onekey/views.py
+++ /dev/null
@@ -1,80 +0,0 @@
-from django.contrib import messages
-from django.contrib.auth.decorators import login_required
-from django.http import FileResponse, HttpResponse
-from django.shortcuts import redirect, render
-
-from .forms import FirmwareAnalysisRequestForm
-from .helpers import api_login, client_generate_report, client_request_link, client_get_all_reports_states
-from .models import FirmwareAnalysisRequest
-
-
-# Create your views here.
-@login_required
-def index(request):
- client = api_login()
- reqs = FirmwareAnalysisRequest.objects.filter(user=request.user.id)
- reqs_status = client_get_all_reports_states(client, reqs)
- context = {"requests": reqs_status}
- return render(request, "onekey_index.html", context=context)
-
-
-def analysis_request(request):
- if request.method == "POST":
- form = FirmwareAnalysisRequestForm(request.POST, request.FILES)
- if form.is_valid():
- data = form.cleaned_data
- firmware_analysis_request = FirmwareAnalysisRequest(
- user=request.user,
- firmware_name=data["firmware_name"],
- firmware_vendor_name=data["firmware_vendor_name"],
- firmware_product_name=data["firmware_product_name"],
- firmware_file=data["firmware_file"],
- )
- firmware_analysis_request.save()
- messages.success(
- request,
- "Your analysis request was successfully saved, you will receive a pricing offer"
- " in the next few days.",
- )
- return redirect("iot_index")
- else:
- form = FirmwareAnalysisRequestForm()
- return render(request, "onekey_request.html", {"form": form})
-
-
-def generate_report(request, firmware_uuid):
- firmware_analysis_request = FirmwareAnalysisRequest.objects.get(
- firmware_uuid=firmware_uuid
- )
- client = api_login()
- request = client_generate_report(
- client, firmware_uuid, str(firmware_analysis_request.request_nb)
- )
- firmware_analysis_request.report_uuid = request["id"]
- firmware_analysis_request.save()
- return redirect("iot_index")
-
-
-def generate_link(request, report_uuid):
- firmware_analysis_request = FirmwareAnalysisRequest.objects.get(
- report_uuid=report_uuid
- )
- client = api_login()
- res = client_request_link(client, report_uuid)
- firmware_analysis_request.report_link = res["downloadUrl"]
- firmware_analysis_request.save()
- return redirect("iot_index")
-
-
-def download_report(request, report_uuid):
- firmware_analysis_request = FirmwareAnalysisRequest.objects.get(
- report_uuid=report_uuid
- )
- link = firmware_analysis_request.report_link
- firmware_analysis_request.report_link = None
- firmware_analysis_request.save()
- return redirect(link)
-
-
-def test(request):
- return redirect("https://stackoverflow.com")
diff --git a/pyproject.toml b/pyproject.toml
index 9417a14f..b87baa83 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -32,7 +32,6 @@ croniter = ">=1.0.15,<1.1.0"
imap-tools = "^0.57.0"
xmltodict = "^0.13.0"
ipwhois = "^1.2.0"
-onekey-client = "^2.0.2"
psutil = "^5.9.4"
certifi = "^2023.7.22"
django-enumfields = "^2.1.1"
diff --git a/requirements.in b/requirements.in
index 0c60f8ca..64111be4 100644
--- a/requirements.in
+++ b/requirements.in
@@ -1,3 +1,7 @@
+beautifulsoup4
+blake2signer
+cryptography
+defusedxml
django
django-bootstrap5
django-cors-headers
@@ -8,22 +12,18 @@ django-picklefield
django-widget-tweaks
djangorestframework
djangorestframework-simplejwt
+dnspython
drf-spectacular
drf-spectacular-sidecar
-onekey-client
-python-decouple
-redis
-weasyprint
-pylookyloo
-pillow
ipwhois
-dnspython
-pypandora
-pyvulnerabilitylookup
-defusedxml
matplotlib
-beautifulsoup4
-python3-nmap
+pillow
+psycopg2
pycryptodome
-cryptography
-blake2signer
+pylookyloo
+pypandora
+python-decouple
+python3-nmap
+pyvulnerabilitylookup
+redis
+weasyprint
diff --git a/requirements.txt b/requirements.txt
index bc69ca20..4fb26a2e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -785,10 +785,6 @@ numpy==2.2.2 \
# via
# contourpy
# matplotlib
-onekey-client==2.3.0 \
- --hash=sha256:08bfc333ae57a27f914d51939b7e3bde8e5179cef31ecec151499706efda5457 \
- --hash=sha256:7b656b1fdffcb7c99111e74c17aa3756679481c69ae83856ac924b0f95ca0e05
- # via -r requirements.in
packaging==24.2 \
--hash=sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759 \
--hash=sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f
diff --git a/testing/templates/pdf_wrapper.html b/testing/templates/pdf_wrapper.html
index 792ef4b7..ac9382e0 100644
--- a/testing/templates/pdf_wrapper.html
+++ b/testing/templates/pdf_wrapper.html
@@ -1,7 +1,6 @@
-
-
+