Skip to content

Instantly share code, notes, and snippets.

@gcmurphy
Created February 10, 2015 22:41
Show Gist options
  • Save gcmurphy/d27a16a94bca1bcd5349 to your computer and use it in GitHub Desktop.
Save gcmurphy/d27a16a94bca1bcd5349 to your computer and use it in GitHub Desktop.
Find python crypto usage in openstack
#!/bin/bash
search(){
echo ""
echo "Searching for $1 usage.."
echo ""
grep -nr --include \*.py --exclude test\*.py \
--exclude \*_test\*.py\
--exclude \*tempest\*\
--exclude \*site-packages\* \
-E $2 *
}
main(){
search "hashlib" "[[:space:]]hashlib"
search "passlib" "[[:space:]]passlib"
search "crpytography" "[[:space:]]cryptography"
search "pycrypto" "[[:space:]]pycrypto"
search "openssl" "(\'|\"|[[:space:]])+(o|O)pen(SSL|ssl)"
search "hmac" "[[:space:]]hmac([[:space:]]|\.)" "hmac"
search "cipher" "([[:space:]]|\'|\")(c|C)ipher"
search "aes" "([[:space:]]|\'|\")AES|aes"
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment