Skip to content

Instantly share code, notes, and snippets.

@fjlopezs
Forked from tuxfight3r/jenkins-decrypt.groovy
Last active April 19, 2018 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fjlopezs/5f6bf96c9db7b5f44f20f69745540615 to your computer and use it in GitHub Desktop.
Save fjlopezs/5f6bf96c9db7b5f44f20f69745540615 to your computer and use it in GitHub Desktop.
Decrypting Jenkins Password
#To Decrypt Jenkins Password from credentials.xml
#<username>jenkins</username>
#<passphrase>your-sercret-hash-S0SKVKUuFfUfrY3UhhUC3J</passphrase>
#go to the jenkins url
http://jenkins-host/script
#In the console paste the script
hashed_pw='your-sercret-hash-S0SKVKUuFfUfrY3UhhUC3J'
passwd = hudson.util.Secret.decrypt(hashed_pw)
println(passwd)
---
String key = "Vo1hb2DfqHO5U0AdneAmVon1B54VLZr6+2I1AoeONhw="
def secret = hudson.util.Secret.fromString(key)
println(secret.getPlainText())
This key is just an example, if your try, you would be get a null value, since this key was encrypted with a secret hash. Each installation of Jenkins has a different secret file.
There are hash exist with and without curly braces, if your key contains curly braces you must include this in key variable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment