mirror of
https://github.com/dbisu/pico-ducky.git
synced 2025-12-06 02:41:45 +00:00
Add exception handling to file open
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -127,6 +127,7 @@ def runScript(file):
|
||||
global defaultDelay
|
||||
|
||||
duckyScriptPath = file
|
||||
try:
|
||||
f = open(duckyScriptPath,"r",encoding='utf-8')
|
||||
previousLine = ""
|
||||
for line in f:
|
||||
@@ -140,6 +141,8 @@ def runScript(file):
|
||||
parseLine(line)
|
||||
previousLine = line
|
||||
time.sleep(float(defaultDelay)/1000)
|
||||
except OSError as e:
|
||||
print("Unable to open file ", file)
|
||||
|
||||
def selectPayload():
|
||||
payload = "payload.dd"
|
||||
|
||||
Reference in New Issue
Block a user