Skip to content

Instantly share code, notes, and snippets.

View conclusionlogic's full-sized avatar
🏠
Working from home

Ergo Loorits conclusionlogic

🏠
Working from home
  • GlintPay
  • London
View GitHub Profile
@conclusionlogic
conclusionlogic / jenkins_credentials.groovy
Last active December 27, 2019 18:12
[print jenkins creds] for JCasC #jenkins #groovy #JCasC #credentials
#!/usr/bin/env groovy
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
@conclusionlogic
conclusionlogic / openssl_android
Created December 20, 2019 15:55
[extract SHA256 hash from SSL certificate] for Android certificate pinning #bash #openssl #pinning #android
#!/usr/bin/env bash
## from a running webserver
$ export DOMAIN="example.com"
$ openssl s_client -servername ${DOMAIN} -connect ${DOMAIN}:443 < /dev/null | sed -n "/-----BEGIN/,/-----END/p" | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64 | pbcopy
## from certificate file
$ cat example.com.crt | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64 | pbcopy
@conclusionlogic
conclusionlogic / openssl_ios
Created December 20, 2019 15:53
[extract uint8 hexadecimal value from SSL certificate] for iOS certificate pinning #bash #openssl #pinning #ios
#!/usr/bin/env bash
## from a running webserver
$ export DOMAIN="example.com"
$ openssl s_client -servername ${DOMAIN} -connect ${DOMAIN}:443 < /dev/null | sed -n "/-----BEGIN/,/-----END/p" | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | xxd -i | pbcopy
## from certificate file
$ cat example.com.crt | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | xxd -i | pbcopy