Ejemplo n.º 1
0
    def __init__(self, dest=None, count=1, port=None, index=None, host=None):
        SearchCommand.__init__(self, run_in_preview=False, logger_name="ping_search_command")

        self.dest = None

        if dest is not None:
            self.dest = text_type(dest)

        # Use the host argument if someone provided that instead (since that is the old argument)
        elif self.dest is None and host is not None:
            self.dest = text_type(host)

        self.index = index

        try:
            self.count = int(count)
        except ValueError:
            raise ValueError('The count parameter must be an integer')

        if port is not None:
            try:
                self.port = int(port)
            except ValueError:
                raise ValueError('The port parameter must be an integer')

            if self.port < 1 or self.port > 65535:
                raise ValueError('The port parameter must be an integer from 1 to 65535')

        else:
            self.port = None

        self.logger.info("Ping running")
    def __init__(self,
                 host=None,
                 mac_address=None,
                 ip_address=None,
                 port=None):
        SearchCommand.__init__(self,
                               run_in_preview=False,
                               logger_name="wakeonlan_search_command")

        self.mac_address = None
        self.ip_address = None
        self.port = None

        # Get the port (if provided)
        try:

            if port is not None:
                self.port = int(port)

        except ValueError:
            sys.stderr.write('The port parameter must be an integer')
            return

        # Get the IP address (if provided)
        if ip_address is not None:
            self.ip_address = ip_address

        # Get the MAC address (if provided)
        if mac_address is not None:
            self.mac_address = mac_address

        # Get the host to lookup address
        self.host = host
Ejemplo n.º 3
0
    def __init__(self, host=None, include_output=False, index=None):
        SearchCommand.__init__(self,
                               run_in_preview=False,
                               logger_name="traceroute_search_command")

        self.host = host
        self.include_output = normalizeBoolean(include_output)
        self.index = index

        self.logger.info("Traceroute running")
Ejemplo n.º 4
0
    def __init__(self, host=None, server=None, index=None):
        SearchCommand.__init__(self,
                               run_in_preview=False,
                               logger_name="nslookup_search_command")

        self.host = host
        self.server = server
        self.index = index

        self.logger.info("NSLookup running against host=%s", host)
Ejemplo n.º 5
0
    def __init__(self, host=None, field=None, index=None):
        SearchCommand.__init__(self,
                               run_in_preview=False,
                               logger_name="whois_search_command")

        self.host = host
        self.index = index

        if host is not None:
            self.logger.info("Whois running against host=%s", host)

        self.field = field
    def __init__(self, runs=1, server=None, index=None):
        SearchCommand.__init__(self,
                               run_in_preview=False,
                               logger_name="speedtest_search_command")

        self.server = server
        self.index = index

        try:
            self.runs = int(runs)
        except ValueError:
            raise ValueError('The runs parameter must be an integer')

        self.logger.info("Speedtest running")
    def __init__(self,
                 dest=None,
                 ports=None,
                 index=None,
                 host=None,
                 timeout=5):
        SearchCommand.__init__(self,
                               run_in_preview=False,
                               logger_name="portscan_search_command")

        self.dest = dest

        # Use the host argument if someone provided that instead (since that is the older argument supported by some of the other commands)
        if self.dest is None and host is not None:
            self.dest = host

        self.index = index

        if ports is None:
            raise ValueError('The list of ports to scan must be provided')

        try:
            parseIntSet(ports, True)
        except ValueError:
            raise ValueError('The list of ports to scan is invalid')

        self.ports = ports

        try:
            self.timeout = int(timeout)
        except ValueError:
            raise ValueError('The must be a valid integer')

        if self.timeout <= 0:
            raise ValueError(
                'The must be a valid positive integer (greater than zero)')

        self.logger.info("Port scan running")