Beispiel #1
0
    def manifest_file(self, value):
        """
        Sets the value of the hash

        Args:
        -----
            value: a string representing the name of the manifest_file.

        Raises:
        -------
            TypeError: whenever the value provided is not a string.
        """
        if value is None or validations.isTypeCorrect(value, 'str'):
            self._manifest_file = value
Beispiel #2
0
    def size(self, value):
        """
        Sets the size of the extension

        Args:
        -----
            value: an integer representing the number of bytes of the extension.

        Raises:
        -------
            TypeError: whenever the value provided is not an integer.
        """
        if value is None or validations.isTypeCorrect(value, 'int'):
            self._size = value
Beispiel #3
0
    def features(self, value):
        """
        Sets the value of the features dict

        Args:
        -----
            value: a dict representing the features extracted.

        Raises:
        -------
            TypeError: whenever the value provided is not a dictionary.
        """
        if value is None or validations.isTypeCorrect(value, 'dict'):
            self._features = value
Beispiel #4
0
    def manifest(self, value):
        """
        Sets the value of the manifest dict

        Args:
        -----
            value: a dict representing the data extracted from the manifest.

        Raises:
        -------
            TypeError: whenever the value provided is not a dictionary.
        """
        if value is None or validations.isTypeCorrect(value, 'dict'):
            self._manifest = value
Beispiel #5
0
    def filename(self, value):
        """
        Sets the filename value

        Args:
        -----
            value: a string representing the filename.

        Raises:
        -------
            TypeError: whenever the value provided is not a string.
        """
        if value is None or validations.isTypeCorrect(value, 'str'):
            self._filename = value
Beispiel #6
0
    def analyser_version(self, value):
        """
        Sets the value of the analyser version

        Args:
        -----
            value: a string representing the current version of the analyser.

        Raises:
        -------
            TypeError: whenever the value provided is not a string.
        """
        if validations.isTypeCorrect(value, 'str'):
            self._analyser_version = value
Beispiel #7
0
Datei: http.py Projekt: mmg1/neto
    def headers(self, value):
        """
        Sets the value for the headers.

        Args:
        -----
            value: a dictionary representing the headers to be loaded.

        Raises:
        -------
            ValueError: if the value is a dictionary.
        """
        if validations.isTypeCorrect(value, "dict"):
            self._headers = value
Beispiel #8
0
    def files(self, value):
        """
        Sets the value of the dictionary of files found inside

        Args:
        -----
            value: a dictionary representing the files found inside the
                extension, where the key is the relative path and the value is
                the hash of that given file.

        Raises:
        -------
            TypeError: whenever the value provided is not a dictionary.
        """
        if value is None or validations.isTypeCorrect(value, 'dict'):
            self._files = value
Beispiel #9
0
    def date_analysis(self, value):
        """
        Sets the value of the analysis date

        It receives a Datetime object and converts it to a string. If the object
        provided is not a date, it gets the current date with `utcnow()`.

        Args:
        -----
            value: a datetime object with the date.
        """
        try:
            if validations.isTypeCorrect(value, 'datetime'):
                self._date_analysis = str(value) + " UTC"
        except TypeError as e:
            self._date_analysis = str(dt.datetime.utcnow()) + "UTC"
Beispiel #10
0
    def digest(self, value):
        """
        Sets the value of the hash

        Args:
        -----
            value: a dictionary representing the digests as MD5, SHA1 & SHA256.
                {
                    "md5": "…",
                    "sha1": "…",
                    "sha256": "…",
                }

        Raises:
        -------
            TypeError: whenever the value provided is not a dict.
        """
        if value is None or validations.isTypeCorrect(value, 'dict'):
            self._digest = value
Beispiel #11
0
 def headers(self, value):
     if validations.isTypeCorrect(value, "dict"):
         self._headers = value