-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from gosom/add-ordered-headers
feat: Add specific browser headers for StealthMode
- Loading branch information
Showing
4 changed files
with
129 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
package stealth | ||
|
||
import "github.com/Noooste/azuretls-client" | ||
|
||
type settings struct { | ||
browser string | ||
headers azuretls.OrderedHeaders | ||
} | ||
|
||
func newSettings(browser string) settings { | ||
ans := settings{ | ||
browser: browser, | ||
} | ||
|
||
switch browser { | ||
case azuretls.Chrome: | ||
ans.headers = chromeHeaders() | ||
case azuretls.Firefox: | ||
ans.headers = firefoxHeaders() | ||
case azuretls.Opera: | ||
ans.headers = operaHeaders() | ||
case azuretls.Safari: | ||
ans.headers = safariHeaders() | ||
case azuretls.Edge: | ||
ans.headers = edgeHeaders() | ||
} | ||
|
||
return ans | ||
} | ||
|
||
func edgeHeaders() azuretls.OrderedHeaders { | ||
return azuretls.OrderedHeaders{ | ||
{"Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"}, | ||
{"Accept-Encoding", "gzip, deflate, br"}, | ||
{"Accept-Language", "en-US,en;q=0.9"}, | ||
{"Cache-Control", "max-age=0"}, | ||
{"Sec-Ch-Ua", `"Microsoft Edge";v="119", "Chromium";v="119", "Not?A_Brand";v="24"`}, | ||
{"Sec-Ch-Ua-Mobile", "?0"}, | ||
{"Sec-Ch-Ua-Platform", `"Windows"`}, | ||
{"Sec-Fetch-Dest", "document"}, | ||
{"Sec-Fetch-Mode", "navigate"}, | ||
{"Sec-Fetch-Site", "none"}, | ||
{"Sec-Fetch-User", "?1"}, | ||
{"Upgrade-Insecure-Requests", "1"}, | ||
{"User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0"}, | ||
} | ||
} | ||
|
||
func chromeHeaders() azuretls.OrderedHeaders { | ||
return azuretls.OrderedHeaders{ | ||
{"Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"}, | ||
{"Accept-Encoding", "gzip, deflate, br"}, | ||
{"Accept-Language", "en-US,en;q=0.9"}, | ||
{"Cache-Control", "max-age=0"}, | ||
{"Sec-Ch-Ua", `"Google Chrome";v="120", "Chromium";v="120", "Not?A_Brand";v="24"`}, | ||
{"Sec-Ch-Ua-Mobile", "?0"}, | ||
{"Sec-Ch-Ua-Platform", `"Windows"`}, | ||
{"Sec-Fetch-Dest", "document"}, | ||
{"Sec-Fetch-Mode", "navigate"}, | ||
{"Sec-Fetch-Site", "none"}, | ||
{"Sec-Fetch-User", "?1"}, | ||
{"Upgrade-Insecure-Requests", "1"}, | ||
{"User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"}, | ||
} | ||
} | ||
|
||
func firefoxHeaders() azuretls.OrderedHeaders { | ||
return azuretls.OrderedHeaders{ | ||
{"Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"}, | ||
{"Accept-Encoding", "gzip, deflate, br"}, | ||
{"Accept-Language", "en-US,en;q=0.5"}, | ||
{"Cache-Control", "max-age=0"}, | ||
{"DNT", "1"}, | ||
{"Sec-Fetch-Dest", "document"}, | ||
{"Sec-Fetch-Mode", "navigate"}, | ||
{"Sec-Fetch-Site", "none"}, | ||
{"Sec-Fetch-User", "?1"}, | ||
{"Upgrade-Insecure-Requests", "1"}, | ||
{"User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0"}, | ||
} | ||
} | ||
|
||
func operaHeaders() azuretls.OrderedHeaders { | ||
return azuretls.OrderedHeaders{ | ||
{"Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"}, | ||
{"Accept-Encoding", "gzip, deflate, br"}, | ||
{"Accept-Language", "en-US,en;q=0.9"}, | ||
{"Cache-Control", "max-age=0"}, | ||
{"Sec-Ch-Ua", `"Opera";v="103", "Chromium";v="117", "Not;A=Brand";v="8"`}, | ||
{"Sec-Ch-Ua-Mobile", "?0"}, | ||
{"Sec-Ch-Ua-Platform", `"Windows"`}, | ||
{"Sec-Fetch-Dest", "document"}, | ||
{"Sec-Fetch-Mode", "navigate"}, | ||
{"Sec-Fetch-Site", "none"}, | ||
{"Sec-Fetch-User", "?1"}, | ||
{"Upgrade-Insecure-Requests", "1"}, | ||
{"User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 OPR/103.0.0.0"}, | ||
} | ||
} | ||
|
||
func safariHeaders() azuretls.OrderedHeaders { | ||
return azuretls.OrderedHeaders{ | ||
{"Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}, | ||
{"Accept-Encoding", "gzip, deflate, br"}, | ||
{"Accept-Language", "en-US,en;q=0.9"}, | ||
{"Cache-Control", "max-age=0"}, | ||
{"Sec-Fetch-Dest", "document"}, | ||
{"Sec-Fetch-Mode", "navigate"}, | ||
{"Sec-Fetch-Site", "none"}, | ||
{"Upgrade-Insecure-Requests", "1"}, | ||
{"User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Safari/605.1.15"}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters