示例#1
0
def create_request_file(args_dict):
    '''
    Create the 'request' file used by evil.js to issue the requests.
    '''
    method_functions = {'s': serial_execution, 'p': parallel_execution}

    prefix = args_dict['prefix']
    assert prefix, 'Empty prefix argument'
    method = args_dict['method']
    assert prefix, 'Empty method argument'
    search_alphabet = args_dict[
        'alphabet'] if 'alphabet' in args_dict else create_alphabet(
            args_dict['alpha_types'])
    with open('request.txt', 'w') as f:
        f.write(prefix + '\n')
        total_tests = []
        alphabet = method_functions[method](search_alphabet, prefix)
        for test in alphabet:
            huffman_nonce = huffman_point(alphabet, test)
            search_string = NONCE_1 + test + NONCE_2
            total_tests.append(search_string)
        f.write(','.join(total_tests))
        f.close()
    return reflection_alphabet


if __name__ == '__main__':
    args_dict = get_arguments_dict(sys.argv)
    create_request_file(args_dict)
示例#2
0
    reflection_alphabet = [head, tail]
    return [first_huffman + head, second_huffman + tail]

def create_request_file(args_dict):
    '''
    Create the 'request' file used by evil.js to issue the requests.
    '''
    method_functions = {'s': serial_execution,
                        'p': parallel_execution}

    prefix = args_dict['prefix']
    assert prefix, 'Empty prefix argument'
    method = args_dict['method']
    assert prefix, 'Empty method argument'
    search_alphabet = args_dict['alphabet'] if 'alphabet' in args_dict else create_alphabet(args_dict['alpha_types'])
    with open('request.txt', 'w') as f:
        f.write(prefix + '\n')
        total_tests = []
        alphabet = method_functions[method](search_alphabet, prefix)
        for test in alphabet:
            huffman_nonce = huffman_point(alphabet, test)
            search_string = NONCE_1 + test + NONCE_2
            total_tests.append(search_string)
        f.write(','.join(total_tests))
        f.close()
    return reflection_alphabet

if __name__ == '__main__':
    args_dict = get_arguments_dict(sys.argv)
    create_request_file(args_dict)
示例#3
0
    def execute_parser(self):
        self.parser = parse.Parser(self.args)
        args = self.parser.parse_input()
        return args


if __name__ == '__main__':
    args = {}
    with open('config.yml', 'r') as ymlconf:
        cfg = yaml.load(ymlconf)
    args.update(cfg['execution'])
    args.update(cfg['endpoint'])
    args.update(cfg['local'])
    args.update(cfg['logging'])
    setup_command_and_control(args)
    args.update(get_arguments_dict(sys.argv))
    args.update({'start_time': datetime.datetime.now(),
                 'win_count': {},
                 'point_count': {},
                 'history_folder': 'history/'})
    try:
        while 1:
            args['illegal_iterations'] = []
            breach = Breach(args)
            args = breach.execute_parser()
            breach.debug_logger.debug('Found the following illegal iterations: ' + str(args['illegal_iterations']) + '\n')
    except Exception as e:
        print e
        traceback.print_exc()
示例#4
0
    def execute_parser(self):
        self.parser = parse.Parser(self.args)
        args = self.parser.parse_input()
        return args


if __name__ == '__main__':
    args = {}
    with open('config.yml', 'r') as ymlconf:
        cfg = yaml.load(ymlconf)
    args.update(cfg['execution'])
    args.update(cfg['endpoint'])
    args.update(cfg['local'])
    args.update(cfg['logging'])
    setup_command_and_control(args)
    args.update(get_arguments_dict(sys.argv))
    args.update({
        'start_time': datetime.datetime.now(),
        'win_count': {},
        'point_count': {},
        'history_folder': 'history/'
    })
    try:
        while 1:
            args['illegal_iterations'] = []
            breach = Breach(args)
            args = breach.execute_parser()
            breach.debug_logger.debug(
                'Found the following illegal iterations: ' +
                str(args['illegal_iterations']) + '\n')
    except Exception as e: