Skip to content

RedTeamSubnet/dev-fingerprinter-challenge

Repository files navigation

Device Fingerprinter V1 Challenge

The Device Fingerprinter V1 Challenge is designed to test the skills of miners in developing a browser SDK that can accurately detect the driver type used by bots interacting with a webpage. The new iteration has two more bot frameworks to be detected and more strict evaluation criteria. Participants must create an SDK that can be installed on a website and automatically identify various bot drivers based on their behavior or technical characteristics.

image

✨ Features

  • SDK for browser type detection
  • Scoring based on accuracy of detection
  • API server for challenge interaction
  • Health check endpoint
  • Dockerfile for deployment
  • FastAPI
  • Web service

🛠 Installation

1. 🚧 Prerequisites

2. 📥 Download or clone the repository

[TIP] Skip this step, if you have already downloaded the source code.

2.1. Prepare projects directory (if not exists):

# Create projects directory:
mkdir -pv ~/workspaces/projects

# Enter into projects directory:
cd ~/workspaces/projects

2.2. Follow one of the below options [A], [B] or [C]:

OPTION A. Clone the repository:

git clone https://github.com/RedTeamSubnet/RedTeam.git && \
    cd RedTeam/redteam_core/challenge_pool/dev_fingerprinter_v1

OPTION B. Clone the repository (for DEVELOPMENT: git + ssh key):

git clone --recursive git@github.com:RedTeamSubnet/RedTeam.git && \
    cd RedTeam/redteam_core/challenge_pool/dev_fingerprinter_v1 && \
    git submodule update --init --recursive && \
    git submodule foreach --recursive git checkout main

3. 📦 Install dependencies

[TIP] Skip this step, if you're going to use docker runtime

pip install -r ./requirements.txt

4. 🏁 Start the server

Standalone runtime (Python)

OPTION A. Run server as python module:

python -u -m src.api

# Or:
cd src
python -u -m api

OPTION B. Run server as python script:

cd src
python -u ./main.py

OPTION C. Run with uvicorn cli:

uvicorn src.main:app --host=[BIND_HOST] --port=[PORT] --no-access-log --no-server-header --proxy-headers --forwarded-allow-ips="*"
# For example:
uvicorn src.main:app --host="0.0.0.0" --port=10001 --no-access-log --no-server-header --proxy-headers --forwarded-allow-ips="*"


# Or:
cd src
uvicorn main:app --host="0.0.0.0" --port=10001 --no-access-log --no-server-header --proxy-headers --forwarded-allow-ips="*"

# For DEVELOPMENT:
uvicorn main:app --host="0.0.0.0" --port=10001 --no-access-log --no-server-header --proxy-headers --forwarded-allow-ips="*" --reload --reload-include="*.yml" --reload-include=".env"

Docker runtime

OPTION D. Run with docker compose:

## 1. Configure 'compose.override.yml' file.

# Copy 'compose.override.[ENV].yml' file to 'compose.override.yml' file:
cp -v ./templates/compose/compose.override.[ENV].yml ./compose.override.yml
# For example, DEVELOPMENT environment:
cp -v ./templates/compose/compose.override.dev.yml ./compose.override.yml
# For example, STATGING or PRODUCTION environment:
cp -v ./templates/compose/compose.override.prod.yml ./compose.override.yml

# Edit 'compose.override.yml' file to fit in your environment:
nano ./compose.override.yml


## 2. Check docker compose configuration is valid:
./compose.sh validate
# Or:
docker compose config


## 3. Start docker compose:
./compose.sh start -l
# Or:
docker compose up -d --remove-orphans --force-recreate && \
    docker compose logs -f --tail 100

5. ✅ Check server is running

Check with CLI (curl):

# Send a ping request with 'curl' to API server and parse JSON response with 'jq':
curl -s -k https://localhost:10001/ping | jq

Check with web browser:

6. 🛑 Stop the server

Docker runtime:

# Stop docker compose:
./compose.sh stop
# Or:
docker compose down --remove-orphans

👍


⚙️ Configuration

🌎 Environment Variables

.env.example:

## --- Environment variable --- ##
ENV=LOCAL
DEBUG=false


## -- API configs -- ##
DFP_API_PORT=10001
# DFP_API_LOGS_DIR="/var/log/rest.dfp-challenger"
# DFP_API_DATA_DIR="/var/lib/rest.dfp-challenger"

# DFP_API_VERSION="1"
# DFP_API_PREFIX=""
# DFP_API_DOCS_ENABLED=true
# DFP_API_DOCS_OPENAPI_URL="{api_prefix}/openapi.json"
# DFP_API_DOCS_DOCS_URL="{api_prefix}/docs"
# DFP_API_DOCS_REDOC_URL="{api_prefix}/redoc"

🏗️ Build Docker Image

To build the docker image, run the following command:

# Build docker image:
./scripts/build.sh
# Or:
docker compose build

📑 References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •