Repository navigation
Add ip_classify custom function - #238
Merged
Merged
Conversation
6 of 8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
ip_classifycustom function that supersedes the approach in #185.Key improvements over #185
ipaddressmodule — stdlib, battle-tested, no manual string parsing127.x.x.xcorrectly classified as private (was a bug in added: function to sort public and private IPv4 #185)classification: 'invalid'with a reason, rather than silently droppedip,classification, andreasonfields, making it easy to filter in playbooks (e.g.classification == 'public')Outputs
Each IP in the input list produces one output record:
ip(CEF type: ip)classificationpublic,private, orinvalidreasonPrivate (RFC1918),Loopback (RFC1122),Public,Not a valid IPv4 addressTest coverage
Validated against:
10.x,172.16-31.x,192.168.x)127.0.0.1)169.254.x.x)100.64.x.x)192.0.2.x,198.51.100.x,203.0.113.x)8.8.8.8,1.1.1.1,208.67.222.222)256.0.0.1,not-an-ip)Closes #185