Skip to content

Commit

Permalink
enhance refanging
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewarren committed Sep 3, 2019
1 parent bd641fb commit f51bb07
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions refang.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (

// Refang takes a defanged IOC and returns it to it's original form
func Refang(input interface{}) (string, error) {

var output string

switch i := input.(type) {
Expand All @@ -35,7 +34,8 @@ func Refang(input interface{}) (string, error) {
output = strings.Replace(output, "(dot)", ".", -1)
output = strings.Replace(output, "[dot]", ".", -1)
output = strings.Replace(output, "<dot>", ".", -1)
output = strings.Replace(output, "[//]", "//", -1)
output = strings.Replace(output, "<//>", "//", -1)

return output, nil

}
1 change: 1 addition & 0 deletions refang_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func TestRefang(t *testing.T) {
{"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},
{"slashes 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 f51bb07

Please sign in to comment.