Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move parsers to use base class #37

Closed
chapinb opened this issue Feb 3, 2020 · 0 comments
Closed

Move parsers to use base class #37

chapinb opened this issue Feb 3, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@chapinb
Copy link
Owner

chapinb commented Feb 3, 2020

Create a base class for the parsers.

Should contain check_ips()

    def check_ips(self, data):
        """Check data for IP addresses. Results stored in ``self.ips``.

        Args:
            data (str): String to search for IP address content.

        Returns:
            None
        """
        for ipv4 in IPv4Pattern.findall(data):
            if ipv4 not in self.ips:
                self.ips[ipv4] = 0
            self.ips[ipv4] += 1
        for ipv6 in IPv6Pattern.findall(data):
            if strip_ipv6(ipv6) not in self.ips:
                self.ips[strip_ipv6(ipv6)] = 0
            self.ips[strip_ipv6(ipv6)] += 1
@chapinb chapinb added this to Staged for development in Black-capped Chickadee release Feb 12, 2020
@chapinb chapinb added the enhancement New feature or request label Feb 12, 2020
@chapinb chapinb moved this from Staged for development to In Progress in Black-capped Chickadee release Mar 1, 2020
@chapinb chapinb moved this from In Progress to Done in Black-capped Chickadee release Mar 1, 2020
@chapinb chapinb closed this as completed Mar 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant