public DuckyInterface(HIDDevice device) { Device = device; PopulateKeyMaps(); SendPayload(OPEN_PAYLOAD); Thread.Sleep(4000); SendPayload(CM1_PAYLOAD); }
static void Main(string[] args) { AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit); HIDDevice.interfaceDetails[] devices = HIDDevice.getConnectedDevices(); //Select Ducky Shine 6 keyboard, with the 01 interface, the one used for software connection string devicePath = null; try { devicePath = devices.Where(dev => dev.devicePath.Contains("vid_04d9&pid_0203&mi_01")).First().devicePath; } catch (InvalidOperationException e) { Console.WriteLine("Make sure your keyboard is connected !"); Console.ReadKey(); return; } Console.WriteLine("Please DO NOT close this program by clicking on the red cross/closing it rudely, or your keyboard will stay on control mode." + " Just press enter here once you're done."); //Create a handle to the device by calling the constructor device = new HIDDevice(devicePath, false); di = new DuckyInterface(device); //Press enter to safely exit the program.. new Thread(() => { Thread.CurrentThread.IsBackground = true; Console.ReadLine(); di.SendClosePayload(); device.close(); Environment.Exit(4); }).Start(); //Instanciate the web server Thread.CurrentThread.IsBackground = true; HTTPServer server = new HTTPServer(di); }