mirror of
https://github.com/dbisu/pico-ducky.git
synced 2025-12-06 02:41:45 +00:00
Adds Keystroke Reflection Exfoliation (#335)
* Adds Hak5's Keystroke Reflection Exfoliation Adds a way to read in caps, scroll, and num lock so that you can export information from the attack into a loot.bin. Has some caveats on how it works * Fixed programing status bug
This commit is contained in:
38
code.py
38
code.py
@@ -5,8 +5,8 @@
|
||||
|
||||
|
||||
import supervisor
|
||||
|
||||
|
||||
import os
|
||||
import pwmio
|
||||
import time
|
||||
import digitalio
|
||||
from board import *
|
||||
@@ -47,20 +47,22 @@ elif(board.board_id == 'raspberry_pi_pico_w' or board.board_id == 'raspberry_pi_
|
||||
led = digitalio.DigitalInOut(board.LED)
|
||||
led.switch_to_output()
|
||||
|
||||
async def run_payload_on_startup():
|
||||
progStatus = False
|
||||
progStatus = getProgrammingStatus()
|
||||
print("progStatus", progStatus)
|
||||
if(progStatus == False):
|
||||
print("Finding payload")
|
||||
if "loot.bin" in os.listdir("/"):
|
||||
print("loot.bin exists, skipping payload execution.")
|
||||
else:
|
||||
payload = selectPayload()
|
||||
await asyncio.sleep(0.1)
|
||||
print("Running")
|
||||
awaitrunScript(payload)
|
||||
else:
|
||||
print("Done")
|
||||
|
||||
progStatus = False
|
||||
progStatus = getProgrammingStatus()
|
||||
print("progStatus", progStatus)
|
||||
if(progStatus == False):
|
||||
print("Finding payload")
|
||||
# not in setup mode, inject the payload
|
||||
payload = selectPayload()
|
||||
print("Running ", payload)
|
||||
runScript(payload)
|
||||
|
||||
print("Done")
|
||||
else:
|
||||
print("Update your payload")
|
||||
|
||||
led_state = False
|
||||
|
||||
@@ -68,15 +70,17 @@ async def main_loop():
|
||||
global led,button1
|
||||
|
||||
button_task = asyncio.create_task(monitor_buttons(button1))
|
||||
payload_task = asyncio.create_task(run_payload_on_startup())
|
||||
led_task = asyncio.create_task(monitor_led_changes())
|
||||
if(board.board_id == 'raspberry_pi_pico_w' or board.board_id == 'raspberry_pi_pico2_w'):
|
||||
pico_led_task = asyncio.create_task(blink_pico_w_led(led))
|
||||
print("Starting Wifi")
|
||||
startWiFi()
|
||||
print("Starting Web Service")
|
||||
webservice_task = asyncio.create_task(startWebService())
|
||||
await asyncio.gather(pico_led_task, button_task, webservice_task)
|
||||
await asyncio.gather(pico_led_task, button_task, webservice_task, payload_task, led_task)
|
||||
else:
|
||||
pico_led_task = asyncio.create_task(blink_pico_led(led))
|
||||
await asyncio.gather(pico_led_task, button_task)
|
||||
await asyncio.gather(pico_led_task, button_task, payload_task, led_task )
|
||||
|
||||
asyncio.run(main_loop())
|
||||
|
||||
Reference in New Issue
Block a user