Beispiel #1
0
 def testCleanIp(self):
     from Exscript.util.ipv4 import clean_ip
     self.assertEqual(clean_ip('0.0.0.0'), '0.0.0.0')
     self.assertEqual(clean_ip('255.255.255.255'), '255.255.255.255')
     self.assertEqual(clean_ip('001.002.003.004'), '1.2.3.4')
     self.assertEqual(clean_ip('192.168.010.001'), '192.168.10.1')
     self.assertEqual(clean_ip('0.128.255.0'), '0.128.255.0')
Beispiel #2
0
 def testCleanIp(self):
     from Exscript.util.ipv4 import clean_ip
     self.assertEqual(clean_ip('0.0.0.0'),         '0.0.0.0')
     self.assertEqual(clean_ip('255.255.255.255'), '255.255.255.255')
     self.assertEqual(clean_ip('001.002.003.004'), '1.2.3.4')
     self.assertEqual(clean_ip('192.168.010.001'), '192.168.10.1')
     self.assertEqual(clean_ip('0.128.255.0'),     '0.128.255.0')
Beispiel #3
0
    def set_address(self, address):
        """
        Set the address of the remote host the is contacted, without
        changing hostname, username, password, protocol, and TCP port
        number.
        This is the actual address that is used to open the connection.

        @type  address: string
        @param address: A hostname or IP name.
        """
        if is_ip(address):
            self.address = clean_ip(address)
        else:
            self.address = address