| 4299 | } |
| 4300 | |
| 4301 | void showHIDSubMenu(NimBLEAddress target) { |
| 4302 | const char *options[] = { |
| 4303 | "Test HID Vulnerability", |
| 4304 | "Force HID Connection", |
| 4305 | "Basic Keystrokes", |
| 4306 | "DuckyScript Injection", |
| 4307 | "OS-Specific Exploits", |
| 4308 | "Run All HID Attacks" |
| 4309 | }; |
| 4310 | |
| 4311 | int choice = showSubMenu("HID Attacks", options, 6); |
| 4312 | if (choice == -1) return; |
| 4313 | |
| 4314 | HIDExploitEngine hid; |
| 4315 | HIDDuckyService ducky; |
| 4316 | |
| 4317 | String deviceName = ""; |
| 4318 | int rssi = -60; |
| 4319 | if (xSemaphoreTake(scannerData.mutex, portMAX_DELAY)) { |
| 4320 | for (size_t i = 0; i < scannerData.deviceAddresses.size(); i++) { |
| 4321 | if (scannerData.deviceAddresses[i] == target.toString().c_str()) { |
| 4322 | deviceName = scannerData.deviceNames[i]; |
| 4323 | rssi = scannerData.deviceRssi[i]; |
| 4324 | break; |
| 4325 | } |
| 4326 | } |
| 4327 | xSemaphoreGive(scannerData.mutex); |
| 4328 | } |
| 4329 | |
| 4330 | switch (choice) { |
| 4331 | case 0: hid.testHIDVulnerability(target); break; |
| 4332 | case 1: hid.forceHIDConnection(target, deviceName, rssi); break; |
| 4333 | case 2: HIDAttackServiceClass().injectKeystrokes(target); break; |
| 4334 | case 3: { |
| 4335 | String script = getScriptFromUser(); |
| 4336 | if (!script.isEmpty()) ducky.injectDuckyScript(target, script); |
| 4337 | break; |
| 4338 | } |
| 4339 | case 4: { |
| 4340 | HIDDeviceProfile profile = hid.analyzeHIDDevice(target, deviceName, rssi); |
| 4341 | if (profile.isAppleDevice) hid.tryAppleMagicSpoof(target, profile); |
| 4342 | else if (profile.isWindowsDevice) hid.tryWindowsHIDBypass(target, profile); |
| 4343 | else if (profile.isAndroidDevice) hid.tryAndroidJustWorks(target, profile); |
| 4344 | break; |
| 4345 | } |
| 4346 | case 5: |
| 4347 | hid.testHIDVulnerability(target); |
| 4348 | hid.forceHIDConnection(target, deviceName, rssi); |
| 4349 | HIDAttackServiceClass().injectKeystrokes(target); |
| 4350 | break; |
| 4351 | } |
| 4352 | } |
| 4353 | |
| 4354 | void showMemorySubMenu(NimBLEAddress target) { |
| 4355 | const char *options[] = { |
no test coverage detected