full permutation generator
#!/usr/bin/python import sys alpha = "" def f(base, l): global alpha if l > 0: ubase = base for i in alpha: base += i print base f(base, l-1) base = ubase if __name__ == '__main__': if len(sys.argv) != 3: print "Usage: ./gen.py aAdx 10" sys.exit(1) else: if 'a' in sys.argv[1]: alpha += "abcdefghijklmnopqrstuvwxyz" if 'A' in sys.argv[1]: alpha += "ABCDEFGHIJKLMNOPQRSTUVWXYZ" if 'd' in sys.argv[1]: alpha += "0123456789" if 'x' in sys.argv[1]: alpha += """\"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ """ # print "use this string: \n" + alpha + "\n" # raw_input() f("", int(sys.argv[2]))
和基於字典檔的 decrypt tool
/usr/share/dict, 或是也可以由以上工具產生 ;-)
#!/usr/bin/python import crypt import sys def testPass(cryptPass, dic): salt = cryptPass[0:2] dictFile = open(dic, 'r') for word in dictFile.readlines(): word = word.strip('\n') ced = crypt.crypt(word, salt) if (ced == cryptPass): print "[+] Found Password: " + word + "\n" return print "[-] Password Not Found.\n" return if __name__ == "__main__": if len(sys.argv) != 3: print 'Usage: ./crypt_crack.py "$CRYPT" "$DICT_FILE"' else: testPass(sys.argv[1], sys.argv[2])
No comments:
Post a Comment