예제 #1
0
    def scan_file_system(self):
        results = Results()

        self.fileSystemListGeneratorProvider.prompt_for_paths_to_scan()

        self.logger.info('')
        self.logger.info('Commencing scan...\n')
        sleep(2)

        results.start()

        pathGenerator = self.fileSystemListGeneratorProvider.get_generator()
        for path in pathGenerator:
            try:
                if self.should_scan_file(path):
                    self.logger.info('Checking: ' + path)
                    my_md5 = self.md5Generator.compute_md5(path)
                    if self.iocReader.has_md5(my_md5):
                        self.logger.info('    Detected potentially malicious file at path: ' + path)
                        potential_category = self.iocReader.get_potential_category(my_md5)
                        source_ioc = self.iocReader.get_source_ioc(my_md5)
                        results.detected_file_paths.append(PotentialFile(path, potential_category, source_ioc))

            except IOError, err:
                # Socket error possibly
                # TODO - log these errors.
                pass
            except OSError, err:
                # File doesn't exist
                # TODO - log these errors.
                pass
예제 #2
0
    def scan_file_system(self):
        results = Results()

        should_deep_scan = (raw_input('Quick scan or deep scan (NOTE: quick scan is fast but incomprehensive)? [Q/d] ').lower() == 'd')

        results.scan_type = 'deep' if should_deep_scan == True else 'quick'
        
        self.fileSystemListGeneratorProvider.prompt_for_paths_to_scan()

        self.logger.info('')
        self.logger.info('Commencing scan...\n')
        sleep(2)

        results.start()

        pathGenerator = self.fileSystemListGeneratorProvider.get_generator()
        for path in pathGenerator:
            try:
                if self.should_scan_file(path, should_deep_scan):
                    my_md5 = self.md5Generator.compute_md5(path)
                    self.logger.info('Checking path: ' + path)
                    if self.iocReader.has_md5(my_md5):
                        self.logger.info('   Detected potentially malicious file at path: ' + path)
                        potential_category = self.iocReader.get_potential_category(my_md5)
                        results.detected_file_paths.append(PotentialFile(path, potential_category))
                    else:
                        self.logger.info('   File clean')

            except IOError, err:
                # Socket error possibly
                #print err
                # TODO - log these errors.
                pass
            except OSError, err:
                # File doesn't exist
                #print err
                # TODO - log these errors.
                pass
    def scan_file_system(self):
        results = Results()

        self.fileSystemListGeneratorProvider.prompt_for_paths_to_scan()

        self.logger.info('')
        self.logger.info('Commencing scan...\n')
        sleep(2)

        results.start()

        pathGenerator = self.fileSystemListGeneratorProvider.get_generator()
        for path in pathGenerator:
            try:
                if self.should_scan_file(path):
                    self.logger.info('Checking: ' + path)
                    my_md5 = self.md5Generator.compute_md5(path)
                    if self.iocReader.has_md5(my_md5):
                        self.logger.info(
                            '    Detected potentially malicious file at path: '
                            + path)
                        potential_category = self.iocReader.get_potential_category(
                            my_md5)
                        source_ioc = self.iocReader.get_source_ioc(my_md5)
                        results.detected_file_paths.append(
                            PotentialFile(path, potential_category,
                                          source_ioc))

            except IOError, err:
                # Socket error possibly
                # TODO - log these errors.
                pass
            except OSError, err:
                # File doesn't exist
                # TODO - log these errors.
                pass