├── wordlist.py ├── README.md ├── LICENSE └── DuckyKiller.py /wordlist.py: -------------------------------------------------------------------------------- 1 | wordlist = [ # Expand this later. 2 | "word", "duck", "gator", 3 | "kill", "alpha", "bravo", 4 | "charlie", "delta", "echo", 5 | "foxtrot", "golf", "hotel", 6 | "india", "juliett", "kilo" 7 | ] 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DuckyKiller 2 | Short Python script that attempts to neuter USB Rubber Duckies. 3 | 4 | ### To run this file on Debian or Ubuntu, 5 | * `sudo apt-get install python libusb-1.0-01` 6 | * `sudo apt-get install python-pygame` 7 | * `sudo apt-get install python-usb` 8 | * Navigate to the folder where you've downloaded DuckyKiller.py and wordlist.py, 9 | * `sudo python DuckyKiller.py` 10 | 11 | When a keyboard is plugged in, the script will prompt the user to 12 | type a set of words. Press enter to confirm your input. Press backspace 13 | to clear your input. 14 | 15 | ### Before using this in vital locations, 16 | Please note that this is a work in progress, and likey has issues 17 | which could possibly allow people to circumvent it. I've been unable 18 | to find any other alternatives to BadUSB type shit. Also, on my measily $100 laptop's crappy CPU, this 19 | script hits about five percent while being run from the python interpreter. 20 | 21 | Developer Paypal - http://paypal.me/qkf 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Landon Powell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /DuckyKiller.py: -------------------------------------------------------------------------------- 1 | import time 2 | import usb.core, usb.util 3 | 4 | # generateWords 5 | from random import choice 6 | from wordlist import wordlist 7 | 8 | # detectHuman 9 | import pygame 10 | 11 | def generateWords(): 12 | return " ".join([choice(wordlist) for x in range(4)]) 13 | 14 | def detectHuman(): 15 | pygame.init() 16 | pygame.event.set_grab(True) 17 | screen = pygame.display.set_mode((700, 90)) 18 | screen.fill((50,50,50)) 19 | 20 | words = generateWords() 21 | font = pygame.font.SysFont("monospace", 25) 22 | label = font.render(words, 1, (255,255,255)) 23 | screen.blit(label, (10, 10)) 24 | 25 | newText = "" 26 | 27 | while True: 28 | pygame.display.flip() 29 | events = pygame.event.get() 30 | 31 | for event in events: 32 | if event.type != pygame.KEYDOWN: 33 | pass 34 | 35 | elif event.key == pygame.K_RETURN and newText == words: 36 | pygame.quit() 37 | return True 38 | 39 | elif event.key == pygame.K_BACKSPACE: 40 | newText = "" 41 | 42 | elif event.type == pygame.KEYDOWN and event.key < 256: 43 | newText += chr(event.key) 44 | font = pygame.font.SysFont("monospace", 25) 45 | 46 | if words[:len(newText)] != newText: 47 | color = (255,100,100) 48 | else: 49 | color = (100,255,100) 50 | 51 | input = font.render(newText + "|", 52 | 1, color, 53 | (50,50,50)) 54 | 55 | screen.blit(input, (10, 50)) 56 | 57 | devices = [x for x in usb.core.find(find_all=True, bDeviceClass=0)] 58 | deviceCount = len(devices) 59 | 60 | print("The DuckyKiller is now watching for Rubber Ducks.") 61 | 62 | while True: 63 | devices = [x for x in usb.core.find(find_all=True, bDeviceClass=0)] 64 | time.sleep(.25) 65 | if len(devices) > deviceCount: 66 | detectHuman() 67 | deviceCount = len(devices) 68 | --------------------------------------------------------------------------------