Skip to content

Commit

Permalink
Phishing: Improved redirect support
Browse files Browse the repository at this point in the history
  • Loading branch information
gdude2002 committed Mar 7, 2024
1 parent df4abf6 commit 5cc223a
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,15 @@ class PhishingExtension(private val settings: ExtPhishingBuilder) : Extension()
}

if (response.headers.contains("Location")) {
val newUrl = response.headers["Location"]!!
var newUrl = response.headers["Location"]!!

if (newUrl.startsWith("/")) {
val (protocol, path) = url.split("://", limit = 2)

newUrl = "$protocol://${path.split("/", limit = 2).first()}$newUrl"
} else if (newUrl.startsWith("./")) {
newUrl = url.trimEnd('/') + newUrl.trimStart('.')
}

if (url.trim('/') == newUrl.trim('/')) {
return null // Results in the same URL
Expand Down

0 comments on commit 5cc223a

Please sign in to comment.