コード例 #1
0
    def __set__(self, instance, value):
        try:
            value = int(value)

            if 0 <= value <= 65535:  # max port number is 65535
                self.display_value = str(value)
                self.value = value
            else:
                raise PocsuiteValidationException("Invalid option. Port value should be between 0 and 65536.")
        except ValueError:
            raise PocsuiteValidationException("Invalid option. Cannot cast '{}' to integer.".format(value))
コード例 #2
0
ファイル: poc.py プロジェクト: sasqwatch/pocsuite3
 def check_requirement(self, *args):
     for option in args:
         for k, v in option.items():
             if v.require and v.value == "":
                 raise PocsuiteValidationException(
                     "'{key}' must be set,please using command 'set {key}'".format(key=k))
     return True
コード例 #3
0
 def __set__(self, instance, value):
     try:
         self.display_value = str(value)
         self.value = float(value)
     except ValueError:
         raise PocsuiteValidationException(
             "Invalid option. Cannot cast '{}' to float.".format(value))
コード例 #4
0
 def __set__(self, instance, value):
     if not value or is_ip_address_format(value) or is_ipv6_address_format(
             value):
         self.value = self.display_value = value
     else:
         raise PocsuiteValidationException(
             "Invalid address. Provided address is not valid IPv4 or IPv6 address."
         )
コード例 #5
0
    def __set__(self, instance, value):
        if isinstance(value, bool):
            self.value = value
            return

        if value.lower() == "true":
            self.value = True
            self.display_value = value
        elif value.lower() == "false":
            self.value = False
            self.display_value = value
        else:
            raise PocsuiteValidationException("Invalid value. It should be true or false.")
コード例 #6
0
ファイル: poc.py プロジェクト: knownsec/pocsuite3
 def setp_option(self, key, value):
     if key not in self.payload_options:
         raise PocsuiteValidationException("No key " + key)
     self.payload_options[key].__set__("", value)
コード例 #7
0
ファイル: poc.py プロジェクト: knownsec/pocsuite3
 def set_option(self, key, value):
     # if not hasattr(self, 'options'):
     #     self.options = {}
     if key not in self.options:
         raise PocsuiteValidationException("No key " + key)
     self.options[key].__set__("", value)