1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Why is my Raspberry Pi Pico not doing anything with the payload.dd file after...

Discussão em 'Python' iniciado por Stack, Outubro 3, 2024 às 14:02.

  1. Stack

    Stack Membro Participativo

    I followed dbisus's guide on GitHub to create a BadUSB device using my Raspberry Pi Pico. After downloading the necessary files listed in the tutorial, I carefully followed all the steps provided.

    However, when I attempt to boot the Pico, it fails to run the payload.dd file that I uploaded. I ensured that the file was correctly placed in the appropriate directory on the Pico and that the device was properly configured.

    The Pico did change to the name CircuitPY. After which i followed the steps below:

    1)Download adafruit-circuitpython-bundle-8.x-mpy-YYYYMMDD.zip here and extract it outside the device.

    2)Navigate to lib in the recently extracted folder and copy adafruit_hid to the lib folder on your Raspberry Pi Pico.

    3)Copy adafruit_debouncer.mpy and adafruit_ticks.mpy to the lib folder on your Raspberry Pi Pico.

    4)Copy asyncio to the lib folder on your Pico.

    5)Copy adafruit_wsgi to the lib folder on your Pico.

    [​IMG]

    6)Copy boot.py from your clone to the root of your Pico.

    7)Copy duckyinpython.py, code.py, webapp.py, wsgiserver.py to the root folder of the Pico.

    [​IMG]

    Here is the link to the repo where i got my payload.dd https://github.com/hak5/usbrubberdu...ibrary/prank/Change Wallpaper With Screenshot

    And the contents of my payload.dd file that just changes the background of a windows device to a screenshot because it is virtually harmless and would be a good test

    import os

    try:
    import pyautogui
    except:
    os.system("pip install pyautogui")
    import pyautogui

    from time import sleep

    from PIL import Image
    import ctypes

    sleep(5)
    screenshot = pyautogui.screenshot()
    screenshot.save("screenshot.png")

    img = Image.open('screenshot.png')

    user32 = ctypes.windll.user32
    screensize = user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)
    img = img.resize(screensize)

    image_path = os.path.abspath('screenshot.png')
    ctypes.windll.user32.SystemParametersInfoW(20, 0, image_path, 0)


    This i put in a notepad file which i renamed to "payload.dd"

    And finally my code.py file in case i configured that incorrectly:

    # License : GPLv2.0
    # copyright (c) 2023 Dave Bailey
    # Author: Dave Bailey (dbisu, @daveisu)
    # Pico and Pico W board support


    import supervisor


    import time
    import digitalio
    from board import *
    import board
    from duckyinpython import *
    if(board.board_id == 'raspberry_pi_pico_w'):
    import wifi
    from webapp import *


    # sleep at the start to allow the device to be recognized by the host computer
    time.sleep(.5)

    def startWiFi():
    import ipaddress
    # Get wifi details and more from a secrets.py file
    try:
    from secrets import secrets
    except ImportError:
    print("WiFi secrets are kept in secrets.py, please add them there!")
    raise

    print("Connect wifi")
    #wifi.radio.connect(secrets['ssid'],secrets['password'])
    wifi.radio.start_ap(secrets['ssid'],secrets['password'])

    HOST = repr(wifi.radio.ipv4_address_ap)
    PORT = 80 # Port to listen on
    print(HOST,PORT)

    # turn off automatically reloading when files are written to the pico
    #supervisor.disable_autoreload()
    supervisor.runtime.autoreload = False

    if(board.board_id == 'raspberry_pi_pico'):
    led = pwmio.PWMOut(board.LED, frequency=5000, duty_cycle=0)
    elif(board.board_id == 'raspberry_pi_pico_w'):
    led = digitalio.DigitalInOut(board.LED)
    led.switch_to_output()


    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

    async def main_loop():
    global led,button1

    button_task = asyncio.create_task(monitor_buttons(button1))
    if(board.board_id == 'raspberry_pi_pico_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)
    else:
    pico_led_task = asyncio.create_task(blink_pico_led(led))
    await asyncio.gather(pico_led_task, button_task)

    asyncio.run(main_loop())


    In summary, what happened after i uploaded my payload.dd is nothing, after unplugging and plugging back in, the pico just opened up the file explorer again and nothing was done. I followed network chucks tutorial too before i tried these steps also with no luck. Any help would be appreciated.

    Continue reading...

Compartilhe esta Página