Skip to content

Commit

Permalink
Merge pull request #199 from noir-cr/features/improve-testcode
Browse files Browse the repository at this point in the history
Features/improve testcode
  • Loading branch information
hahwul authored Dec 15, 2023
2 parents f8b6d1e + 4ccd45b commit 9d924a5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion spec/functional_test/fixtures/file_based/base64.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
aHR0cHM6Ly93d3cuaGFod3VsLmNvbS90YWcvY3J5c3RhbC8=
aHR0cHM6Ly93d3cuaGFod3VsLmNvbS90YWcvY3J5c3RhbC8=
eyJ6YXAiOiJodHRwczovL3d3dy5oYWh3dWwuY29tL3RhZy96YXAvIn0=
4 changes: 3 additions & 1 deletion spec/functional_test/testers/file_based_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ extected_endpoints = [
Endpoint.new("https://www.hahwul.com/cullinan", "GET"),
Endpoint.new("https://www.hahwul.com/phoenix", "GET"),
Endpoint.new("https://www.hahwul.com/tag/security/", "GET"),
Endpoint.new("https://www.hahwul.com/tag/crystal/", "GET"),
Endpoint.new("https://www.hahwul.com/tag/zap/", "GET"),
]

tester = FunctionalTester.new("fixtures/file_based/", {
:techs => 0,
:endpoints => 5,
:endpoints => 7,
}, extected_endpoints)

tester.app.options[:url] = "https://www.hahwul.com"
Expand Down
2 changes: 1 addition & 1 deletion src/analyzer/analyzers/file_analyzers/base64.cr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ FileAnalyzer.add_hook(->(path : String, url : String) : Array(Endpoint) {
base64_match = line.match(/([A-Za-z0-9+\/]{20,}={0,2})/)
if base64_match
decoded = Base64.decode_string(base64_match[1])
url_match = decoded.match(/\b(https?:\/\/[^\s]+)/)
url_match = decoded.match(/(https?:\/\/[^\s"]+)/)
if url_match
parsed_url = URI.parse(url_match[1])
if parsed_url.to_s.includes? url
Expand Down

0 comments on commit 9d924a5

Please sign in to comment.