/* FPGAlover.com https://fpgalover.com/boards/arduino-boards/84-xiao-seeeduino-hid-device-to-shutdown-your-friend-windows-computer FPGAlover is not resposible for what you can do based on this example to your friend's computer or any other computer, this should solely be seen and used for academic purposes and entertaiment ones. So it is up to you and it will be totally your resposability if you decide to do with this information anything else. Rember to read this https://www.eccouncil.org/ethical-hacking/ */ #include "Adafruit_TinyUSB.h" // HID report descriptor using TinyUSB's template // Single Report (no ID) descriptor uint8_t const desc_hid_report[] = { TUD_HID_REPORT_DESC_KEYBOARD(), }; Adafruit_USBD_HID usb_hid; // Array of pins and its keycode // For keycode definition see BLEHidGeneric.h char buf0[]="FPGALover Visitor \nI would like you to know that\n"; char buf00[]="...\n"; char buf1[]="You are the best thing that has ever happened to me!\n"; char buf36[]=" __ ,, ,, __ \n"; char buf37[]=" ) ) /'') ''\\ ( ( \n"; char buf38[]=" \\( /<( )>\\ )/ \n"; char buf39[]=" `( )`) ('( )' \n"; char buf40[]=" `-`- -'-' I wuv you\n"; uint8_t hidcode[] = { HID_KEY_0, HID_KEY_1, HID_KEY_2, HID_KEY_3 , HID_KEY_4, HID_KEY_5 }; // Output report callback for LED indicator such as Caplocks void hid_report_callback(uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize) { // LED indicator is output report with only 1 byte length if ( report_type != HID_REPORT_TYPE_OUTPUT ) return; // The LED bit map is as follows: (also defined by KEYBOARD_LED_* ) // Kana (4) | Compose (3) | ScrollLock (2) | CapsLock (1) | Numlock (0) uint8_t ledIndicator = buffer[0]; // turn on LED if caplock is set digitalWrite(LED_BUILTIN, ledIndicator & KEYBOARD_LED_CAPSLOCK); } // the setup function runs once when you press reset or power the board void setup() { usb_hid.setPollInterval(2); usb_hid.setReportDescriptor(desc_hid_report, sizeof(desc_hid_report)); usb_hid.setReportCallback(NULL, hid_report_callback); usb_hid.begin(); // led pin pinMode(LED_BUILTIN, OUTPUT); digitalWrite(LED_BUILTIN, LOW); // wait until device mounted while( !USBDevice.mounted() ) delay(1); } void print_return(){ uint8_t keycode[6] = {HID_KEY_RETURN}; usb_hid.keyboardReport(0, 0, keycode); } void print_period(){ uint8_t keycode[6] = {HID_KEY_PERIOD}; usb_hid.keyboardReport(0, 0, keycode); } void print_home(){ uint8_t keycode[6] = { HID_KEY_HOME}; usb_hid.keyboardReport(0, 0, keycode); delay(10); usb_hid.keyboardRelease(0); delay(100); } void keyboard_hold_key(uint8_t key){ uint8_t keycode[6] = {key}; usb_hid.keyboardReport(0, 0, keycode); } void print_backslash(){ uint8_t keycode[6] = {HID_KEY_BACKSLASH}; usb_hid.keyboardReport(0, 0, keycode); delay(10); usb_hid.keyboardRelease(0); delay(100); } void print_ln(char * message, char len,char delays){ char charactercecito=0; for(int i=0; i