def __init__(self, *args, **kwargs): super(Unit, self).__init__(*args, **kwargs) # if this was a file, ensure it's not an image or anything useful if self.target.path: if is_good_magic(magic.from_file(self.target.path)): raise NotApplicable("potentially useful file")
def __init__(self, *args, **kwargs): super(CryptoUnit, self).__init__(*args, **kwargs) # if this is a URL, and we can reach it, don't try to mangle anything if self.target.is_url and not self.target.url_accessible: raise NotApplicable("this is a URL") # if this is a given file, ensure it's not an image or anything useful if self.target.path: if is_good_magic(magic.from_file(self.target.path)): raise NotApplicable("potentially useful file")
def __init__(self, manager: Manager, target: Target): super(Unit, self).__init__(manager, target) # Ensure the target is printable data if not self.target.is_printable: raise NotApplicable("not printable data") # Ensure the target is not english if self.target.is_english: raise NotApplicable("seemingly english") # if this was a given file, make sure it's not an image or anything useful if self.target.path: if is_good_magic(magic.from_file(self.target.path)): raise NotApplicable("potentially useful file")
def __init__(self, *args, **kwargs): super(Unit, self).__init__(*args, **kwargs) # Ensure this is printable data if not self.target.is_printable: raise NotApplicable("not printable data") # Ensure this is not english data if self.target.is_english: raise NotApplicable("seemingly english") # if this was a file, ensure it's not an image or anything useful if self.target.path: if is_good_magic(magic.from_file(self.target.path)): raise NotApplicable("potentially useful file") # Are there base32 chunks in the data? self.matches = BASE32_REGEX.findall(self.target.raw) if self.matches is None: raise NotApplicable("no base32 text found")