Exemple #1
0
    def do_wirtn(self, args):
        """
        wirtn [ <addr> ] [ <net> ]

        Send a Who-Is-Router-To-Network message.  If <addr> is not specified
        the message is locally broadcast.
        """
        args = args.split()
        if _debug: DiscoverConsoleCmd._debug("do_wirtn %r", args)

        # build a request
        try:
            request = WhoIsRouterToNetwork()
            if not args:
                request.pduDestination = LocalBroadcast()
            elif args[0].isdigit():
                request.pduDestination = LocalBroadcast()
                request.wirtnNetwork = int(args[0])
            else:
                request.pduDestination = Address(args[0])
                if (len(args) > 1):
                    request.wirtnNetwork = int(args[1])
        except:
            print("invalid arguments")
            return

        # give it to the network service element
        this_application.nse.request(this_application.nsap.local_adapter,
                                     request)

        # sleep for responses
        time.sleep(3.0)
Exemple #2
0
    def whois_router_to_network(self, args=None):
        # build a request
        try:
            request = WhoIsRouterToNetwork()
            if not args:
                request.pduDestination = LocalBroadcast()
            elif args[0].isdigit():
                request.pduDestination = LocalBroadcast()
                request.wirtnNetwork = int(args[0])
            else:
                request.pduDestination = Address(args[0])
                if len(args) > 1:
                    request.wirtnNetwork = int(args[1])
        except:
            self._log.error("WhoIsRouterToNetwork : invalid arguments")
            return
        iocb = IOCB((self.this_application.nsap.local_adapter,
                     request))  # make an IOCB
        iocb.set_timeout(2)
        deferred(self.this_application.nse.request_io, iocb)
        iocb.wait()

        try:
            self.init_routing_table(str(
                self.this_application.nse._iartn.pop()))
        except IndexError:
            pass
Exemple #3
0
    def whois_router_to_network(self, network=None, *, destination=None):
        # build a request
        try:
            request = WhoIsRouterToNetwork()
            if network:
                request.wirtnNetwork = int(network)
            if destination:
                request.pduDestination = Address(destination)
                self._log.debug("WhoIsRouterToNetwork Destination : {}".format(
                    destination))
            else:
                request.pduDestination = LocalBroadcast()
        except:
            self._log.error("WhoIsRouterToNetwork : invalid arguments")
            return
        iocb = IOCB((self.this_application.nsap.local_adapter,
                     request))  # make an IOCB
        iocb.set_timeout(2)
        deferred(self.this_application.nse.request_io, iocb)
        iocb.wait()

        try:
            self.init_routing_table(str(
                self.this_application.nse._iartn.pop()))
        except IndexError:
            pass
    def do_wirtn(self, args):
        """wirtn <addr> [ <net> ]"""
        args = args.split()
        if _debug: WhoIsRouterConsoleCmd._debug("do_irt %r", args)

        # build a request
        try:
            request = WhoIsRouterToNetwork()
            request.pduDestination = Address(args[0])
            if (len(args) > 1):
                request.wirtnNetwork = int(args[1])
        except:
            print "invalid arguments"
            return

        # give it to the application
        this_application.request(this_application.nsap.adapters[0], request)
Exemple #5
0
    def do_wirtn(self, args):
        """wirtn <addr> [ <net> ]"""
        args = args.split()
        if _debug: WhoIsRouterConsoleCmd._debug("do_irt %r", args)

        # build a request
        try:
            request = WhoIsRouterToNetwork()
            request.pduDestination = Address(args[0])
            if (len(args) > 1):
                request.wirtnNetwork = int(args[1])
        except:
            print "invalid arguments"
            return

        # give it to the application
        this_application.request(this_application.nsap.adapters[0], request)