示例#1
0
 def _get_path_disclosure_strings(self):
     '''
     Return a list of regular expressions to be tested.
     '''
     
     path_disclosure_strings = []
     #path_disclosure_strings.append(r"file:///?[A-Z]\|")
     path_disclosure_strings.extend( get_common_directories() )
     return path_disclosure_strings
示例#2
0
    def __init__(self):
        GrepPlugin.__init__(self)

        # Internal variables
        self._already_added = DiskList()

        # Compile all regular expressions and store information to avoid
        # multiple queries to the same function
        self._common_directories = get_common_directories()
        self._compiled_regexes = {}
        self._compile_regex()
示例#3
0
    def __init__(self):
        GrepPlugin.__init__(self)

        # Internal variables
        self._already_added = DiskList()

        # Compile all regular expressions and store information to avoid
        # multiple queries to the same function
        self._common_directories = get_common_directories()
        self._compiled_regexes = {}
        self._compile_regex()
示例#4
0
        def extract_files_from_file( filename, file_content ):
            '''
            @param filename: The filename to request to the remote end and parse
            @param file_content: The content of the file to analyze
            @return: A list of files referenced in "filename"
            ''' 
            # Compile 
            regular_expressions = [] 
            for common_dirs in get_common_directories(): 
                regex_string = '('+common_dirs + '.*?)[:| |\0|\'|"|<|\n|\r|\t]' 
                regex = re.compile( regex_string,  re.IGNORECASE) 
                regular_expressions.append(regex) 
             
            # And use 
            result = []
            for regex in regular_expressions: 
                result.extend( regex.findall( file_content ) ) 
             
            # uniq 
            result = list(set(result)) 

            return result 
示例#5
0
        def extract_files_from_file(filename, file_content):
            '''
            :param filename: The filename to request to the remote end and parse
            :param file_content: The content of the file to analyze
            :return: A list of files referenced in "filename"
            '''
            # Compile
            regular_expressions = []
            for common_dirs in get_common_directories():
                regex_string = '(' + common_dirs + \
                    '.*?)[:| |\0|\'|"|<|\n|\r|\t]'
                regex = re.compile(regex_string, re.IGNORECASE)
                regular_expressions.append(regex)

            # And use
            result = []
            for regex in regular_expressions:
                result.extend(regex.findall(file_content))

            # uniq
            result = list(set(result))

            return result
示例#6
0
 def test_linux(self):
     self.assertIn('/etc/', get_common_directories('linux'))
示例#7
0
 def test_windows(self):
     self.assertIn('C:\\\\', get_common_directories('windows'))