Bluetooth Rubber Ducky (https://forums.hak5.org/topic/41678-bluetooth-rubber-ducky/)
Dependencies: BLE_API mbed nRF51822
Fork of microbit_presenter by
- Backspace = x08
- (F5) = \x86
- (F11) = \x8A
- (F12) = \x8B
- Print Screen = \x8C
- Application Program Command (CTRL+8) \x9F
- (‽)RALT LCTRL RSHIFT LSHIFT F1 LCTRL = \u203d + \u2038 (v.similar)
- Down F1 LCTRL = \u2016
- F1 F1 LCTRL = \u2000
- LALT LSHIFT F2 LCTRL = \u206F
- Insert = \x90
- Home = \x91
- Pageup = \x92
- PageDown = \x93
- Right Shift + Left Control = \uF8FF
- Alt Shift + F (File >) = \x99
- CTRL+B = \x98
- Right Ctrl = \x9a
- Escape + stuff, \x9d
- Test on another PC (rwin) \x9c
- Scroll = \x8d
- Capslock = \x8e
- Numlock = \x8f
- Left = \x95
- Right = \x94
- Up = \x97
- Down = \x96
Full list of special command characters here.
examples_common.cpp
- Committer:
- CalvinR
- Date:
- 2017-08-21
- Revision:
- 3:dc7a04d715a2
- Parent:
- 0:cb1939018833
File content as of revision 3:dc7a04d715a2:
/* mbed Microcontroller Library * Copyright (c) 2015 ARM Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "ble/services/BatteryService.h" #include "HIDDeviceInformationService.h" #include "examples_common.h" static void passkeyDisplayCallback(Gap::Handle_t handle, const SecurityManager::Passkey_t passkey) { printf("Input passKey: "); for (unsigned i = 0; i < Gap::ADDR_LEN; i++) { printf("%c", passkey[i]); } printf("\r\n"); } static void securitySetupCompletedCallback(Gap::Handle_t handle, SecurityManager::SecurityCompletionStatus_t status) { if (status == SecurityManager::SEC_STATUS_SUCCESS) { printf("Security success %d\r\n", status); } else { printf("Security failed %d\r\n", status); } } static void securitySetupInitiatedCallback(Gap::Handle_t, bool allowBonding, bool requireMITM, SecurityManager::SecurityIOCapabilities_t iocaps) { printf("Security setup initiated\r\n"); } void initializeSecurity(BLE &ble) { bool enableBonding = true; bool requireMITM = HID_SECURITY_REQUIRE_MITM; ble.securityManager().onSecuritySetupInitiated(securitySetupInitiatedCallback); ble.securityManager().onPasskeyDisplay(passkeyDisplayCallback); ble.securityManager().onSecuritySetupCompleted(securitySetupCompletedCallback); ble.securityManager().init(enableBonding, requireMITM, HID_SECURITY_IOCAPS); } void initializeHOGP(BLE &ble) { static const uint16_t uuid16_list[] = {GattService::UUID_HUMAN_INTERFACE_DEVICE_SERVICE, GattService::UUID_DEVICE_INFORMATION_SERVICE, GattService::UUID_BATTERY_SERVICE}; PnPID_t pnpID; pnpID.vendorID_source = 0x2; // from the USB Implementer's Forum pnpID.vendorID = 0x0D28; // NXP pnpID.productID = 0x0204; // CMSIS-DAP (well, it's a keyboard but oh well) pnpID.productVersion = 0x0100; // v1.0 HIDDeviceInformationService deviceInfo(ble, "ARM", "m1", "abc", "def", "ghi", "jkl", &pnpID); BatteryService batteryInfo(ble, 80); ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list)); // see 5.1.2: HID over GATT Specification (pg. 25) ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); // 30ms to 50ms is recommended (5.1.2) ble.gap().setAdvertisingInterval(50); }