Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix symlink issue in statistic generation #11

Merged
merged 2 commits into from
Apr 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions fact_extractor/helperFunctions/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from pathlib import Path
from typing import Dict, List

from common_helper_files import safe_rglob
from common_helper_unpacking_classifier import (
avg_entropy, get_binary_size_without_padding, is_compressed
)
Expand All @@ -12,7 +13,7 @@

def add_unpack_statistics(extraction_dir: Path, meta_data: Dict):
unpacked_files, unpacked_directories = 0, 0
for extracted_item in extraction_dir.glob('**/*'):
for extracted_item in safe_rglob(extraction_dir):
if extracted_item.is_file():
unpacked_files += 1
elif extracted_item.is_dir():
Expand Down Expand Up @@ -48,6 +49,6 @@ def _detect_unpack_loss(binary: bytes, extracted_files: List[Path], meta_data: D
def _total_size_of_extracted_files(extracted_files: List[Path]) -> int:
total_size = 0
for item in extracted_files:
with suppress(FileNotFoundError):
with suppress(OSError):
total_size += item.stat().st_size
return total_size