Hide Code Powershell RRS feed

  • Question

  • Greeting,

    I have a powershell script with 3 lines which are "Secret Code"...

    what is the best way to hide them.

    After my research, I think I can compile it to EXE file with some software.

    but will be possible only encrypt that 3 lines only, and the others are keep clean text in PS1 format!

    Thanks and Best Regards,

    Newbie in Powershell

    • Moved by Bill_Stewart Wednesday, July 26, 2017 7:47 PM User in way over his head (cryptography)
    Friday, June 23, 2017 2:20 PM

All replies

  • What is the code and who are you trying to hide it from? If they're credentials then they can be stored and used in encrypted formats.

    *This response is filled more with intrigue than any solutions*

    Friday, June 23, 2017 2:23 PM
  • Thanks, the code more like a door access code
    Friday, June 23, 2017 2:36 PM
  • Seems to me you only want the code for the door to be encrypted. Why not just converto-securestring? I think you may be best Googling how to store credentials and reverse engineering that way :) let me know if I'm missing anything.

    read-host -assecurestring | convertfrom-securestring | out-file C:\Users\harwoodm\Desktop\test.txt
    $password = Get-Content C:\Users\harwoodm\Desktop\test.txt | ConvertTo-SecureString
    $credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "testusername",$password

    Friday, June 23, 2017 2:53 PM
  • Security 101: If it can be executed then it must be decrypted.  If it can be decrypted then it is not secret.


    Friday, June 23, 2017 4:47 PM
  • Thanks for help

    my idea is covert to hash.

    say, the door access code is "1234567" then I pre-hash it become "797cb93f8b1159e6dc68b2b7fddd6c55"

    then use the pre-hashed code covert to the securesting, then provide in the script

    but just do not how to do that is the script

    Thanks and Best Regards,

    Newbie in PowerShell

    Friday, June 23, 2017 6:00 PM
  • Thanks for advises


    Friday, June 23, 2017 6:01 PM