Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Import-Module c:oracleWalletCreatorWASP.dll
- $WalletCreated = 0
- cls
- Write-Host " " -foregroundcolor White -backgroundcolor DarkRed
- Write-Host " Warning: This script will delete your current wallet. " -foregroundcolor White -backgroundcolor DarkRed
- Write-Host " " -foregroundcolor White -backgroundcolor DarkRed
- do {
- #Get credentials
- Write-Host " "
- Write-Host " New Wallet Entry " -foregroundcolor White -backgroundcolor DarkGreen
- Write-Host " To exit press return without entering anything. " -foregroundcolor White -backgroundcolor DarkGreen
- $DB = Read-Host "Connection Name"
- if ($DB -eq "") {
- Return
- }
- $Username = Read-Host " Username"
- if ($Username -eq "") {
- Return
- }
- $Password = Read-Host -AsSecureString " Password"
- #Convert from SecureString to String.
- $BasicString = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Password)
- $Password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BasicString)
- if ($Password -eq "") {
- Return
- }
- if ($WalletCreated -eq 0) {
- #Create folder in case it doesn't exist.
- md c:oracleWallets -Force | Out-Null
- #Delete any wallet in the folder now.
- del c:oracleWallets*.* | Out-Null
- #Get GUID for wallet password.
- $WalletPassword = [guid]::NewGuid().toString()
- $WalletPassword = $WalletPassword + "`r"
- #Create Wallet.
- Start-Process -FilePath mkstore -ArgumentList "-wrl c:oracleWallets -create"
- Start-Sleep -Milliseconds 500
- Select-Window -ProcessName cmd | Select -First 1 | Send-Keys -keys $WalletPassword
- Start-Sleep -Milliseconds 300
- Select-Window -ProcessName cmd | Select -First 1 | Send-Keys -keys $WalletPassword
- $WalletCreated = 1
- Start-Sleep -Milliseconds 1000
- }
- #Create Credential.
- $CC = "-wrl c:oracleWallets -createCredential " + $DB + " "
- $CC = $CC + $Username + " " + $Password
- Start-Process -FilePath mkstore -ArgumentList $CC
- Start-Sleep -Milliseconds 300
- Select-Window -ProcessName cmd | Select -First 1 | Send-Keys -keys $WalletPassword
- Start-Sleep -Milliseconds 1000
- }
- until ($DB -eq "")
Add Comment
Please, Sign In to add comment