Guest User

Untitled

a guest
Jun 25th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. <#
  2. Accepts a password as input and renders the following output
  3. Also copies the output to the clipboard
  4.  
  5. $pass = @('01000000d08c9ddf0115d1118c7a00c04fc297eb01000000d347b7678cdb8d40bf8073abefd0bb7a000000000200000000001066000000010000200000004'
  6. 'aa126631f8f35b721a6ce33477fcbad0eb313961ec900eeb4ef385e71b92486000000000e80000000020000200000003dafc271c57062ed6387a481b65fee32800f663c'
  7. 'a0827828d7489dde5f6372cd20000000ac3e85b63f6a72bb49b6301028c21ae9e964f612aea4b7bae29879493ffb8fdb40000000dbdf265894401eaf4a65527342065a1'
  8. '74375bb741626755b6b2a17b8c1f7013c63b1253613d21b5163d875e6cd7be7c6d7329d478ccfa1c0cf0ea65e070b1552') -join '' | ConvertTo-SecureString
  9.  
  10. #>
  11. function Get-PrettySecureString {
  12. [CmdletBinding()]
  13. param (
  14. # Password
  15. [Parameter(Mandatory)]
  16. [string]
  17. $Password
  18. )
  19.  
  20. $ss = $Password | ConvertTo-SecureString -AsPlainText -Force
  21.  
  22. $tmp = $ss | ConvertFrom-SecureString
  23.  
  24. $1 = $tmp.Substring(0, 125)
  25. $2 = $tmp.Substring(125, 135)
  26. $3 = $tmp.Substring(260, 135)
  27. $4 = $tmp.Substring(395, 97)
  28.  
  29. $res = "`$pass = @('{0}'`r`n'{1}'`r`n'{2}'`r`n'{3}') -join '' | ConvertTo-SecureString" -f $1, $2, $3, $4
  30. $res | clip
  31. Write-Host 'The following code has been copied to your clipboard:' -ForegroundColor DarkYellow
  32. Write-Host $res -ForegroundColor DarkGray
  33. }
  34.  
  35. Get-PrettySecureString -Password 'Testing1234'
  36.  
  37. <#
  38. C:\> Get-PrettySecureString -Password 'Testing1234'
  39. The following code has been copied to your clipboard:
  40. $pass = @('01000000d08c9ddf0115d1118c7a00c04fc297eb01000000d347b7678cdb8d40bf8073abefd0bb7a000000000200000000001066000000010000200000002'
  41. '592b8c73120c0885254d2c51f5d281a61c82aa48237b3aec0e626b0b9013d23000000000e8000000002000020000000044b02d655f9e356d1b7c0b02973c440c52599a7'
  42. '9f52ca9589d62398204718d220000000bfca4a491ebcad6d59dadda99b27fc3c7afaf6c5660253cf4b707e6cdbf31810400000002a3759742e8687f228526af37efc7a7'
  43. 'c7014b829c7135a3dfcda8554c3f1a5fb5dfe77f3f5cb1ddba12d3e2a575259b21f5445b8cba1823dee0ce97d20b95da4') -join '' | ConvertTo-SecureString
  44. #>
Add Comment
Please, Sign In to add comment