Example #1
0
    def refine_candidates(self):
        #
        self._filter_with_black_list()
        #
        depth = 1
        #
        use_max_depth = not commons.profile_exaustive()
        #
        get_next_depth = None
        if commons.increment_function() == 'inc1':
            get_next_depth = lambda x: x + 1
        elif commons.increment_function() == 'pow2':
            get_next_depth = lambda x: 2 * x
        else:
            if commons.profile_exaustive() == False:
                raise Exeception(
                    'Increment function parameter has wrong value -- ' +
                    commons.increment_function())
            get_next_depth = None

        while (True):
            commons.log('Exploring depth ' + str(depth) + ' -- ' + '"' +
                        self.program.prefix + '"')
            self._save_white_list(depth)
            tuple_options = options.TuplesOptions(use_max_depth, depth, True,
                                                  False)
            self.program.tuples(tuple_options)
            self._write_options_to_file(
                '%s/%s' % (self.folder, config.tuples_dir()), tuple_options)
            stop = False
            if self._max_depth_reached():
                stop = True
            #
            if commons.profile_exaustive() == False:
                self._filter_tuples(depth)
                self._save_current_depth_directory(depth)
            #
            candidates_list_new = '%s/%s' % (self.folder,
                                             config.white_list_file())
            number_of_candidates = self._count_lines(candidates_list_new)
            #
            if number_of_candidates == 0:
                commons.log('No caching candidates left to explore' + ' -- ' +
                            str(depth) + ' -- ' + '"' + self.program.prefix +
                            '"')
                break
            #
            if stop:
                self._create_tuples_file()
                commons.log('Max depth ' + str(depth) + 'reached' + ' -- ' +
                            '"' + self.program.prefix + '"')
                break
            depth = get_next_depth(depth)
Example #2
0
 def _max_depth_reached(self):
     if commons.profile_exaustive() == True:
         return True
     else:
         return not os.path.isfile('%s/%s/%s' %
                                   (self.folder, config.tuples_dir(),
                                    config.tuples_max_depth_file()))
Example #3
0
 def refine_candidates(self):
    #
    self._filter_with_black_list()
    #
    depth = 1
    #
    use_max_depth = not commons.profile_exaustive()
    #
    get_next_depth = None
    if commons.increment_function() == 'inc1':
       get_next_depth = lambda x: x + 1
    elif commons.increment_function() == 'pow2':
       get_next_depth = lambda x: 2 * x
    else:
       if commons.profile_exaustive() == False:
          raise Exeception('Increment function parameter has wrong value -- ' + commons.increment_function())
       get_next_depth = None
       
    while (True):
       commons.log('Exploring depth ' + str(depth) + ' -- ' + '"' + self.program.prefix + '"')
       self._save_white_list(depth)
       tuple_options = options.TuplesOptions(use_max_depth, depth, True, False)
       self.program.tuples(tuple_options)
       self._write_options_to_file('%s/%s' % (self.folder, config.tuples_dir()), tuple_options)
       stop = False
       if self._max_depth_reached():
          stop = True
       #
       if commons.profile_exaustive() == False:
          self._filter_tuples(depth)
          self._save_current_depth_directory(depth)
       #
       candidates_list_new = '%s/%s' % (self.folder, config.white_list_file())      
       number_of_candidates = self._count_lines(candidates_list_new)
       #
       if number_of_candidates == 0:
          commons.log('No caching candidates left to explore' + ' -- ' + str(depth) + ' -- ' + '"' + self.program.prefix + '"')
          break 
       #
       if stop:
          self._create_tuples_file()
          commons.log('Max depth ' +  str(depth) + 'reached' + ' -- ' + '"' + self.program.prefix + '"')
          break
       depth = get_next_depth(depth)
Example #4
0
 def _create_tuples_file(self):
     if commons.profile_exaustive() == True:
         from_file = '%s/%s/%s' % (self.folder, config.tuples_dir(),
                                   config.tuples_output_file())
         to_file = '%s/%s' % (self.folder, config.tuples_final_file())
         self._copy_file(from_file, to_file)
Example #5
0
 def _max_depth_reached(self):
    if commons.profile_exaustive() == True:
       return True
    else:
       return not os.path.isfile('%s/%s/%s' % (self.folder, config.tuples_dir(), config.tuples_max_depth_file()))
Example #6
0
 def _create_tuples_file(self):
    if commons.profile_exaustive() == True:
       from_file = '%s/%s/%s' % (self.folder, config.tuples_dir(), config.tuples_output_file())
       to_file = '%s/%s' % (self.folder, config.tuples_final_file())                
       self._copy_file(from_file, to_file)