From 14fa018ec1c069c61cee0d4f2f9c369745b297ce Mon Sep 17 00:00:00 2001 From: Sam Sneed <163201376+sam-sneed@users.noreply.github.com> Date: Tue, 13 Aug 2024 16:38:10 -0500 Subject: [PATCH] Make randomized UA strings --- libbrowz.js | 25 +++++++++++++++++++++++-- sneedium-maker.sh | 8 ++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100755 sneedium-maker.sh diff --git a/libbrowz.js b/libbrowz.js index 130b732..9f06299 100644 --- a/libbrowz.js +++ b/libbrowz.js @@ -1,3 +1,23 @@ +const userAgents = [ + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Firefox/128.0", + "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0", + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Edg/120.0.0.0", + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Edg/98.0.0.0", + "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36", + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", + "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0", + "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36", + "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Firefox/128.0" +]; + +function getRandomUserAgent() { + const randomIndex = Math.floor(Math.random() * userAgents.length); + return userAgents[randomIndex]; +} + +let currentUA = "" // We haven't loaded any websites yet. It should be blank. + let tabGroup = document.querySelector("tab-group"); function normalizeUrl(url) { // Define regex patterns for matching URL schemes and local addresses @@ -23,6 +43,7 @@ function normalizeUrl(url) { let url = undefined let browserFrame = undefined function go() { + currentUA = getRandomUserAgent() browserFrame = tabGroup.getActiveTab().webview let browser = tabGroup.getActiveTab() url = normalizeUrl(document.getElementById("txtUrl").value) @@ -38,7 +59,7 @@ function go() { } document.getElementById("txtUrl").value = "" browserFrame.loadURL(url, - {userAgent: 'Sneedium/Undefined (Windows NT 5.1; Win32) AppleWebKit/537.92 (Blink, like Electron) Blink/109.0.5414.74 Safari/537.92'}); + {userAgent: currentUA}); browserFrame.addEventListener('dom-ready', () => { browserFrame.insertCSS(` ::-webkit-scrollbar { @@ -77,7 +98,7 @@ function forward() { function refresh() { if (typeof url != undefined) { browserFrame.loadURL(browserFrame.getURL(), - {userAgent: 'Sneedium/Undefined (Windows NT 5.1; Win32) AppleWebKit/537.92 (Blink, like Electron) Blink/109.0.5414.74 Safari/537.92'}); + {userAgent: currentUA}); } else { window.location.reload() } diff --git a/sneedium-maker.sh b/sneedium-maker.sh new file mode 100755 index 0000000..4f0e4c6 --- /dev/null +++ b/sneedium-maker.sh @@ -0,0 +1,8 @@ +y=$(date +%Y) +read -p "Sneedium # of year $y (1,2,3,4...):" v +npm run make +mkdir "Sneedium $y.$v" +mv sneedium-linux-* "Sneedium $y.$v" +mv sneedium-win32-* "Sneedium $y.$v" +tar -czvf "Sneedium $y.$v.tar.gz" "Sneedium $y.$v" +rm -rf "Sneedium $y.$v"