コード例 #1
0
    def _parse_filters(self, optsd, filter_params):
        """
        filter_params = dict(
            hs = None,
            hc = [],
            hw = [],
            hl = [],
            hh = [],
            ss = None,
            sc = [],
            sw = [],
            sl = [],
            sh = [],
            filter = "",
            prefilter = "",
            ),
        """

        if "--prefilter" in optsd:
            if not PYPARSING:
                raise FuzzExceptBadInstall(
                    "--prefilter switch needs pyparsing module.")

            for prefilter_opt in optsd["--prefilter"]:
                filter_params["prefilter"].append(prefilter_opt)

        if "--filter" in optsd:
            if not PYPARSING:
                raise FuzzExceptBadInstall(
                    "--filter switch needs pyparsing module.")
            filter_params["filter"] = optsd["--filter"][0]

        if "--hc" in optsd:
            filter_params["hc"] = optsd["--hc"][0].split(",")
        if "--hw" in optsd:
            filter_params["hw"] = optsd["--hw"][0].split(",")
        if "--hl" in optsd:
            filter_params["hl"] = optsd["--hl"][0].split(",")
        if "--hh" in optsd:
            filter_params["hh"] = optsd["--hh"][0].split(",")
        if "--hs" in optsd:
            filter_params["hs"] = optsd["--hs"][0]
        if "--sc" in optsd:
            filter_params["sc"] = optsd["--sc"][0].split(",")
        if "--sw" in optsd:
            filter_params["sw"] = optsd["--sw"][0].split(",")
        if "--sl" in optsd:
            filter_params["sl"] = optsd["--sl"][0].split(",")
        if "--sh" in optsd:
            filter_params["sh"] = optsd["--sh"][0].split(",")
        if "--ss" in optsd:
            filter_params["ss"] = optsd["--ss"][0]
コード例 #2
0
ファイル: clparser.py プロジェクト: p4int3r/Tools
    def _parse_filters(self, optsd, filter_params):
        '''
	filter_params = dict(
	    hs = None,
	    hc = [],
	    hw = [],
	    hl = [],
	    hh = [],
	    ss = None,
	    sc = [],
	    sw = [],
	    sl = [],
	    sh = [],
	    filter = "",
	    prefilter = "",
	    ),
	'''

        if "--prefilter" in optsd:
            if not PYPARSING:
                raise FuzzExceptBadInstall(
                    "--prefilter switch needs pyparsing module.")
            filter_params['prefilter'] = optsd["--prefilter"][0]

        if "--filter" in optsd:
            if not PYPARSING:
                raise FuzzExceptBadInstall(
                    "--filter switch needs pyparsing module.")
            filter_params['filter'] = optsd["--filter"][0]

        if "--hc" in optsd:
            filter_params['hc'] = optsd["--hc"][0].split(",")
        if "--hw" in optsd:
            filter_params['hw'] = optsd["--hw"][0].split(",")
        if "--hl" in optsd:
            filter_params['hl'] = optsd["--hl"][0].split(",")
        if "--hh" in optsd:
            filter_params['hh'] = optsd["--hh"][0].split(",")
        if "--hs" in optsd:
            filter_params['hs'] = optsd["--hs"][0]

        if "--sc" in optsd:
            filter_params['sc'] = optsd["--sc"][0].split(",")
        if "--sw" in optsd:
            filter_params['sw'] = optsd["--sw"][0].split(",")
        if "--sl" in optsd:
            filter_params['sl'] = optsd["--sl"][0].split(",")
        if "--sh" in optsd:
            filter_params['sh'] = optsd["--sh"][0].split(",")
        if "--ss" in optsd:
            filter_params['ss'] = optsd["--ss"][0]
コード例 #3
0
ファイル: ipnet.py プロジェクト: zkuns5/wfuzz
    def __init__(self, params):
        BasePayload.__init__(self, params)

        try:
            from netaddr import IPNetwork
            from netaddr.core import AddrFormatError

            net = IPNetwork("%s" % self.params["net"])
            self.f = net.iter_hosts()
            self.__count = net.size - 2

            if self.__count <= 0:
                raise FuzzExceptPluginBadParams(
                    "There are not hosts in the specified network")

        except ValueError:
            raise FuzzExceptPluginBadParams(
                "The specified network has an incorrect format.")
        except ImportError:
            raise FuzzExceptBadInstall(
                "ipnet plugin requires netaddr module. Please install it using pip."
            )
        except AddrFormatError:
            raise FuzzExceptPluginBadParams(
                "The specified network has an incorrect format.")
コード例 #4
0
ファイル: iprange.py プロジェクト: MAH0460/b
    def __init__(self, params):
        BasePayload.__init__(self, params)

        try:
            from netaddr import IPRange
            from netaddr.core import AddrFormatError

            ran = self.params["iprange"].split("-")
            net = IPRange(ran[0], ran[1])
            self.f = iter(net)
            self.__count = net.size
        except ImportError:
            raise FuzzExceptBadInstall(
                "ipnet plugin requires netaddr module. Please install it using pip."
            )
        except AddrFormatError:
            raise FuzzExceptPluginBadParams(
                "The specified network range has an incorrect format.")
        except IndexError:
            raise FuzzExceptPluginBadParams(
                "The specified network range has an incorrect format.")