diff --git a/README.md b/README.md index 5f4fa05..fe8952c 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ Enter setup mode. Copy boot.py to the root of the pico-ducky. Copy your payload script to the pico-ducky. Disconnect the pico from your host PC. -Connect a jumper wire between pin 18 (GND) and pin 20 (GPIO15). +Connect a jumper wire between pin 18 (`GND`) and pin 20 (`GPIO15`). This will prevent the pico-ducky from showing up as a USB drive when plugged into the target computer. Remove the jumper and reconnect to your PC to reprogram. The default mode is USB mass storage enabled. diff --git a/duckyinpython.py b/duckyinpython.py index 9112537..d82bd1b 100644 --- a/duckyinpython.py +++ b/duckyinpython.py @@ -127,19 +127,22 @@ def runScript(file): global defaultDelay duckyScriptPath = file - f = open(duckyScriptPath,"r",encoding='utf-8') - previousLine = "" - for line in f: - line = line.rstrip() - if(line[0:6] == "REPEAT"): - for i in range(int(line[7:])): - #repeat the last command - parseLine(previousLine) - time.sleep(float(defaultDelay)/1000) - else: - parseLine(line) - previousLine = line - time.sleep(float(defaultDelay)/1000) + try: + f = open(duckyScriptPath,"r",encoding='utf-8') + previousLine = "" + for line in f: + line = line.rstrip() + if(line[0:6] == "REPEAT"): + for i in range(int(line[7:])): + #repeat the last command + parseLine(previousLine) + time.sleep(float(defaultDelay)/1000) + else: + parseLine(line) + previousLine = line + time.sleep(float(defaultDelay)/1000) + except OSError as e: + print("Unable to open file ", file) def selectPayload(): payload = "payload.dd"