Guest User

Untitled

a guest
Aug 1st, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. Import-Module c:oracleWalletCreatorWASP.dll
  2.  
  3. $WalletCreated = 0
  4.  
  5. cls
  6. Write-Host " " -foregroundcolor White -backgroundcolor DarkRed
  7. Write-Host " Warning: This script will delete your current wallet. " -foregroundcolor White -backgroundcolor DarkRed
  8. Write-Host " " -foregroundcolor White -backgroundcolor DarkRed
  9.  
  10. do {
  11. #Get credentials
  12. Write-Host " "
  13. Write-Host " New Wallet Entry " -foregroundcolor White -backgroundcolor DarkGreen
  14. Write-Host " To exit press return without entering anything. " -foregroundcolor White -backgroundcolor DarkGreen
  15. $DB = Read-Host "Connection Name"
  16. if ($DB -eq "") {
  17. Return
  18. }
  19. $Username = Read-Host " Username"
  20. if ($Username -eq "") {
  21. Return
  22. }
  23. $Password = Read-Host -AsSecureString " Password"
  24.  
  25. #Convert from SecureString to String.
  26. $BasicString = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Password)
  27. $Password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BasicString)
  28. if ($Password -eq "") {
  29. Return
  30. }
  31.  
  32. if ($WalletCreated -eq 0) {
  33. #Create folder in case it doesn't exist.
  34. md c:oracleWallets -Force | Out-Null
  35.  
  36. #Delete any wallet in the folder now.
  37. del c:oracleWallets*.* | Out-Null
  38.  
  39. #Get GUID for wallet password.
  40. $WalletPassword = [guid]::NewGuid().toString()
  41. $WalletPassword = $WalletPassword + "`r"
  42.  
  43. #Create Wallet.
  44. Start-Process -FilePath mkstore -ArgumentList "-wrl c:oracleWallets -create"
  45. Start-Sleep -Milliseconds 500
  46. Select-Window -ProcessName cmd | Select -First 1 | Send-Keys -keys $WalletPassword
  47. Start-Sleep -Milliseconds 300
  48. Select-Window -ProcessName cmd | Select -First 1 | Send-Keys -keys $WalletPassword
  49.  
  50. $WalletCreated = 1
  51. Start-Sleep -Milliseconds 1000
  52. }
  53.  
  54. #Create Credential.
  55. $CC = "-wrl c:oracleWallets -createCredential " + $DB + " "
  56. $CC = $CC + $Username + " " + $Password
  57. Start-Process -FilePath mkstore -ArgumentList $CC
  58. Start-Sleep -Milliseconds 300
  59. Select-Window -ProcessName cmd | Select -First 1 | Send-Keys -keys $WalletPassword
  60. Start-Sleep -Milliseconds 1000
  61. }
  62. until ($DB -eq "")
Add Comment
Please, Sign In to add comment