
DeadManSwitch in rust with several triggers (remote local and network)

Dead Man Switch is a cross-platform security application written in Rust that automatically protects sensitive data in emergency situations. The application monitors multiple trigger mechanisms and executes immediate system lockdown procedures when activated, including encrypted volume dismounting and controlled system shutdown.
Edit src/config.rs to customize settings:
pub fn default() -> Result<Self> {
Self::new(
"YOUR_TELEGRAM_BOT_TOKEN".to_string(),
3600, // Heartbeat timeout (seconds)
45370, // Network broadcast port
"trigger_dms".to_string(), // Network trigger message
"execute".to_string(), // Manual trigger command
0x090c, // USB vendor ID
0x1000, // USB product ID
"auto".to_string(), // Flic IP (auto-detected)
5551, // Flic port
)
}
@BotFather on Telegram/newbot commandBasic form:
./DeadManSwitch --mode <modes> [--trigger]
--mode: comma-separated list of modes. If omitted, all is used.--trigger: execute actions immediately and show the alert UI, without waiting for any external trigger.Available modes:
timer – Telegram heartbeat timerbot – Telegram manual triggernet – UDP broadcast listenerusb – USB VID/PID triggerflic – Flic button triggerall – All of the aboveExamples:
# All triggers (default)
./DeadManSwitch
# Only Telegram heartbeat + USB
./DeadManSwitch --mode timer,usb
# Only network broadcast
./DeadManSwitch --mode net
# Manual trigger only
./DeadManSwitch --trigger
Automatically triggers after specified timeout period without check-in.
Configuration:
telegram_heartbeat_timeout: 3600 // seconds
Execution:
./DeadManSwitch --mode timer
Telegram Commands:
/alive - Reset countdown timer/status - Query time remainingBehavior:
Remote manual control interface.
Setup:
Execution:
./DeadManSwitch --mode bot
Command:
/dms execute - Manual trigger activationLAN-based triggering mechanism.
Configuration:
broadcast_port: 45370
broadcast_message: "trigger_dms"
Execution:
# Protected machine
./DeadManSwitch --mode net
# Trigger from network
echo "trigger_dms" | nc -u -b 255.255.255.255 45370
Hardware-based activation on device connection.
Identifying Device IDs:
git clone https://github.com/BlackSnufkin/Rusty-Playground.git
cd Rusty-Playground/USB_mon
cargo run
# Connect device and note vendor:product IDs
Configuration:
usb_vendor_id: 0x090c
usb_product_id: 0x1000
Execution:
./DeadManSwitch --mode usb
Physical button activation mechanism.
Server Installation:
Button Pairing:
./simpleclient scan
./simpleclient connect <button_address>
Configuration:
flic_ip: "192.168.1.242".to_string() // or "auto" for detection
Execution:
./DeadManSwitch --mode flic
Activation: Press and hold button
ActionExecutor to dismount and shutdown on trigger