Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
3 changes: 0 additions & 3 deletions compose/staging/.env

This file was deleted.

13 changes: 6 additions & 7 deletions compose/staging/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand All @@ -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
21 changes: 18 additions & 3 deletions compose/staging/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,12 +25,24 @@ services:
cache_from:
- testing-platform:nginx
image: "testing-platform:nginx"
restart: unless-stopped
volumes:
- ../../static:/var/www/testing_platform/static
ports:
- '80:80'
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:
5 changes: 1 addition & 4 deletions iot_inspector/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
13 changes: 0 additions & 13 deletions iot_inspector/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 {
Expand Down
13 changes: 0 additions & 13 deletions iot_inspector/helpers_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions landing_page/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ <h3 class="text-primary-primary-blue">Toolbox</h3>
<span class="font-size-16 lh-sm text-muted">Create DMARC and/or SPF policies which help you to enhance your e-mail security!</span>
</div>

<div class="card-link rounded-box-20 d-flex flex-1 align-items-start flex-column box-shadow multi-purpose-gray-200_border multi-purpose-gray-50_background-hover" data-href="/iot-testing/">
<div class="card-link rounded-box-20 d-flex flex-1 align-items-start flex-column box-shadow multi-purpose-gray-200_border multi-purpose-gray-50_background-hover" data-href="#">
<span class="background-icon primary-primary-blue_background mb-3">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M221-240q42 0 71-29t29-71q0-24-11-47t-33-37l-36-24v-252q0-9-5.5-14.5T221-720q-9 0-14.5 5.5T201-700v252l-36 24q-22 15-33 37t-11 47q0 42 29 71t71 29Zm0 80q-75 0-127.5-52T41-340q0-48 22-86t58-62v-212q0-42 29-71t71-29q42 0 71 29t29 71v212q36 24 58 62t22 86q0 75-52.5 127.5T221-160Zm327-200q-48-33-78-85t-30-115q0-100 70-170t170-70q100 0 170 70t70 170q0 63-30 115t-78 85H548Zm28-80h212q27-24 39.5-54t12.5-66q0-66-47-113t-113-47q-66 0-113 47t-47 113q0 36 14.5 66t41.5 54Zm104 280q-24 0-42-18t-18-42h120q0 24-18 42t-42 18Zm-120-80v-80h240v80H560ZM221-340Zm459-240Z"/></svg>
</span>
<span class="font-size-20 fw-bold lh-sm text-blue-gradient mb-2">IOT Firmware Testing</span>
<span class="font-size-16 lh-sm text-muted">Check your IOT firmware binary!</span>
<span class="font-size-16 lh-sm text-muted">Under maintenance ...</span>
</div>
<div class="card-link rounded-box-20 d-flex flex-1 align-items-start flex-column box-shadow multi-purpose-gray-200_border multi-purpose-gray-50_background-hover" data-href="/infra-testing/file-test">
<span class="background-icon primary-primary-blue_background mb-3">
Expand Down
22 changes: 22 additions & 0 deletions manage.py
Original file line number Diff line number Diff line change
@@ -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()
5 changes: 2 additions & 3 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Empty file removed onekey/__init__.py
Empty file.
39 changes: 0 additions & 39 deletions onekey/admin.py

This file was deleted.

6 changes: 0 additions & 6 deletions onekey/apps.py

This file was deleted.

19 changes: 0 additions & 19 deletions onekey/forms.py

This file was deleted.

Loading