Changeset 13


Ignore:
Timestamp:
11/11/12 13:10:42 (12 years ago)
Author:
tmorgan
Message:

added block size and encoding chain options

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bin/bletchley-analyze

    r9 r13  
    3232parser.add_argument('input_file', nargs='?', default=None,
    3333                    help='File containing encrypted blobs to analyze, one per line. Omit to read from stdin.')
     34parser.add_argument('-e', dest='encoding_chain', type=str, default=None,
     35                    help='Comma-separated sequence of formats used to encode the tokens, beginning with the last one applied. (default: auto-detect)')
     36parser.add_argument('-b', dest='block_size', type=int, default=8,
     37                    help='The block size displayed and used in highlighting (default: 8)')
    3438parser.add_argument('-p', dest='output_lines', type=int, default=10,
    3539                    help='Number of lines of input to display in decoded form.')
     
    7680       
    7781        for i in range(0,len(hex),line_size):
    78             line = '%.8X: ' % i
     82            line = '%.4X: ' % i
    7983
    8084            if len(hex[i:]) < line_size:
     
    111115    return encoding,block_sizes
    112116
     117specified_encodings = []
     118if options.encoding_chain != None:
     119    specified_encodings = options.encoding_chain.split(',')
    113120
    114121encoding_chain = []
     
    118125    print('Beginning analysis after decoding by chain: %s' % ','.join(encoding_chain))
    119126    encoding,block_sizes = analyze(blobs)
    120     group_size = 4
    121     if len(block_sizes) > 0 and min(block_sizes) in (8,16):
    122         group_size = min(block_sizes)
     127    if len(specified_encodings) > 0:
     128        encoding = specified_encodings.pop(0)
     129
    123130
    124131    blobs_to_print = blobs[:options.output_lines]
    125132    print('First %d Values:' % len(blobs_to_print))
    126133
    127     printColoredHexDump(blobs_to_print, group_size)
     134    printColoredHexDump(blobs_to_print, options.block_size)
    128135
    129136    if encoding != None:
Note: See TracChangeset for help on using the changeset viewer.