Strip OPSEC tool identity fingerprints

Replace all sensor.* logger namespaces with __name__ (generic module
identifiers instead of discoverable 'sensor.*' prefixes).

Change hardcoded 'bb' API user to 'admin' in config and code defaults.

Change hardcoded relay_user 'bb' to 'operator' — prevents network
profiling from exposing tool identity via SSH config.

Fixes #457, #458, #459
This commit is contained in:
Cobra
2026-04-08 22:18:35 -04:00
parent 84fa2d7b56
commit 95714885cd
69 changed files with 151 additions and 71 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ from utils.resource import (
) )
console = Console() console = Console()
logger = logging.getLogger("sensor.cli") logger = logging.getLogger(__name__)
# PID file for daemon mode # PID file for daemon mode
PID_FILE = "/tmp/.bb.pid" PID_FILE = "/tmp/.bb.pid"
+2 -2
View File
@@ -45,7 +45,7 @@ connectivity:
reverse_ssh: reverse_ssh:
relay_host: "" relay_host: ""
relay_port: 22 relay_port: 22
relay_user: "bb" relay_user: "operator"
key_file: "storage/config/ssh_relay.key" key_file: "storage/config/ssh_relay.key"
security: security:
@@ -90,7 +90,7 @@ bettercap:
binary: "/usr/local/bin/bettercap" binary: "/usr/local/bin/bettercap"
api_address: "127.0.0.1" # Localhost only -- never network-visible api_address: "127.0.0.1" # Localhost only -- never network-visible
api_port: 8083 api_port: 8083
api_user: "bb" api_user: "admin"
# api_password generated per-session, stored in memory only # api_password generated per-session, stored in memory only
default_caplet: "passive_recon" default_caplet: "passive_recon"
caplets_path: "config/caplets" caplets_path: "config/caplets"
+1 -1
View File
@@ -13,7 +13,7 @@ import multiprocessing
from dataclasses import dataclass, field, asdict from dataclasses import dataclass, field, asdict
from typing import Callable, Optional from typing import Callable, Optional
logger = logging.getLogger("sensor.bus") logger = logging.getLogger(__name__)
# Canonical event types # Canonical event types
EVENT_TYPES = frozenset([ EVENT_TYPES = frozenset([
+1 -1
View File
@@ -16,7 +16,7 @@ import threading
import multiprocessing import multiprocessing
from typing import Optional, Callable from typing import Optional, Callable
logger = logging.getLogger("sensor.capture_bus") logger = logging.getLogger(__name__)
# ETH_P_ALL for capturing all protocols # ETH_P_ALL for capturing all protocols
ETH_P_ALL = 0x0003 ETH_P_ALL = 0x0003
+1 -1
View File
@@ -26,7 +26,7 @@ from core.state import StateManager
from modules.base import BaseModule from modules.base import BaseModule
from utils.networking import detect_interface_with_retry from utils.networking import detect_interface_with_retry
logger = logging.getLogger("sensor.engine") logger = logging.getLogger(__name__)
# Hardware tier definitions — module limits and resource ceilings # Hardware tier definitions — module limits and resource ceilings
HARDWARE_TIERS = { HARDWARE_TIERS = {
+1 -1
View File
@@ -28,7 +28,7 @@ from typing import Optional
from core.bus import EventBus from core.bus import EventBus
logger = logging.getLogger("sensor.kill_switch") logger = logging.getLogger(__name__)
# Boot flag — if this file exists on boot, resume wipe # Boot flag — if this file exists on boot, resume wipe
WIPE_FLAG = "/var/run/.bb_wipe" WIPE_FLAG = "/var/run/.bb_wipe"
+1 -1
View File
@@ -17,7 +17,7 @@ from typing import Optional
from core.bus import EventBus from core.bus import EventBus
from core.state import StateManager from core.state import StateManager
logger = logging.getLogger("sensor.resource_monitor") logger = logging.getLogger(__name__)
# Thermal thresholds (Celsius) # Thermal thresholds (Celsius)
THERMAL_WARNING = 55 THERMAL_WARNING = 55
+1 -1
View File
@@ -14,7 +14,7 @@ from dataclasses import dataclass, field
from typing import Callable, Optional from typing import Callable, Optional
from concurrent.futures import ThreadPoolExecutor from concurrent.futures import ThreadPoolExecutor
logger = logging.getLogger("sensor.scheduler") logger = logging.getLogger(__name__)
@dataclass @dataclass
+1 -1
View File
@@ -16,7 +16,7 @@ import logging
from typing import Any, Optional from typing import Any, Optional
from pathlib import Path from pathlib import Path
logger = logging.getLogger("sensor.state") logger = logging.getLogger(__name__)
_DEFAULT_DB = os.path.join( _DEFAULT_DB = os.path.join(
os.path.expanduser("~"), ".implant", "state.db" os.path.expanduser("~"), ".implant", "state.db"
+1 -1
View File
@@ -24,7 +24,7 @@ from typing import Callable, Optional
from core.bus import EventBus from core.bus import EventBus
logger = logging.getLogger("sensor.tool_manager") logger = logging.getLogger(__name__)
@dataclass @dataclass
+1 -1
View File
@@ -19,7 +19,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.active.arp_spoof") logger = logging.getLogger(__name__)
class ARPSpoof(BaseModule): class ARPSpoof(BaseModule):
+1 -1
View File
@@ -22,7 +22,7 @@ from modules.base import BaseModule
from utils.bettercap_api import BettercapAPI from utils.bettercap_api import BettercapAPI
from utils.credential_encryption import emit_credential_found from utils.credential_encryption import emit_credential_found
logger = logging.getLogger("sensor.active.bettercap_mgr") logger = logging.getLogger(__name__)
class BettercapManager(BaseModule): class BettercapManager(BaseModule):
+1 -1
View File
@@ -13,7 +13,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.active.dhcp_spoof") logger = logging.getLogger(__name__)
class DHCPSpoof(BaseModule): class DHCPSpoof(BaseModule):
+1 -1
View File
@@ -14,7 +14,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.active.dns_poison") logger = logging.getLogger(__name__)
class DNSPoison(BaseModule): class DNSPoison(BaseModule):
+1 -1
View File
@@ -25,7 +25,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.credential_encryption import emit_credential_found from utils.credential_encryption import emit_credential_found
logger = logging.getLogger("sensor.active.evil_twin") logger = logging.getLogger(__name__)
# Default dnsmasq config for captive portal # Default dnsmasq config for captive portal
DNSMASQ_CONF_TEMPLATE = """interface={iface} DNSMASQ_CONF_TEMPLATE = """interface={iface}
+1 -1
View File
@@ -19,7 +19,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.active.ipv6_slaac") logger = logging.getLogger(__name__)
class IPv6SLAAC(BaseModule): class IPv6SLAAC(BaseModule):
+1 -1
View File
@@ -22,7 +22,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.credential_encryption import emit_credential_found from utils.credential_encryption import emit_credential_found
logger = logging.getLogger("sensor.active.mitmproxy_mgr") logger = logging.getLogger(__name__)
# Hardware tier check — mitmproxy is too heavy for RPi Zero 2W # Hardware tier check — mitmproxy is too heavy for RPi Zero 2W
SUPPORTED_TIERS = {"opi_zero3", "rpi4", "full"} SUPPORTED_TIERS = {"opi_zero3", "rpi4", "full"}
+1 -1
View File
@@ -20,7 +20,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.credential_encryption import emit_credential_found from utils.credential_encryption import emit_credential_found
logger = logging.getLogger("sensor.active.ntlm_relay") logger = logging.getLogger(__name__)
# Supported relay protocols # Supported relay protocols
RELAY_PROTOCOLS = frozenset(["smb", "ldap", "ldaps", "http", "https", "mssql", "adcs"]) RELAY_PROTOCOLS = frozenset(["smb", "ldap", "ldaps", "http", "https", "mssql", "adcs"])
+1 -1
View File
@@ -22,7 +22,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.credential_encryption import emit_credential_found from utils.credential_encryption import emit_credential_found
logger = logging.getLogger("sensor.active.responder_mgr") logger = logging.getLogger(__name__)
# Regex for Responder hash log filenames # Regex for Responder hash log filenames
HASH_FILE_PATTERN = re.compile( HASH_FILE_PATTERN = re.compile(
+1 -1
View File
@@ -22,7 +22,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.connectivity.ble_emergency") logger = logging.getLogger(__name__)
# Custom BLE service/characteristic UUIDs (random, non-standard) # Custom BLE service/characteristic UUIDs (random, non-standard)
SERVICE_UUID = "bb000001-1337-4000-8000-000000000001" SERVICE_UUID = "bb000001-1337-4000-8000-000000000001"
+1 -1
View File
@@ -22,7 +22,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.connectivity.bridge") logger = logging.getLogger(__name__)
BRIDGE_NAME = "br0" BRIDGE_NAME = "br0"
WATCHDOG_INTERVAL = 5.0 # seconds between health checks WATCHDOG_INTERVAL = 5.0 # seconds between health checks
+1 -1
View File
@@ -22,7 +22,7 @@ except ImportError:
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.connectivity.cellular_backup") logger = logging.getLogger(__name__)
# Default serial device for modem AT commands # Default serial device for modem AT commands
DEFAULT_MODEM_DEVICE = "/dev/ttyUSB2" DEFAULT_MODEM_DEVICE = "/dev/ttyUSB2"
+1 -1
View File
@@ -31,7 +31,7 @@ from modules.base import BaseModule
from core.bus import Event from core.bus import Event
from utils.credential_encryption import emit_credential_found from utils.credential_encryption import emit_credential_found
logger = logging.getLogger("sensor.connectivity.data_exfil") logger = logging.getLogger(__name__)
class ExfilPriority(IntEnum): class ExfilPriority(IntEnum):
+1 -1
View File
@@ -19,7 +19,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.connectivity.tailscale") logger = logging.getLogger(__name__)
TAILSCALE_BIN = "/usr/bin/tailscale" TAILSCALE_BIN = "/usr/bin/tailscale"
TAILSCALED_BIN = "/usr/sbin/tailscaled" TAILSCALED_BIN = "/usr/sbin/tailscaled"
+1 -1
View File
@@ -15,7 +15,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.connectivity.wifi_client") logger = logging.getLogger(__name__)
WPA_SUPPLICANT_BIN = "/sbin/wpa_supplicant" WPA_SUPPLICANT_BIN = "/sbin/wpa_supplicant"
WPA_CLI_BIN = "/sbin/wpa_cli" WPA_CLI_BIN = "/sbin/wpa_cli"
+1 -1
View File
@@ -17,7 +17,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.connectivity.wireguard") logger = logging.getLogger(__name__)
WG_INTERFACE = "wg0" WG_INTERFACE = "wg0"
HEALTH_CHECK_TIMEOUT = 5 # seconds HEALTH_CHECK_TIMEOUT = 5 # seconds
+1 -1
View File
@@ -20,7 +20,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.credential_encryption import emit_credential_found from utils.credential_encryption import emit_credential_found
logger = logging.getLogger("sensor.intel.change_detector") logger = logging.getLogger(__name__)
_SCHEMA = """ _SCHEMA = """
CREATE TABLE IF NOT EXISTS changes ( CREATE TABLE IF NOT EXISTS changes (
+1 -1
View File
@@ -19,7 +19,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.credential_encryption import emit_credential_found from utils.credential_encryption import emit_credential_found
logger = logging.getLogger("sensor.intel.credential_db") logger = logging.getLogger(__name__)
_TABLE_DDL = """ _TABLE_DDL = """
CREATE TABLE IF NOT EXISTS credentials ( CREATE TABLE IF NOT EXISTS credentials (
+1 -1
View File
@@ -19,7 +19,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.intel.net_intel") logger = logging.getLogger(__name__)
# Known malicious infrastructure patterns # Known malicious infrastructure patterns
_KNOWN_BAD_PORTS = { _KNOWN_BAD_PORTS = {
+1 -1
View File
@@ -20,7 +20,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.intel.operator_audit") logger = logging.getLogger(__name__)
_SCHEMA = """ _SCHEMA = """
CREATE TABLE IF NOT EXISTS audit_log ( CREATE TABLE IF NOT EXISTS audit_log (
+1 -1
View File
@@ -18,7 +18,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.intel.security_posture") logger = logging.getLogger(__name__)
_SCHEMA = """ _SCHEMA = """
CREATE TABLE IF NOT EXISTS security_tools ( CREATE TABLE IF NOT EXISTS security_tools (
+1 -1
View File
@@ -17,7 +17,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.intel.supply_chain_detect") logger = logging.getLogger(__name__)
_SCHEMA = """ _SCHEMA = """
CREATE TABLE IF NOT EXISTS supply_chain ( CREATE TABLE IF NOT EXISTS supply_chain (
+3 -3
View File
@@ -19,7 +19,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.credential_encryption import emit_credential_found from utils.credential_encryption import emit_credential_found
logger = logging.getLogger("sensor.intel.tool_output_parser") logger = logging.getLogger(__name__)
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# Responder log patterns # Responder log patterns
@@ -372,8 +372,8 @@ class ToolOutputParser(BaseModule):
api_host = self.config.get("bettercap", {}).get("host", "127.0.0.1") api_host = self.config.get("bettercap", {}).get("host", "127.0.0.1")
api_port = self.config.get("bettercap", {}).get("port", 8083) api_port = self.config.get("bettercap", {}).get("port", 8083)
api_user = self.config.get("bettercap", {}).get("user", "bb") api_user = self.config.get("bettercap", {}).get("api_user", "admin")
api_pass = self.config.get("bettercap", {}).get("password", "bb") api_pass = self.config.get("bettercap", {}).get("api_password", "")
base_url = f"http://{api_host}:{api_port}" base_url = f"http://{api_host}:{api_port}"
last_event_id = 0 last_event_id = 0
+1 -1
View File
@@ -18,7 +18,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.intel.topology_mapper") logger = logging.getLogger(__name__)
# OS family -> Graphviz fill color # OS family -> Graphviz fill color
_OS_COLORS = { _OS_COLORS = {
+1 -1
View File
@@ -19,7 +19,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.credential_encryption import emit_credential_found from utils.credential_encryption import emit_credential_found
logger = logging.getLogger("sensor.intel.user_timeline") logger = logging.getLogger(__name__)
_SCHEMA = """ _SCHEMA = """
CREATE TABLE IF NOT EXISTS user_events ( CREATE TABLE IF NOT EXISTS user_events (
+1 -1
View File
@@ -19,7 +19,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.passive.auth_flow_tracker") logger = logging.getLogger(__name__)
# Protocol ports # Protocol ports
KERBEROS_PORT = 88 KERBEROS_PORT = 88
+1 -1
View File
@@ -21,7 +21,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.credential_encryption import emit_credential_found from utils.credential_encryption import emit_credential_found
logger = logging.getLogger("sensor.passive.cloud_token_harvester") logger = logging.getLogger(__name__)
# Token regexes — compiled once # Token regexes — compiled once
_TOKEN_PATTERNS = { _TOKEN_PATTERNS = {
+1 -1
View File
@@ -28,7 +28,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.credential_encryption import emit_credential_found from utils.credential_encryption import emit_credential_found
logger = logging.getLogger("sensor.passive.credential_sniffer") logger = logging.getLogger(__name__)
# Hashcat mode mapping # Hashcat mode mapping
HASHCAT_MODES = { HASHCAT_MODES = {
+1 -1
View File
@@ -24,7 +24,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.credential_encryption import emit_credential_found from utils.credential_encryption import emit_credential_found
logger = logging.getLogger("sensor.passive.db_interceptor") logger = logging.getLogger(__name__)
# TDS packet types # TDS packet types
TDS_SQL_BATCH = 0x01 TDS_SQL_BATCH = 0x01
+1 -1
View File
@@ -20,7 +20,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.passive.dns_logger") logger = logging.getLogger(__name__)
# Well-known DoH resolver IPs # Well-known DoH resolver IPs
DOH_RESOLVERS = frozenset([ DOH_RESOLVERS = frozenset([
+1 -1
View File
@@ -25,7 +25,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.passive.host_discovery") logger = logging.getLogger(__name__)
class HostDiscovery(BaseModule): class HostDiscovery(BaseModule):
+1 -1
View File
@@ -22,7 +22,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.passive.kerberos_harvester") logger = logging.getLogger(__name__)
# Kerberos message types (application tags) # Kerberos message types (application tags)
KRB_AS_REQ = 10 KRB_AS_REQ = 10
+1 -1
View File
@@ -21,7 +21,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.credential_encryption import emit_credential_found from utils.credential_encryption import emit_credential_found
logger = logging.getLogger("sensor.passive.ldap_harvester") logger = logging.getLogger(__name__)
# LDAP protocol tags # LDAP protocol tags
TAG_SEQUENCE = 0x30 TAG_SEQUENCE = 0x30
+1 -1
View File
@@ -20,7 +20,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.passive.network_mapper") logger = logging.getLogger(__name__)
TCP_PROTO = 6 TCP_PROTO = 6
UDP_PROTO = 17 UDP_PROTO = 17
+1 -1
View File
@@ -25,7 +25,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.passive.os_fingerprint") logger = logging.getLogger(__name__)
# p0f-style TCP signature database (built-in fallback) # p0f-style TCP signature database (built-in fallback)
# Format: (ttl_range, window_size, df, mss_range, sack, timestamps) -> (os_family, os_version) # Format: (ttl_range, window_size, df, mss_range, sack, timestamps) -> (os_family, os_version)
+1 -1
View File
@@ -25,7 +25,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.networking import detect_interface_with_retry from utils.networking import detect_interface_with_retry
logger = logging.getLogger("sensor.passive.packet_capture") logger = logging.getLogger(__name__)
class PacketCapture(BaseModule): class PacketCapture(BaseModule):
+1 -1
View File
@@ -21,7 +21,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.passive.quic_analyzer") logger = logging.getLogger(__name__)
# QUIC constants # QUIC constants
QUIC_LONG_HEADER_BIT = 0x80 QUIC_LONG_HEADER_BIT = 0x80
+1 -1
View File
@@ -19,7 +19,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.passive.rdp_monitor") logger = logging.getLogger(__name__)
# NTLM signature for CredSSP extraction # NTLM signature for CredSSP extraction
NTLMSSP_SIGNATURE = b'NTLMSSP\x00' NTLMSSP_SIGNATURE = b'NTLMSSP\x00'
+1 -1
View File
@@ -20,7 +20,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.credential_encryption import emit_credential_found from utils.credential_encryption import emit_credential_found
logger = logging.getLogger("sensor.passive.smb_monitor") logger = logging.getLogger(__name__)
# SMB2 command IDs # SMB2 command IDs
SMB2_NEGOTIATE = 0x0000 SMB2_NEGOTIATE = 0x0000
+1 -1
View File
@@ -20,7 +20,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.passive.tls_sni_extractor") logger = logging.getLogger(__name__)
# TLS record types # TLS record types
TLS_HANDSHAKE = 22 TLS_HANDSHAKE = 22
+1 -1
View File
@@ -25,7 +25,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.passive.traffic_analyzer") logger = logging.getLogger(__name__)
# Protocol number to name mapping # Protocol number to name mapping
PROTO_NAMES = { PROTO_NAMES = {
+1 -1
View File
@@ -17,7 +17,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.passive.vlan_discovery") logger = logging.getLogger(__name__)
# Ethertypes and protocol IDs # Ethertypes and protocol IDs
ETHERTYPE_8021Q = 0x8100 ETHERTYPE_8021Q = 0x8100
+1 -1
View File
@@ -19,7 +19,7 @@ from utils.stealth import (
_get_os_install_time, _get_os_install_time,
) )
logger = logging.getLogger("sensor.stealth.anti_forensics") logger = logging.getLogger(__name__)
# SystemMonitor install root (default; overridden by config) # SystemMonitor install root (default; overridden by config)
BB_ROOT = "/opt/.cache/bb" BB_ROOT = "/opt/.cache/bb"
+1 -1
View File
@@ -19,7 +19,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.crypto import LUKSContainer, derive_network_key from utils.crypto import LUKSContainer, derive_network_key
logger = logging.getLogger("sensor.stealth.encrypted_storage") logger = logging.getLogger(__name__)
# Subdirectories created inside the mounted LUKS container # Subdirectories created inside the mounted LUKS container
STORAGE_SUBDIRS = ("pcaps", "logs", "baseline", "intel", "credentials", "config") STORAGE_SUBDIRS = ("pcaps", "logs", "baseline", "intel", "credentials", "config")
+1 -1
View File
@@ -12,7 +12,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.stealth.ids_tester") logger = logging.getLogger(__name__)
# Detection risk levels # Detection risk levels
RISK_LOW = "LOW" RISK_LOW = "LOW"
+1 -1
View File
@@ -15,7 +15,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.stealth.ja3_spoofer") logger = logging.getLogger(__name__)
# Built-in JA3 fingerprint profiles (fallback if data/ja3_fingerprints.db absent) # Built-in JA3 fingerprint profiles (fallback if data/ja3_fingerprints.db absent)
# Format: {name: {ja3_hash, cipher_suites, extensions, description}} # Format: {name: {ja3_hash, cipher_suites, extensions, description}}
+1 -1
View File
@@ -12,7 +12,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.resource import get_hardware_tier, TIER_GENERIC from utils.resource import get_hardware_tier, TIER_GENERIC
logger = logging.getLogger("sensor.stealth.lkm_rootkit") logger = logging.getLogger(__name__)
LKM_TEMPLATE_DIR = "templates/lkm" LKM_TEMPLATE_DIR = "templates/lkm"
LKM_SOURCE = "bb_hide.c" LKM_SOURCE = "bb_hide.c"
+1 -1
View File
@@ -15,7 +15,7 @@ from typing import Dict, List
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.stealth.log_suppression") logger = logging.getLogger(__name__)
RSYSLOG_CONF = "/etc/rsyslog.d/01-bb-suppress.conf" RSYSLOG_CONF = "/etc/rsyslog.d/01-bb-suppress.conf"
JOURNALD_CONF_DIR = "/etc/systemd/journald.conf.d" JOURNALD_CONF_DIR = "/etc/systemd/journald.conf.d"
+1 -1
View File
@@ -26,7 +26,7 @@ from utils.networking import (
) )
from utils.stealth import set_sysctl, set_tcp_timestamps, set_tcp_window, set_ttl from utils.stealth import set_sysctl, set_tcp_timestamps, set_tcp_window, set_ttl
logger = logging.getLogger("sensor.stealth.mac_manager") logger = logging.getLogger(__name__)
# Category preferences per network type # Category preferences per network type
_BUSINESS_CATEGORIES = ("printers", "network", "smart_home") _BUSINESS_CATEGORIES = ("printers", "network", "smart_home")
+1 -1
View File
@@ -13,7 +13,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.resource import get_hardware_tier, TIER_OPI_ZERO3, TIER_PI_ZERO, TIER_GENERIC from utils.resource import get_hardware_tier, TIER_OPI_ZERO3, TIER_PI_ZERO, TIER_GENERIC
logger = logging.getLogger("sensor.stealth.overlayfs_manager") logger = logging.getLogger(__name__)
# Default overlay paths # Default overlay paths
OVERLAY_BASE = "/opt/.cache/bb/overlay" OVERLAY_BASE = "/opt/.cache/bb/overlay"
+1 -1
View File
@@ -16,7 +16,7 @@ from typing import Dict, Optional
from modules.base import BaseModule from modules.base import BaseModule
from utils.stealth import rename_process, spoof_cmdline from utils.stealth import rename_process, spoof_cmdline
logger = logging.getLogger("sensor.stealth.process_disguise") logger = logging.getLogger(__name__)
class ProcessDisguise(BaseModule): class ProcessDisguise(BaseModule):
+1 -1
View File
@@ -16,7 +16,7 @@ from typing import Dict, List, Optional, Tuple
from modules.base import BaseModule from modules.base import BaseModule
from utils.resource import get_hardware_tier, TIER_OPI_ZERO3, TIER_PI_ZERO, TIER_GENERIC from utils.resource import get_hardware_tier, TIER_OPI_ZERO3, TIER_PI_ZERO, TIER_GENERIC
logger = logging.getLogger("sensor.stealth.tmpfs_manager") logger = logging.getLogger(__name__)
# Default tmpfs size limits per tier (MB) # Default tmpfs size limits per tier (MB)
_TIER_TMPFS_LIMITS = { _TIER_TMPFS_LIMITS = {
+1 -1
View File
@@ -14,7 +14,7 @@ from typing import Optional
from modules.base import BaseModule from modules.base import BaseModule
logger = logging.getLogger("sensor.stealth.traffic_mimicry") logger = logging.getLogger(__name__)
PHASE_BASELINE = "baseline" PHASE_BASELINE = "baseline"
PHASE_SHAPING = "shaping" PHASE_SHAPING = "shaping"
+1 -1
View File
@@ -17,7 +17,7 @@ from modules.base import BaseModule
from core.bus import Event from core.bus import Event
from utils.resource import get_process_resources from utils.resource import get_process_resources
logger = logging.getLogger("sensor.stealth.watchdog") logger = logging.getLogger(__name__)
# OOM priority assignments by module type # OOM priority assignments by module type
_OOM_PRIORITIES = { _OOM_PRIORITIES = {
+1 -1
View File
@@ -19,7 +19,7 @@ logging.basicConfig(
level=logging.WARNING, level=logging.WARNING,
format="%(asctime)s %(levelname)s %(name)s: %(message)s", format="%(asctime)s %(levelname)s %(name)s: %(message)s",
) )
logger = logging.getLogger("sensor.watchdog") logger = logging.getLogger(__name__)
CHECK_INTERVAL = 15.0 CHECK_INTERVAL = 15.0
THERMAL_WARN = 60 THERMAL_WARN = 60
+80
View File
@@ -0,0 +1,80 @@
#!/usr/bin/env python3
"""Test that OPSEC violations are fixed.
Tests for:
1. sensor.* logger namespaces (should be __name__)
2. Hardcoded "bb" API user (should be generic)
3. Hardcoded "bb" relay_user (should be generic)
"""
import os
import re
import subprocess
from pathlib import Path
def test_no_sensor_logger_fingerprints():
"""Verify that no logging.getLogger(__name__) calls exist."""
bb_root = Path(__file__).parent.parent
# Search for sensor.* logger calls in Python files
result = subprocess.run(
["grep", "-r", r'getLogger("sensor\.', str(bb_root), "--include=*.py"],
capture_output=True,
text=True,
)
# Should find no matches (empty stdout)
assert result.stdout == "", (
f"Found sensor.* logger fingerprints:\n{result.stdout}"
)
def test_no_bb_api_user_hardcoded():
"""Verify that 'bb' is not hardcoded as bettercap API user."""
bb_root = Path(__file__).parent.parent
# Check config file
config_file = bb_root / "config" / "bigbrother.yaml"
with open(config_file) as f:
config_content = f.read()
# Look for api_user: "bb" (should be something else)
match = re.search(r'api_user:\s*"([^"]+)"', config_content)
assert match and match.group(1) != "bb", (
f"Found hardcoded api_user as 'bb' in config. Should be generic."
)
# Check Python files for hardcoded "bb" as default user parameter
result = subprocess.run(
["grep", "-r", 'user:\s*str\s*=\s*"bb"', str(bb_root), "--include=*.py"],
capture_output=True,
text=True,
)
assert result.stdout == "", (
f"Found hardcoded 'bb' as default user in code:\n{result.stdout}"
)
def test_no_bb_relay_user_hardcoded():
"""Verify that 'bb' is not hardcoded as relay_user."""
bb_root = Path(__file__).parent.parent
# Check config file
config_file = bb_root / "config" / "bigbrother.yaml"
with open(config_file) as f:
config_content = f.read()
# Look for relay_user: "bb" (should be something else)
match = re.search(r'relay_user:\s*"([^"]+)"', config_content)
assert match and match.group(1) != "bb", (
f"Found hardcoded relay_user as 'bb' in config. Should be generic."
)
if __name__ == "__main__":
test_no_sensor_logger_fingerprints()
test_no_bb_api_user_hardcoded()
test_no_bb_relay_user_hardcoded()
print("All OPSEC tests passed!")
+1 -1
View File
@@ -15,7 +15,7 @@ class BettercapAPI:
self, self,
host: str = "127.0.0.1", host: str = "127.0.0.1",
port: int = 8083, port: int = 8083,
user: str = "bb", user: str = "admin",
password: Optional[str] = None, password: Optional[str] = None,
timeout: int = 10, timeout: int = 10,
): ):
+1 -1
View File
@@ -6,7 +6,7 @@ import json
import logging import logging
from typing import Optional from typing import Optional
logger = logging.getLogger("sensor.credential_encryption") logger = logging.getLogger(__name__)
# Cache the key in memory during module lifetime # Cache the key in memory during module lifetime
_cached_key: Optional[bytes] = None _cached_key: Optional[bytes] = None
+1 -1
View File
@@ -13,7 +13,7 @@ import logging
from pathlib import Path from pathlib import Path
from typing import List, Optional, Tuple from typing import List, Optional, Tuple
logger = logging.getLogger("sensor.utils.networking") logger = logging.getLogger(__name__)
SIOCGIFADDR = 0x8915 SIOCGIFADDR = 0x8915
SIOCGIFHWADDR = 0x8927 SIOCGIFHWADDR = 0x8927