firecat53 / urlscan

Mutt and terminal url selector (similar to urlview)
GNU General Public License v2.0
211 stars 36 forks source link

Add support for IPv6 URLs #127

Closed wvdongen closed 1 year ago

wvdongen commented 2 years ago

Although perhaps rarely used, I think it would also be nice to also support IPv6 URLs:

echo "http://[2a07:3500:11a0:320::22]:8080 and http://10.0.0.1:8080" | urlscan -n

Currently only detects http://10.0.0.1:8080.

Just some background info on IPv6 in URLs: https://datatracker.ietf.org/doc/html/rfc2732

After a quick Google search, this appears to be a regex compliant to find IPv6 addresses. By modifying the regex to include the obviously the schema and the required [, ] chars (see the RFC) this could perhaps be easily added. Please note, that I haven't tested this at all, there might be far better regexes available and obviously, I don't know what the impact is on the rest of the functionality of urlscan.

firecat53 commented 2 years ago

Sounds like a reasonable request. Likely going to be awhile before I can tackle it. PRs welcome! FYI, the link you provided is just the RFC describing what's allowed for IPV6 within a URL. I'm guessing an actual regex for that (on top of urlscan's existing monstrosity) will be a sight to behold! :D

firecat53 commented 1 year ago

I pushed a commit that hopefully will work for IPv6 URLs and not break anything else! Give it a try (develop branch) if you can and let me know. Sorry it took so long!

wvdongen commented 1 year ago

@firecat53 many thanks for the feature! Could you push a new version to https://pypi.org/?

firecat53 commented 1 year ago

Done. 1.0.0 released on pypi.