-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Add FangURL #654
Add FangURL #654
Conversation
Why is there no merge code here? I feel this feature is still very necessary. Looking forward to hearing from you |
I don't know why this hasn't been merged... It would sure be helpful... |
Apologies that this didn't get merged in sooner! I've only recently taken on this project and it's definitely going to take me ages to get through all the pull requests. In the mean time, #1591 has made essentially an equivalent pull request with a shockingly identical implementation. I'm going to merge that in, but I'm going to credit both of you for coming up with a similar solution. |
function fangURL(url, dots, http, slashes) { | ||
if (dots) url = url.replace(/\[\.\]/g, "."); | ||
if (http) url = url.replace(/hxxp/g, "http"); | ||
if (slashes) url = url.replace(/[://]/g, "://"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI there's a bug here, the []
are being treated as regular expression special characters. You should escape them for searches like this.
In the end this PR actually came out on top, as the other PR had some fundamental issues with it. Made the above bug fix here and merged: #1761 |
FangURL takes a "defanged" URL that was previously rendered useless and allows it to be functional again. In cases where a batch of "defanged" urls have been obtained this will allow for a quick process to return them to their original format. Often necessary when injecting into other systems.