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

IPv6 regex matches on "::" #201

Open
SkeletalDemise opened this issue Oct 9, 2021 · 7 comments
Open

IPv6 regex matches on "::" #201

SkeletalDemise opened this issue Oct 9, 2021 · 7 comments
Labels
good first issue Good for newcomers Regex issue Regex is not full or matches a lot of false positives

Comments

@SkeletalDemise
Copy link
Contributor

Matched on: ::
Name: Internet Protocol (IP) Address Version 6
Link:  https://www.shodan.io/host/::

This shouldn't match.

@ghost ghost added the good first issue Good for newcomers label Oct 9, 2021
@Alireza-Sampour
Copy link
Contributor

Can you explain a little more?

@ghost
Copy link

ghost commented Oct 9, 2021

Can you explain a little more?

It matches a false positive value. The changes of regex may be required or, if regex seems to be perfect, its rarity should be lowered.

@bee-san
Copy link
Owner

bee-san commented Oct 11, 2021

I think we should remove :: :)

@SkeletalDemise
Copy link
Contributor Author

I think we should remove :: :)

What do you mean by that? We can't remove all instances of :: because then the IPv6 regex won't work.

@bee-san
Copy link
Owner

bee-san commented Oct 12, 2021

I think we should remove :: :)

What do you mean by that? We can't remove all instances of :: because then the IPv6 regex won't work.

Why not? :: will also match on things like Dictionary::Entry::Point which is not an ipv6 address. It has too many false positives and isn't helpful.

I doubt the IPv6 address regex will 100% break if we ask it to not match things which are 2 characters

Also, please explain why it won't work in the future instead of making me ask you why :) Saves a lil bit of time / effort ! :)

@SkeletalDemise
Copy link
Contributor Author

I doubt the IPv6 address regex will 100% break if we ask it to not match things which are 2 characters

Sorry I got confused and thought you meant removing all instances of :: and not just :: by itself.

Why not? :: will also match on things like Dictionary::Entry::Point which is not an ipv6 address. It has too many false positives and isn't helpful.

Now I'm confused again. :: is used in IPv6 addresses. See here.

Also, please explain why it won't work in the future instead of making me ask you why :) Saves a lil bit of time / effort ! :)

The reason it wouldn't work is because some IPv6 addresses use :: in them and the regex wouldn't match those.

@amadejpapez
Copy link
Collaborator

I worked on the IPv6 regex, so I can explain why and in what case this happens. :)

Regex doesn't just match to plain :: because we wanted to remove that and a check was added that there must be at least one number. Now, by default with boundaries the "look ahead" check works only on the match and there is no issue. On the other hand in boundaryless mode this check is working on the whole line. For example, in boundaryless if a line has :: and a number after that somewhere, it would show :: as a match.

The reason it wouldn't work is because some IPv6 addresses use :: in them and the regex wouldn't match those.

That is correct. This is why I didn't put any more restrictions in. IPv6 can start or end or have :: multiple times inside as it used as a short version of all numbers being zero.

@ghost ghost added the Regex issue Regex is not full or matches a lot of false positives label Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers Regex issue Regex is not full or matches a lot of false positives
Projects
None yet
Development

No branches or pull requests

4 participants