Skip to content

Instantly share code, notes, and snippets.

@Trimad
Created April 7, 2022 22:14
Show Gist options
  • Save Trimad/3be939bc60c6eae1ffd99e4e1032e743 to your computer and use it in GitHub Desktop.
Save Trimad/3be939bc60c6eae1ffd99e4e1032e743 to your computer and use it in GitHub Desktop.
Robo Mirror
SETLOCAL EnableDelayedExpansion
::Step 1. Define the source path.
SET SOURCE="payload"
::Step 2. Define the file name that you will be reading your targets from.
SET FILE_NAME= targets.txt
::Step 3. Define the path to save the log to.
set LOG_PATH="log.txt"
::Step 4. Define what you'd like robocopy to do.
SET WHAT_DO=/MIR /E /LOG+:%LOG_PATH%
::Step 5. Add any additional options.
SET OPTIONS=*.exe *.zip *.sql *.dll
::Step 6. Iterate through every target and robocopy your files to it.
for /F "tokens=*" %%a in ('type %FILE_NAME%') do (
set ip=%%a
robocopy %SOURCE% \\!ip!\c$\UPDATES %WHAT_DO% %OPTIONS%
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment