Skip to content

Commit

Permalink
Merge pull request #461 from owasp-noir/improve-only-url
Browse files Browse the repository at this point in the history
Prevent duplicate URL printing in output
  • Loading branch information
hahwul authored Nov 17, 2024
2 parents 54a9674 + ff665d5 commit cb8dd70
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/output_builder/only-url.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@ require "../models/endpoint"

class OutputBuilderOnlyUrl < OutputBuilder
def print(endpoints : Array(Endpoint))
printed_urls = Set(String).new

endpoints.each do |endpoint|
baked = bake_endpoint(endpoint.url, endpoint.params)
r_url = baked[:url].colorize(:light_yellow).toggle(@is_color)
ob_puts "#{r_url}"
plain_url = baked[:url]
r_url = plain_url.colorize(:light_yellow).toggle(@is_color)

unless printed_urls.includes?(plain_url)
ob_puts "#{r_url}"
printed_urls.add(plain_url)
end
end
end
end

0 comments on commit cb8dd70

Please sign in to comment.