#!/usr/bin/env python # encoding: utf-8 __description__ = 'a simple tool to determine the crypto/encoding algorithm used according to traces of its representation' __author__ = 'Francisco da Gama Tabanez Ribeiro' __version__ = '0.6' __date__ = '2011/12/04' __license__ = 'WTFPL' import re,sys,argparse,base64 def show(results, result_details, code, analyze=False, textmode=True): for key in results.keys(): if(len(results[key]) > 0): print '%s:' % key,results[key] if analyze: for codetype in results[key]: if codetype in result_details.keys(): print '\t',result_details[codetype] if(len(results['confident']) + len(results['likely']) + len(results['possible']) == 0): print 'unknown! ;(' #(? according to its data representation') parser.add_argument('-t', metavar='filters', default=['win','web','unix','db','other'], type=str, nargs=1, dest='filters', help='filter by source of your string. can be: win, web, db, unix or other') parser.add_argument('-a', '-analyze', dest='analyze', help='show more details whenever possible (expands shadow files fields,...)', required=False, action='store_true') parser.add_argument('-f','-file', dest='filename', nargs=1, help='load a file') parser.add_argument('-l','-list', dest='list', help='lists supported algorithms', required=False, action='store_true') args=parser.parse_args() if(args.list): print "shadow and SAM files, phpBB3, Wordpress, Joomla, CRC, LM, NTLM, MD4, MD5, Apr, SHA1, SHA256, base64, MySQL323, MYSQL4+, DES, RipeMD320, Whirlpool, SHA1, SHA224, SHA256, SHA384, SHA512, Blowfish, Java Session IDs" elif(args.string is not None): results,result_details = get_type_of(args.string, args.filters) show(results, result_details, args.string, args.analyze) elif(args.filename is not None): fl = open(args.filename[0],'r') for line in fl.readlines(): results,result_details = get_type_of(line, args.filters) print "%s : %s" % (line.strip('\n'), results) if args.analyze: for detail in result_details.keys(): print '\t',result_details[detail] fl.close() else: parser.print_help() #@TODO: add OS fingerprinting from shadow/SAM file parsing