Changeset 115 for trunk


Ignore:
Timestamp:
10/06/16 21:10:15 (8 years ago)
Author:
tim
Message:

256 color now default

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/bletchley-analyze

    r77 r115  
    4444parser.add_argument('-p', dest='output_lines', type=int, default=10,
    4545                    help='Number of lines of input to display in decoded form.')
     46parser.add_argument('-C', action='store_const', const=True, default=False,
     47                    help='Use mono output for decoded highlights.')
    4648parser.add_argument('-c', action='store_const', const=True, default=False,
    47                     help='Use color output for decoded highlights.')
    48 parser.add_argument('-c256', action='store_const', const=True, default=False,
    49                     help='Use 256 color output for decoded highlights.')
     49                    help='Use 8 color output for decoded highlights.')
     50parser.add_argument('-c256', action='store_const', const=True, default=True,
     51                    help='Use 256 color output for decoded highlights. (default)')
    5052options = parser.parse_args()
    5153
     
    6668        return s
    6769
    68     if options.c256:
    69         fg = code%216+16
    70         bg = (code^0xffffffff)%216+16
    71         return "\x1b[0;38;05;%d;48;05;%dm%s\x1b[0m" % (fg,bg,s)
     70    if options.C:
     71        return "\x1b[7m%s\x1b[0m" % s       
    7272    elif options.c:
    7373        fg = code%6+31
     
    7575        return "\x1b[0;%d;%dm%s\x1b[0m" % (fg,bg,s)
    7676    else:
    77         return "\x1b[7m%s\x1b[0m" % s
     77        fg = code%216+16
     78        bg = (code^0xffffffff)%216+16
     79        return "\x1b[0;38;05;%d;48;05;%dm%s\x1b[0m" % (fg,bg,s)
    7880
    7981
  • trunk/lib/bletchley/ssltls.py

    r110 r115  
    4545    context = SSL.Context(method)
    4646    context.set_verify(SSL.VERIFY_NONE, (lambda a,b,c,d,e: True))
     47
    4748    if key and len(certChain) > 0:
    4849        context.use_privatekey(key)
     
    5455
    5556
    56 def startSSLTLS(sock, mode='client', handshake=SSL.TLSv1_METHOD, key=None, certChain=[]):
    57     conn = SSL.Connection(createContext(handshake, key=key, certChain=certChain), sock)
     57def startSSLTLS(sock, mode='client', handshake=SSL.TLSv1_METHOD, key=None, certChain=[], cipher_list=None):
     58    '''
     59    cipher_list example:  b'DH-DSS-AES256-GCM-SHA384:DHE-DSS-AES256-GCM-SHA384:DH-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA256:DH-RSA-AES256-SHA256:DH-DSS-AES256-SHA256:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DH-RSA-AES256-SHA:DH-DSS-AES256-SHA:DHE-RSA-CAMELLIA256-SHA:DHE-DSS-CAMELLIA256-SHA:DH-RSA-CAMELLIA256-SHA:DH-DSS-CAMELLIA256-SHA:ADH-AES256-GCM-SHA384:ADH-AES256-SHA256:ADH-AES256-SHA:ADH-CAMELLIA256-SHA:DH-DSS-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:DH-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-DSS-AES128-SHA256:DH-RSA-AES128-SHA256:DH-DSS-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA:DH-RSA-AES128-SHA:DH-DSS-AES128-SHA:DHE-RSA-SEED-SHA:DHE-DSS-SEED-SHA:DH-RSA-SEED-SHA:DH-DSS-SEED-SHA:DHE-RSA-CAMELLIA128-SHA:DHE-DSS-CAMELLIA128-SHA:DH-RSA-CAMELLIA128-SHA:DH-DSS-CAMELLIA128-SHA:ADH-AES128-GCM-SHA256:ADH-AES128-SHA256:ADH-AES128-SHA:ADH-SEED-SHA:ADH-CAMELLIA128-SHA:ADH-RC4-MD5:EDH-RSA-DES-CBC3-SHA:EDH-DSS-DES-CBC3-SHA:DH-RSA-DES-CBC3-SHA:DH-DSS-DES-CBC3-SHA:ADH-DES-CBC3-SHA'
     60    '''
     61   
     62    context = createContext(handshake, key=key, certChain=certChain)
     63    if cipher_list:
     64        context.set_cipher_list(cipher_list)
     65    #if not key and mode == 'server':
     66    #context.set_options(OpenSSL.SSL.OP_SINGLE_DH_USE)
     67    #context.set_options(OpenSSL.SSL.OP_EPHEMERAL_RSA)
     68       
     69    conn = SSL.Connection(context, sock)
    5870    if mode == 'client':
    5971        conn.set_connect_state()
Note: See TracChangeset for help on using the changeset viewer.