Exemple #1
0
    def test_traverse_expander_upper_bound_regression(self):
        ip = ipaddress.IPv4Address('255.255.255.254')
        expand = 2

        result = fierce.traverse_expander(ip, expand)
        expected = [
            ipaddress.IPv4Address('255.255.255.252'),
            ipaddress.IPv4Address('255.255.255.253'),
            ipaddress.IPv4Address('255.255.255.254'),
            ipaddress.IPv4Address('255.255.255.255')
        ]
        self.assertEqual(expected, result)
Exemple #2
0
    def test_traverse_expander_lower_bound_regression(self):
        ip = ipaddress.IPv4Address('0.0.0.1')
        expand = 2

        result = fierce.traverse_expander(ip, expand)
        expected = [
            ipaddress.IPv4Address('0.0.0.0'),
            ipaddress.IPv4Address('0.0.0.1'),
            ipaddress.IPv4Address('0.0.0.2'),
            ipaddress.IPv4Address('0.0.0.3')
        ]
        self.assertEqual(expected, result)
Exemple #3
0
    def test_traverse_expander_basic(self):
        ip = ipaddress.IPv4Address('192.168.1.1')
        expand = 1

        result = fierce.traverse_expander(ip, expand)
        expected = [
            ipaddress.IPv4Address('192.168.1.0'),
            ipaddress.IPv4Address('192.168.1.1'),
            ipaddress.IPv4Address('192.168.1.2'),
        ]

        self.assertEqual(expected, result)
Exemple #4
0
    def test_traverse_expander_no_cross_upper_boundary(self):
        ip = ipaddress.IPv4Address('192.168.1.254')
        expand = 2

        result = fierce.traverse_expander(ip, expand)
        expected = [
            ipaddress.IPv4Address('192.168.1.252'),
            ipaddress.IPv4Address('192.168.1.253'),
            ipaddress.IPv4Address('192.168.1.254'),
            ipaddress.IPv4Address('192.168.1.255'),
        ]

        self.assertEqual(expected, result)
Exemple #5
0
    def test_traverse_expander_no_cross_lower_boundary(self):
        ip = ipaddress.IPv4Address('192.168.1.1')
        expand = 2

        result = fierce.traverse_expander(ip, expand)
        expected = [
            ipaddress.IPv4Address('192.168.1.0'),
            ipaddress.IPv4Address('192.168.1.1'),
            ipaddress.IPv4Address('192.168.1.2'),
            ipaddress.IPv4Address('192.168.1.3'),
        ]

        assert expected == result