def doTest(self): """Does the actual test""" for target in self.targets: targetIp = TestServices.getProbeIpById(target) if self.options.protocol == self.PROTO_TCP: attempts = 0 telnetCli = 'sh -c "echo A | telnet -e A {ip} {port}"' while ('Connected' not in TestServices.runCmd(telnetCli.format(ip = targetIp, port = self.options.port))[0].decode() and attempts < self.MAX_ATTEMPTS): attempts += 1 time.sleep(.5) self.outputs[target] = TestServices.runCmd(self.cmd.format(ip = targetIp))
def doTest(self): """Does the actual test""" for target in self.targets: targetIp = TestServices.getProbeIpById(target) if self.options.protocol == self.PROTO_TCP: attempts = 0 telnetCli = 'sh -c "echo A | telnet -e A {ip} {port}"' while ('Connected' not in TestServices.runCmd( telnetCli.format(ip=targetIp, port=self.options.port))[0].decode() and attempts < self.MAX_ATTEMPTS): attempts += 1 time.sleep(.5) self.outputs[target] = TestServices.runCmd( self.cmd.format(ip=targetIp))
def makePing(cls, ip, **options): opts = {} opts.update(cls.DEFAULT_OPTIONS) opts.update(options) opstr = '' for opt, val in opts.items(): opstr += cls._addOption(opt, val) stdout, stderr, code = TestServices.runCmd(cls._ping_cmd.format(opts = opstr, ip = ip)) # if isSweep: # return cls._parseSweepPing(str(stdout.decode())) return cls._parsePing(str(stdout.decode()))
def makePing(cls, ip, **options): opts = {} opts.update(cls.DEFAULT_OPTIONS) opts.update(options) opstr = '' for opt, val in opts.items(): opstr += cls._addOption(opt, val) stdout, stderr, code = TestServices.runCmd( cls._ping_cmd.format(opts=opstr, ip=ip)) # if isSweep: # return cls._parseSweepPing(str(stdout.decode())) return cls._parsePing(str(stdout.decode()))
def doTest(self): """Does the actual test""" for target in self.targets: targetIp = TestServices.getProbeIpById(target) self.outputs[target] = TestServices.runCmd(self.cmd.format(ip = targetIp))