#!/bin/bash
cd /usr/lib/python3.6/site-packages/maltrail

# If no arguments provided, use the default config file
if [ $# -eq 0 ]; then
    exec python3 sensor.py -c /etc/maltrail/maltrail.conf
else
    # Check if config file is already specified
    has_config=false
    for arg in "$@"; do
        if [ "$arg" = "-c" ] || [ "$arg" = "--config" ]; then
            has_config=true
            break
        fi
    done
    
    if [ "$has_config" = "false" ]; then
        exec python3 sensor.py -c /etc/maltrail/maltrail.conf "$@"
    else
        exec python3 sensor.py "$@"
    fi
fi
