From 981a5a7cbcc943c117101535601e5cd721552c02 Mon Sep 17 00:00:00 2001 From: Marc Jones Date: Mon, 3 Feb 2014 11:05:41 -0500 Subject: initial check in of file word search --- encryption-high.txt | 200 +++++++++++++++++++++++++++++++++++++++++++++++++++ encryption-high.txt~ | 107 +++++++++++++++++++++++++++ main.py | 110 ++++++++++++++++++++++++++++ wordlist.txt | 125 ++++++++++++++++++++++++++++++++ wordlist.txt~ | 126 ++++++++++++++++++++++++++++++++ 5 files changed, 668 insertions(+) create mode 100644 encryption-high.txt create mode 100644 encryption-high.txt~ create mode 100755 main.py create mode 100644 wordlist.txt create mode 100644 wordlist.txt~ diff --git a/encryption-high.txt b/encryption-high.txt new file mode 100644 index 0000000..f30ec07 --- /dev/null +++ b/encryption-high.txt @@ -0,0 +1,200 @@ +blowfish +cast-128 +cast 128 +p-array +salsa20 +threefish +rijndael +yarrow +fortuna +tyche +export +tsu +enc +encryption +crypt +crypto +cryptography +cryptographically +cipher +ca +public-key +public key +IDEA +newdes +safer +cas5 +feal +gost 28147-89 +gost +skipjack +des-x +gdes +digitial signature +plaintext +ciphertext +lookup table +permutation +cipher +key-generation +block cipher +des +3des +triple des +aes +nist +rc6 +mars +serpent +subkey +block size +feistel +blowfish +s-box +s box +twofish +key size +finite field +key schedule +key length +mix columns +diffusion +ecb +cbc +nonce +digital rights management +tdea +triple dea +tiger +tiger/128 +tiger/160 +openpgp +skein +cubehash +lucifer +misty1 +feal +ice +kasumi +loki97 +magenta +sms4 +rc2 +rc6 +clefia +key whitening +lai-massey +lai massey +p box +crypto +simonxtea +blake +drm +ofb +ctr +s/mime +smime +elliptic curve +elliptic +ecc +ipes +ipsec +BassOmatic +pskc +pkcs + +ocb +ccm +cwc +gcm +symmetric +symmetric key +asymmetric key +secure hash +md5 +sha +sha-1 +sha-224 +sha-256 +sha-384 +sha-512 +cbc-mac +cmac +hmac +gmac +secure channel +diffie-hellman +diffie +hellman +dh +rsa +alice +bob +negotiation +pki +kerberos +kerb +vpn +certificate +cert +private key +public key +secret key +revocation +auth +authn +authnz +authorization +authenication +root key +key size +salting +secure token +tls +ssl +https +ftps +ssh +sftp +pgp +gpg +pretty good privacy +privacy +decrypt +secret +hash +signature +parity +secure +ear +ofac +munition +rnd +random +prng +pseudorandom +entropy +mac +authority +password +salt +padding +aes-256 +aes-128 +aes +fips 140 +fips-140 +fips 140-2 +fips-140-2 +fips 197 +cavp +whirlpool +decipher +encipher +key length +key expansion +round key +aes-192 + +sbox +openssl diff --git a/encryption-high.txt~ b/encryption-high.txt~ new file mode 100644 index 0000000..e06fed1 --- /dev/null +++ b/encryption-high.txt~ @@ -0,0 +1,107 @@ +rijndael +yarrow +fortuna +tyche +export +tsu +enc +encryption +crypt +crypto +cryptography +cryptographically +cipher +public-key +public key +digitial signature +plaintext +block cipher +des +3des +triple des +aes +serpent +blowfish +twofish +key size +ecb +cbc +nonce +ofb +ctr +ocb +ccm +cwc +gcm +symmetric +symmetric key +asymmetric key +secure hash +md5 +sha +sha-1 +sha-224 +sha-256 +sha-384 +sha-512 +cbc-mac +cmac +hmac +gmac +secure channel +diffie-hellman +diffie +hellman +dh +rsa +alice +bob +negotiation +pki +kerberos +kerb +vpn +certificate +cert +private key +public key +secret key +revocation +auth +authn +authnz +authorization +authenication +root key +key size +salting +secure token +tls +ssl +https +ftps +ssh +sftp +pgp +gpg +pretty good privacy +privacy +decrypt +secret +hash +signature +parity +secure +ear +ofac +munition +rnd +random +prng +pseudorandom +entropy +mac +authority +password +salt +padding diff --git a/main.py b/main.py new file mode 100755 index 0000000..d5e1b37 --- /dev/null +++ b/main.py @@ -0,0 +1,110 @@ +#!/usr/bin/python -i +from optparse import OptionParser +import os +import re +report = {} +wordscore = {} +filescore = {} +filelist = list() + +def sortscore(score, reverse=False): + sortedscore = sorted(score.items(), key=lambda score: score[1], reverse=reverse) + returnscore = [] + for s in sortedscore: + if s[1] > 0: + returnscore.append(s) + + return returnscore + +def printscore(report): + for i in report: + print i[0] + ':' + str(i[1]) + +def wholeword(word, string): + matches = [] + regexU = r'([A-Z]|[^a-zA-Z]|\b)(' + word.lower() + r')([A-Z]|[^a-zA-Z]|\b)' + regexL = r'([a-z]|[^a-zA-Z]|\b)(' + word.upper() + r')([a-z]|[^a-zA-Z]|\b)' + mU = re.search(regexU, string) + if "groups" in dir(mU): + matches.append(mU.groups()) + mL = re.search(regexL, string) + if "groups" in dir(mL): + matches.append(mL.groups()) + return matches + +def skipfile(filename,skippedexts): + if not isinstance(skippedexts, list): + return False + for skip in skippedexts: + if filename.endswith(skip): + return True + return False + +def scoretext(wordlist, text): + score = {} + for word in wordlist: + score[word] = len(wholeword(word,text)) + + return score + +parser = OptionParser() +parser.add_option("-f", "--file", dest="suspiciousfilename", help="specify file to scan", action="append") +parser.add_option("-w", "--wordlist", dest="wordlistfilename", help="file containing all of the words to look for") +parser.add_option("-s", "--skip", dest="skipfileextensions", help="file extensions to skip", action="append") +parser.add_option("-v", "--verbose", dest="verbose", help="print verberose information", default=False) +parser.add_option("-r", "--report", dest="printreport", default="w", help="print score") + +(options, args) = parser.parse_args() + +if options.wordlistfilename: + wordlist = open(options.wordlistfilename).read().lower().split() + +for a in args: + for (path, dirs, files) in os.walk(a): + for file in files: + filelist.append(path + '/' + file) + +if options.suspiciousfilename: + filelist += options.suspiciousfilename + +for file in filelist: + if skipfile(file, options.skipfileextensions): + #print "skip: " + file + continue + try: + f = open(file) + except: + print "failed to open: " + file + continue + + filecontents = f.read() + + report[file] = scoretext(wordlist, filecontents) + +for file in report.keys(): + for word in report[file].keys(): + if not word in wordscore: + wordscore[word] = 0 + if not file in filescore: + filescore[file] = 0 + wordscore[word] += report[file][word] + filescore[file] += report[file][word] + +if options.printreport: + if options.printreport == "f": + printscore(sortscore(filescore)) + else: + printscore(sortscore(wordscore)) + +def test(): + print wholeword("ear","bearth") + print wholeword("ear","BearTH") + print wholeword("ear","bEARth") + print wholeword("ear","ear_") + print wholeword("ear","ear()") + print wholeword("ear","ear.") + print wholeword("ear","ear:") + print wholeword("ear","ear\n\r") + print wholeword("ear","myEAR() MYear: myEAR()") + +#test() diff --git a/wordlist.txt b/wordlist.txt new file mode 100644 index 0000000..61a4d6e --- /dev/null +++ b/wordlist.txt @@ -0,0 +1,125 @@ +rijndael +yarrow +fortuna +tyche +export +tsu +enc +encryption +crypt +crypto +cryptography +cryptographically +cipher +public-key +public key +digitial signature +plaintext +block cipher +des +3des +triple des +aes +serpent +blowfish +twofish +key size +ecb +cbc +nonce +ofb +ctr +ocb +ccm +cwc +gcm +symmetric +symmetric key +asymmetric key +secure hash +md5 +sha +sha-1 +sha-224 +sha-256 +sha-384 +sha-512 +cbc-mac +cmac +hmac +gmac +secure channel +diffie-hellman +diffie +hellman +dh +rsa +alice +bob +negotiation +pki +kerberos +kerb +vpn +certificate +cert +private key +public key +secret key +revocation +auth +authn +authnz +authorization +authenication +root key +key size +salting +secure token +tls +ssl +https +ftps +ssh +sftp +pgp +gpg +pretty good privacy +privacy +decrypt + +[encryption:medium] +secret +hash +signature +parity +secure +ear +ofac +munition +rnd +random +prng +pseudorandom +entropy +key +mac +authority +password +salt +padding +token + +[encryption:low] +block +collision +channel +integrity +seed +reseed +pool +prime + +[encryption:very low] +private +public diff --git a/wordlist.txt~ b/wordlist.txt~ new file mode 100644 index 0000000..73a3355 --- /dev/null +++ b/wordlist.txt~ @@ -0,0 +1,126 @@ +[encryption] +[encryption:high] +rijndael +yarrow +fortuna +tyche +export +tsu +enc +encryption +crypt +crypto +cryptography +cryptographically +cipher +public-key +public key +digitial signature +plaintext +block cipher +des +3des +triple des +aes +serpent +blowfish +twofish +key size +ecb +cbc +nonce +ofb +ctr +ocb +ccm +cwc +gcm +symmetric +symmetric key +asymmetric key +secure hash +md5 +sha +sha-1 +sha-224 +sha-256 +sha-384 +sha-512 +cbc-mac +cmac +hmac +gmac +secure channel +diffie-hellman +diffie +hellman +dh +rsa +alice +bob +negotiation +pki +kerberos +kerb +vpn +certificate +cert +private key +public key +secret key +revocation +auth +authn +authnz +authorization +authenication +root key +key size +salting +secure token +tls +ssl +https +ftps +ssh +sftp +pgp +gpg +pretty good privacy +privacy + +[encryption:medium] +secret +hash +signature +parity +secure +ear +ofac +munition +rnd +random +prng +pseudorandom +entropy +key +mac +authority +password +salt +padding +token + +[encryption:low] +block +collision +channel +integrity +seed +reseed +pool +prime + +[encryption:very low] +private +public -- cgit v1.2.3