| 26 | class ArchiveAnomaly(Detection): |
| 27 | @classmethod |
| 28 | def from_generic_exception(cls, location: ScanLocation, exc: Exception): |
| 29 | return cls( |
| 30 | detection_type=cls.__name__, |
| 31 | location = location.location, |
| 32 | message="Could not open the archive for analysis", |
| 33 | signature=f"archive_anomaly#read_error#{location.location}", |
| 34 | score=config.get_score_or_default("corrupted-archive", 10), |
| 35 | extra={ |
| 36 | "reason": "archive_read_error", |
| 37 | "exc_message": exc.args[0], |
| 38 | "exc_type": exc.__class__.__name__, |
| 39 | "mime": location.metadata["mime"] |
| 40 | }, |
| 41 | ) |
| 42 | |
| 43 | |
| 44 | def is_suspicious(pth, location): |