Skip to content

Commit

Permalink
expand support for refanging
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewarren committed Jul 11, 2019
1 parent f70091c commit 987f215
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions refang.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ func Refang(input interface{}) (string, error) {

output = strings.Replace(output, "[.]", ".", -1)
output = strings.Replace(output, "(.)", ".", -1)
output = strings.Replace(output, "<.>", ".", -1)
output = strings.Replace(output, "(dot)", ".", -1)
output = strings.Replace(output, "[dot]", ".", -1)
output = strings.Replace(output, "<dot>", ".", -1)

return output, nil

Expand Down
2 changes: 2 additions & 0 deletions refang_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ func TestRefang(t *testing.T) {
{"dots in tld 2", args{"hxxps://google.co[.]uk"}, "https://google.co.uk", false},
{"subdomain", args{"hxxps://ftp[.]example[.]com"}, "https://ftp.example.com", false},
{"dots word in brackets", args{"hxxps://google[dot]com"}, "https://google.com", false},
{"dots word in angle brackets", args{"hxxps://google<dot>com"}, "https://google.com", false},
{"dots in angle brackets", args{"hxxps://google<.>com"}, "https://google.com", false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 987f215

Please sign in to comment.