printf "$temp_password" | sudo openssl pkeyutl -encrypt -inkey "$public_key_file_path" -pubin -in /dev/stdin -out "$password_file_name.pwd"
mkdir test_dir_for_openssl
cd test_dir_for_openssl
openssl genpkey -algorithm RSA -out private_key.pem
openssl rsa -in private_key.pem -pubout -out public_key.pem
temp_password=Test123
public_key_file_path=public_key.pem
password_file_name=encrypted_password_file
printf "$temp_password" | openssl pkeyutl -encrypt -inkey "$public_key_file_path" -pubin -in /dev/stdin -out "$password_file_name.pwd"
printf "$temp_password" | /usr/bin/openssl pkeyutl -encrypt -in /dev/stdin -pubin -inkey "$public_key_file_path" -out "$password_file_name.pwd"
pkgbuild --identifier com.example.anything --root FolderWithFiles --install-location /tmp/other/folder/again test.pkg
productbuild --identifier com.example.anything --root FolderWithFiles /tmp/other/folder/again test.pkg
try {
# Проверка на возможность записи (например, создание временного файла)
$tempFile = [System.IO.Path]::Combine($FolderPath, [System.IO.Path]::GetRandomFileName())
New-Item -Path $tempFile -ItemType File -Force | Out-Null
Remove-Item -Path $tempFile -Force
Write-Output "Папка может быть удалена без проблем."
} catch {
Write-Output "Произошла ошибка при проверке: $_"
}
# Main script
param (
[string]$filePath,
[string]$searchPattern,
[string]$replacePattern
)
if (-not (Test-Path $filePath)) {
Write-Error "File not found: $filePath"
exit 1
}
# Function to convert hex string to byte array
function Convert-HexStringToByteArray {
param (
[string]$hexString
)
$hexString = $hexString -replace ' ', ''
if ($hexString.Length % 2 -ne 0) {
throw "Invalid hex string length."
}
[byte[]]$byteArray = @()
for ($i = 0; $i -lt $hexString.Length; $i += 2) {
$byteArray += [Convert]::ToByte($hexString.Substring($i, 2), 16)
}
return $byteArray
}
# Function to search and replace hex patterns in a binary file
function SearchAndReplace-HexPatternInBinaryFile {
param (
[string]$filePath,
[string]$searchPattern,
[string]$replacePattern
)
$searchBytes = Convert-HexStringToByteArray -hexString $searchPattern
$replaceBytes = Convert-HexStringToByteArray -hexString $replacePattern
if ($searchBytes.Length -ne $replaceBytes.Length) {
throw "Search and replace patterns must be of the same length."
}
[byte[]]$fileBytes = [System.IO.File]::ReadAllBytes($filePath)
[int]$searchLength = $searchBytes.Length
[int]$index = 0
while ($index -lt $fileBytes.Length) {
$foundIndex = [Array]::IndexOf($fileBytes, $searchBytes[0], $index)
if ($foundIndex -eq -1) {
break
}
$match = $true
for ($i = 1; $i -lt $searchLength; $i++) {
if ($fileBytes[$foundIndex + $i] -ne $searchBytes[$i]) {
$match = $false
break
}
}
if ($match) {
[Array]::Copy($replaceBytes, 0, $fileBytes, $foundIndex, $searchLength)
$index = $foundIndex + $searchLength
} else {
$index = $foundIndex + 1
}
}
[System.IO.File]::WriteAllBytes($filePath, $fileBytes)
}
try {
SearchAndReplace-HexPatternInBinaryFile -filePath $filePath -searchPattern $searchPattern -replacePattern $replacePattern
Write-Output "Hex pattern replaced successfully in $filePath"
} catch {
Write-Error $_.Exception.Message
exit 1
}
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
.\test.ps1 -filePath "D:\TEMP\file.exe" -searchPattern "E8961A00000FB6D8488D4C2440FF1548" -replacePattern "11111111111111111111111111111111"
chown $(stat -f%u:%g "$srcdir") "$dstdir" # Copy owner and group
chmod $(stat -f%Mp%Lp "$srcdir") "$dstdir" # Copy the mode bits
Windows Registry Editor Version 5.00
;Твик ниже удалит (скроет) из «Этот компьютер»:
;Рабочий стол
;Видео
;Документы
;Загрузки
;Изображения
;Музыка
;Объемные объекты
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}]
Windows Registry Editor Version 5.00
;Твик ниже скроет папки пользователя из появления на панели слева под «Этот компьютер»:
;Рабочий стол
;Видео
;Документы
;Загрузки
;Изображения
;Музыка
;Объемные объекты
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}\PropertyBag]
"ThisPCPolicy"="Hide"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{35286a68-3c57-41a1-bbb1-0eae73d76c95}\PropertyBag]
"ThisPCPolicy"="Hide"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{f42ee2d3-909f-4907-8871-4c22fc0bf756}\PropertyBag]
"ThisPCPolicy"="Hide"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{7d83ee9b-2244-4e70-b1f5-5393042af1e4}\PropertyBag]
"ThisPCPolicy"="Hide"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{0ddd015d-b06c-45d5-8c4c-f59713854639}\PropertyBag]
"ThisPCPolicy"="Hide"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{a0c69a99-21c8-4671-8703-7934162fcf1d}\PropertyBag]
"ThisPCPolicy"="Hide"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{31C0DD25-9439-4F12-BF41-7FF4EDA38722}\PropertyBag]
"ThisPCPolicy"="Hide"
% cd /Users/user/Desktop/Melodyne\ 5
% pwd
/Users/user/Desktop/Melodyne 5
% find "/Users/user/Desktop/Melodyne 5" -name "Melodyne"* -type d -maxdepth 3 -print | sort
/Users/user/Desktop/Melodyne 5/Melodyne.app
debug=0x100
keepsyms=1
this.profileDocumentService.getDataOne(profileId, identityTranslationCreateContract).pipe(
switchMap((previousFioResponse) => {
if (previousFioResponse.document) {
return this.documentApiAdapter
.getDataTwo(previousFioResponse.id, previousFioDocument.document)
.pipe(map(() => this.mapPreviousFioDocument([previousFioResponse])));
}
return of(this.mapPreviousFioDocument([previousFioDocument]));
})
);