GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 134.29.175.74  /  Your IP : 216.73.216.160
Web Server : nginx/1.10.2
System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586
User : Administrator ( 0)
PHP Version : 7.1.0
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Program Files/NVIDIA Corporation/vGPU Licensing/ProxySettings/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : C:/Program Files/NVIDIA Corporation/vGPU Licensing/ProxySettings/grid-proxy-credentials.ps1
###############################################################################
# Copyright (c) 2023 NVIDIA Corporation
###############################################################################
# All rights reserved.  All information contained herein is proprietary and
# confidential to NVIDIA Corporation.  Any use, reproduction, or disclosure
# without the written permission of NVIDIA Corporation is prohibited.
###############################################################################
###############################################################################

<#
.SYNOPSIS
    Script to encrypt and save password in a file that will be used by
    vGPU licensing service for proxy server authentication

.DESCRIPTION
    Establishing connection to authenticated proxy server using Basic, NTLM
    authentication requires proxy user credentials. This script prompts
    for password to be entered. The entered password is encrypted and saved
    in the output file path selected from 'Select Output File Path' dialog box.
    This credentials file will be used by vGPU licensing service for
    proxy server authentication.
    
.EXAMPLE
    PS> grid-proxy-credentials.ps1"
#>

<# .SYNOPSIS #>


# Public Key to encrypt
$publicKey = "BgIAAACkAABSU0ExABAAAAEAAQCZ0LNe+OCxlbULJvFn3tDKJky0EeuOCo3/mbBI7N24YNyZyO9h
bDTJ6u5ti/DKM44PNFxr8u5It50mNs/JL1BXCAYe3Uhm2agQfpEdIDNmgtx1MjYkLrGz64OBbJaW
9lxjNnlxwCBZQ525HIRWLLINNaxoXThL5GzmNyaXLeu2uzBgGao3Pxl409XBWj3U4hdcBRo233Mj
LUfh+agOD4HmtbsHnQKgsI3dmvjmtkZb2GOUQLr9gNZxz3ySGMNGiMOYVkIANHKB9IJdyMFvfjtC
dmWK+c/YqGHBc4c2e7f2k6OcEq0+Al5mCrGV8NV4AUJG6Blc6v2fZMTuTKfuhg9N0X6s0Kb07qnG
5LLVkiUxhHFtgGif3YW9bHOPrWGXit788yiAXemParqAcpFXM2Nkwtk/g2WV/hkm8iOqW96zeXCp
KB4B6KGx8OvDxKDm3L547zMAD3ovhnC0lvi7lFSpj8dREf5ddVP56KiyQ1l1NzNQX/g9h0Cnojed
5WPe5QMWwU8uPYrV1oKCMx8NM/4uf/WwDjOzBnq3OnuzjJYe/G7l02qzXmvQ1QNsR52eZA0Muu/W
69zdqWoxB0WBBl8Gaqf6/yOeCon6VdwthJZLm7aZUcPr54JIpyG4WYZHWojmcvsu9oWu9vx6/HGQ
GAhpX25PcFGcGzqco3BHUkdtuw=="

Function EncryptCredentials
{
    # Set flag to stop script execution on error
    $ErrorActionPreference = "Stop"
    
    
    # Check if System.Security.Cryptography.RSACng exists
    try
    {
       $isRsaCngFound = [System.Security.Cryptography.RSACng] -is [type]
    }
    catch
    {
        Write-Host "ERROR: Cannot run this script due to missing dependency. $_"
        return
    }
    
    # Base64 Decode the public key buffer
    $publicKeyBytes = [System.Convert]::FromBase64String($publicKey)
    
    # Import decoded public key buffer
    $cngPublicKey = [System.Security.Cryptography.CngKey]::Import($publicKeyBytes, [System.Security.Cryptography.CngKeyBlobFormat]::GenericPublicBlob)
    if ([string]::IsNullOrEmpty($cngPublicKey))
    {
        Write-Host "ERROR: Failed to import public key"
        return
    }
    
    Add-Type -AssemblyName System.Windows.Forms
    $saveDlg = New-Object System.Windows.Forms.SaveFileDialog
    $saveDlg.Title = "Select Output File Path"
    $saveDlg.Filter = "All Files (*.*)|*.*"
    $saveDlg.SupportMultiDottedExtensions = $true
    $saveDlg.InitialDirectory = "C:\Program Files\NVIDIA Corporation\vGPU Licensing\ProxySettings\"
    $saveDlg.CheckFileExists = $false

    if($saveDlg.ShowDialog() -eq 'Ok')
    {
        # Get user input password to encrypt
        $password = Read-Host -AsSecureString "Enter Password"
        $bstr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($password)
        $cleartext = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($bstr)
        [Runtime.InteropServices.Marshal]::ZeroFreeBSTR($bstr)

        # Check for user input
        if ([string]::IsNullOrEmpty($cleartext))
        {
            Write-Host "ERROR: Cannot encrypt an empty string"
            return
        }

        # Encrypt the input data
        $dataBytes = [System.Text.Encoding]::UTF8.GetBytes($cleartext)
        $encryptor = [System.Security.Cryptography.RSACng]::new($cngPublicKey)
        $encryptedBytes = $Encryptor.Encrypt($DataBytes, [System.Security.Cryptography.RSAEncryptionPadding]::OaepSHA1)
        $encryptedBase64String = [System.Convert]::ToBase64String($encryptedBytes)
        $cleartext = ""

        # Write the encrypted content in selected file
        Set-Content -Path $saveDlg.filename -Value $encryptedBase64String -NoNewline
        Write-Host "Encrypted credentials file is created at $($saveDlg.filename)"
    }
}

# Encrypt proxy server credentials
EncryptCredentials

Anon7 - 2022
AnonSec Team