Changeset 28


Ignore:
Timestamp:
12/21/12 22:44:29 (12 years ago)
Author:
tmorgan
Message:

more documentation
added supported encodings listing

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/bletchley-analyze

    r13 r28  
    2929
    3030
    31 parser = argparse.ArgumentParser(description='Analyzes samples of encrypted data in an attempt to decode samples to binary and identify patterns useful in cryptanalysis.')
     31parser = argparse.ArgumentParser(
     32    description='Analyzes samples of encrypted data in an attempt to decode'
     33    ' samples to binary and identify patterns useful in cryptanalysis.'
     34    ' For more information, see:  http://code.google.com/p/bletchley/wiki/Overview')
    3235parser.add_argument('input_file', nargs='?', default=None,
    33                     help='File containing encrypted blobs to analyze, one per line. Omit to read from stdin.')
     36                    help='File containing encrypted blobs to analyze, one per'
     37                    ' line. Omit to read from stdin.')
    3438parser.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)')
     39                    help='Comma-separated sequence of formats used to encode'
     40                    ' the tokens, beginning with the last one applied. '
     41                    '(default: auto-detect. Use "?" for a listing of supported encodings.)')
    3642parser.add_argument('-b', dest='block_size', type=int, default=8,
    3743                    help='The block size displayed and used in highlighting (default: 8)')
     
    4450options = parser.parse_args()
    4551
     52if options.encoding_chain == '?':
     53    print('\n\t'.join(['Supported encodings:']+blobtools.supportedEncodings()))
     54    sys.exit(0)
     55
    4656input_file = sys.stdin
    4757if options.input_file is not None:
    4858    input_file = file(options.input_file, 'rb')
    49 
    5059
    5160blobs = input_file.read().rstrip('\n').replace('\r', '').split('\n')
  • trunk/bin/bletchley-decode

    r20 r28  
    2828
    2929
    30 parser = argparse.ArgumentParser(description='A simple decoder script that is useful in shell scripts.')
    31 parser.add_argument('input_file', nargs='?', default=None,
    32                     help='File containing encrypted blobs to analyze, one per line. Omit to read from stdin.')
    33 parser.add_argument('-e', dest='encoding_chain', type=str, required=True,
    34                     help='Comma-separated sequence of encoding formats used to encode the token.')
     30parser = argparse.ArgumentParser(
     31    description='A simple decoder script that is useful in shell scripts.'
     32    ' For more information, see:  http://code.google.com/p/bletchley/wiki/Overview')
     33parser.add_argument(
     34    'input_file', nargs='?', default=None,
     35    help='File containing encrypted blobs to analyze, one per line.'
     36    ' Omit to read from stdin.')
     37parser.add_argument(
     38    '-e', dest='encoding_chain', type=str, required=True,
     39    help='Comma-separated sequence of encoding formats used to encode the token.'
     40    ' (Use "?" for a listing of supported encodings.)')
    3541options = parser.parse_args()
     42
     43if options.encoding_chain == '?':
     44    print('\n\t'.join(['Supported encodings:']+blobtools.supportedEncodings()))
     45    sys.exit(0)
    3646
    3747input_file = sys.stdin
  • trunk/bin/bletchley-encode

    r20 r28  
    2828
    2929
    30 parser = argparse.ArgumentParser(description='A simple encoder script that is useful in shell scripts.')
    31 parser.add_argument('input_file', nargs='?', default=None,
    32                     help='File containing encrypted blobs to analyze, one per line. Omit to read from stdin.')
    33 parser.add_argument('-e', dest='encoding_chain', type=str, required=True,
    34                     help='Comma-separated sequence of encoding formats used to encode the token, starting with the last encoding to apply.')
     30parser = argparse.ArgumentParser(
     31    description='A simple encoder script that is useful in shell scripts.'
     32    ' For more information, see:  http://code.google.com/p/bletchley/wiki/Overview')
     33parser.add_argument(
     34    'input_file', nargs='?', default=None,
     35    help='File containing encrypted blobs to analyze, one per line. '
     36    'Omit to read from stdin.')
     37parser.add_argument(
     38    '-e', dest='encoding_chain', type=str, required=True,
     39    help='Comma-separated sequence of encoding formats used to encode the'
     40    ' token, starting with the last encoding to apply.'
     41    ' (Use "?" for a listing of supported encodings.)')
    3542options = parser.parse_args()
     43
     44if options.encoding_chain == '?':
     45    print('\n\t'.join(['Supported encodings:']+blobtools.supportedEncodings()))
     46    sys.exit(0)
    3647
    3748input_file = sys.stdin
     
    4354specified_encodings = options.encoding_chain.split(',')
    4455specified_encodings.reverse()
     56# XXX: report invalid encodings
    4557sys.stdout.write(blobtools.encodeChain(specified_encodings, blob))
     58sys.stdout.write('\n')
  • trunk/bin/bletchley-http2py

    r14 r28  
    4141    sys.exit(1)
    4242
    43 parser = argparse.ArgumentParser(description='Process some integers.')
    44 parser.add_argument('requestfile', type=file, nargs='?', default=sys.stdin,
    45                     help='A file containing an HTTP request.  Defaults to stdin if omitted.')
    46 parser.add_argument('--burp', action='store_true', help='Input file is a XML export from Burp. (First request in file is used.)')
     43parser = argparse.ArgumentParser(
     44    description='A script which accepts an HTTP request and prints out a'
     45    ' generated Python script which sends a similar request.  This is useful'
     46    ' when one wants to automate sending a large number of requests to a'
     47    ' particular page or application.'
     48    ' For more information, see: http://code.google.com/p/bletchley/wiki/Overview')
     49parser.add_argument(
     50    'requestfile', type=file, nargs='?', default=sys.stdin,
     51    help='A file containing an HTTP request.  Defaults to stdin if omitted.')
     52parser.add_argument(
     53    '--burp', action='store_true', help='Input file is a XML export from Burp.'
     54    ' (First request in file is used.)')
    4755args = parser.parse_args()
    4856
  • trunk/lib/bletchley/blobtools.py

    r20 r28  
    324324    encodings["%s/%s" % (enc.name, d)] = e
    325325
     326def supportedEncodings():
     327    e = encodings.keys()
     328    e.sort()
     329    return e
     330
    326331
    327332def possibleEncodings(blob):
Note: See TracChangeset for help on using the changeset viewer.