> your AI agent picks dependencies from memory; give it dated facts — try starlog.dev ↗ vet your agent's deps ↗ vibe-coding is fine. vibe-importing isn’t. — try starlog.dev ↗ vibe-importing isn’t fine ↗ your agent has never seen your private packages — try starlog.dev ↗ facts for private packages ↗ a linter for the dependencies your AI agent picks — try starlog.dev ↗ a linter for agent deps ↗

Back to Articles

V3SP3R: Controlling a Hardware Hacking Tool with Natural Language AI

[ View on GitHub ]

V3SP3R: Controlling a Hardware Hacking Tool with Natural Language AI

Hook

What if you could photograph a hotel room card reader, describe what you want to do in plain English, and have an AI figure out the attack vector and execute it through your Flipper Zero—all while preventing you from accidentally bricking the device?

Context

The Flipper Zero democratized hardware hacking by packaging radio, infrared, RFID, and GPIO capabilities into a $169 handheld device. But democratization doesn't mean accessibility. To clone an RFID card, you navigate through nested menus: SubGHz → Read → Configure frequency → Select modulation → Set bandwidth → Capture signal. Want to replay an IR remote? You need to know the protocol (NEC? RC5? Samsung?), understand timing constraints, and remember which menu path leads to transmission versus storage.

This knowledge barrier isn't accidental—it's protective. Hardware hacking tools are dangerous in untrained hands. But it also means legitimate use cases (pentesting, IoT research, accessibility projects) require either extensive documentation-diving or muscle memory. V3SP3R attacks this problem by inserting an LLM between user intent and device execution. You say "clone this access card," and the AI translates that into the precise sequence of RPC commands the Flipper Zero understands. The twist: it does this while maintaining a safety layer that prevents the AI from issuing destructive commands without explicit human confirmation.

Technical Insight

V3SP3R's architecture revolves around a Kotlin Android app that orchestrates three critical components: BLE communication with Flipper Zero, OpenRouter API integration for LLM access, and a command validation engine. The app doesn't just send text to an AI and hope for the best—it implements a structured tool-use pattern where the LLM receives context about the Flipper's current state and a manifest of available operations.

The command flow starts when you submit input (text, voice, or image). The app queries the Flipper's current state via RPC, then constructs a prompt that includes this state data, available tools (with schemas), and your request. Here's what the tool definition structure looks like:

data class FlipperTool(
    val name: String,
    val description: String,
    val riskLevel: RiskLevel,
    val parameters: Map<String, ParameterSchema>,
    val rpcCommand: String
)

enum class RiskLevel {
    LOW,      // Read operations, status checks
    MEDIUM,   // File operations, non-destructive writes
    HIGH,     // Protocol transmission, GPIO manipulation
    CRITICAL  // Firmware operations, factory resets
}

val tools = listOf(
    FlipperTool(
        name = "read_rfid",
        description = "Read RFID tag in proximity",
        riskLevel = RiskLevel.LOW,
        parameters = mapOf(
            "protocol" to ParameterSchema("string", listOf("EM4100", "HIDProx"))
        ),
        rpcCommand = "rfid.read"
    ),
    FlipperTool(
        name = "transmit_subghz",
        description = "Transmit SubGHz signal at specified frequency",
        riskLevel = RiskLevel.HIGH,
        parameters = mapOf(
            "frequency" to ParameterSchema("integer", range = 300_000_000..928_000_000),
            "file_path" to ParameterSchema("string")
        ),
        rpcCommand = "subghz.tx_from_file"
    )
)

When the LLM responds with a tool invocation, V3SP3R doesn't blindly execute it. The validation engine checks the risk level and applies different confirmation flows. LOW risk operations execute automatically with logging. MEDIUM operations show a toast notification. HIGH and CRITICAL operations block until you explicitly approve them in the UI, showing you exactly what RPC command will be sent and what parameters it includes.

The multimodal aspect is where things get interesting. The smart glasses integration uses a Node.js bridge that captures camera frames and streams them to the Android app. You can point at a remote control, say "copy this remote," and the vision-enabled LLM (like GPT-4 Vision or Claude 3) analyzes the image, identifies it as an IR remote, extracts brand/model information, and generates the appropriate command sequence: detect IR protocol → capture signals → save to storage → confirm successful write.

Here's the BLE communication layer that translates validated commands into Flipper RPC calls:

class FlipperBLEManager(private val context: Context) {
    private var gatt: BluetoothGatt? = null
    private val commandQueue = LinkedBlockingQueue<RPCCommand>()
    
    fun executeCommand(tool: FlipperTool, params: Map<String, Any>): Flow<CommandResult> = flow {
        val rpcPayload = buildRPCPayload(tool.rpcCommand, params)
        val characteristic = gatt?.getService(FLIPPER_SERVICE_UUID)
            ?.getCharacteristic(FLIPPER_RX_UUID)
            ?: throw BluetoothException("Flipper not connected")
        
        // Write command
        characteristic.value = rpcPayload.toByteArray()
        gatt?.writeCharacteristic(characteristic)
        
        // Listen for response on TX characteristic
        val response = suspendCancellableCoroutine<ByteArray> { continuation ->
            responseCallbacks[rpcPayload.id] = continuation
        }
        
        emit(parseRPCResponse(response))
    }.flowOn(Dispatchers.IO)
    
    private fun buildRPCPayload(command: String, params: Map<String, Any>): RPCPayload {
        return RPCPayload(
            id = UUID.randomUUID().toString(),
            command = command,
            params = params,
            timestamp = System.currentTimeMillis()
        )
    }
}

The audit logging is comprehensive—every command, whether approved or rejected, gets written to local storage with timestamps, full parameters, LLM reasoning (extracted from the response), and execution results. This creates a forensic trail critical for security research and debugging unexpected behavior.

What makes this architecture compelling is how it balances flexibility with safety. The LLM can chain multiple tools (read card → analyze protocol → configure transmitter → confirm replication), handling complex workflows that would require multiple menu navigations. But each step in that chain goes through validation, so you never get surprised by an AI deciding to factory reset your Flipper because it misunderstood "restore this signal" as "restore to factory settings."

Gotcha

The elephant in the room is API costs and latency. Every interaction hits OpenRouter, which means you're paying per-token charges (typically $0.002-0.02 per request depending on model choice) and waiting for network round-trips. If you use V3SP3R frequently, those costs accumulate. There's no caching layer for repeated commands, no local model fallback. You're in an airport with spotty Wi-Fi? You're back to manual Flipper operation.

Bluetooth reliability is the second pain point. BLE connections are finicky under ideal conditions; add the complexity of streaming RPC commands and parsing responses, and you'll encounter disconnections. The codebase includes extensive reconnection logic and diagnostic logging, which tells you the developers have fought this battle. When the connection drops mid-command execution, you're left in an uncertain state—did the Flipper receive that transmit command or not? The audit logs help, but it's still disruptive to workflow. Android BLE stack quirks vary by manufacturer (Samsung handles concurrent connections differently than Pixel devices), adding another variable. And iOS? Forget it. Apple's BLE restrictions make this impossible without jailbreaking, cutting out half the mobile ecosystem.

Verdict

Use if: You're a Flipper Zero owner who values speed over manual precision, especially for repetitive tasks like cataloging IR remotes or testing multiple SubGHz frequencies. The risk classification makes it suitable for security researchers who want AI assistance with guardrails, not full autopilot. It's particularly valuable in educational settings where explaining "what you want to do" is more important than memorizing menu hierarchies. The smart glasses integration is genuinely novel for hands-free pentesting scenarios. Skip if: You need offline operation, can't justify ongoing API costs, or prefer deterministic control over your hardware tools. Also skip if you're on iOS, uncomfortable with an LLM intermediary making decisions about hardware operations (even with safety layers), or working in environments where audit trails going through third-party APIs (OpenRouter) create compliance issues. If you're already fluent in Flipper operation, the AI layer adds latency without proportional value—stick with qFlipper or the official mobile app.