Which websites can you access through your proxies and VPN configs? Check them in Octo Browser profiles


Alex Phillips
Customer Service Specialist
Octo Browser is an anti-detect browser for working with multiple accounts: each profile has its own digital fingerprint and connection settings. The connection determines which websites a profile can access: the same website may work through one proxy, show a “Are you human?” check through another, and fail to respond through a third. Checking everything manually takes a long time: testing five proxies against fifty websites can take an entire evening. In this article, we'll show you how to put together a Node.js and Puppeteer script that goes through your list of websites using each of your proxies and VPNs in Octo Browser profiles, then reports whether each website is accessible and, if not, why.
Contents
Maintain your online anonymity with Octo Browser. Your real digital fingerprint cannot be tracked.
Would you like to try Octo Browser at а discount?
Use the promo code OCTOBLOG to get 30% off any subscription. This offer is valid only for new users.
What the script can do
You give the script three lists: websites, proxies, and VPN configs. For each proxy and each VPN, it creates a separate profile in Octo Browser, launches it, opens the websites one by one, and records the results. At the end, you get a table with one row per website and one column per connection, followed by a summary with the reasons for any failures.
Site GB_203.0.113.9 DE_198.51.100.7 google.com AVAILABLE AVAILABLE wikipedia.org AVAILABLE AVAILABLE amazon.com UNAVAILABLE AVAILABLE ebay.com AVAILABLE AVAILABLE GB_203.0.113.9: 3 AVAILABLE, 1 UNAVAILABLE (1 challenge) DE_198.51.100.7: 4 AVAILABLE, 0 UNAVAILABLE
Site GB_203.0.113.9 DE_198.51.100.7 google.com AVAILABLE AVAILABLE wikipedia.org AVAILABLE AVAILABLE amazon.com UNAVAILABLE AVAILABLE ebay.com AVAILABLE AVAILABLE GB_203.0.113.9: 3 AVAILABLE, 1 UNAVAILABLE (1 challenge) DE_198.51.100.7: 4 AVAILABLE, 0 UNAVAILABLE
For example, the script can:
Check proxies and VPNs in a single run. It reads proxies from the
proxies.txtfile and VPNs from WireGuard configuration files in theconfigfolder. It supports the same protocols and line formats as bulk proxy import in Octo Browser, including IPv6 addresses.Identify the reason. If a website doesn't load, the script tells you why: the proxy itself couldn't establish a connection, the website blocked the IP address, required a “Are you human?” check, is unavailable in the connection country, or simply didn't respond.
Tell a block from a random failure. If the connection drops or the website doesn't respond, the script checks again. If the website displays a “Are you human?” check, the script waits for it to clear on its own. If the page loads normally, the mere presence of anti-bot protection isn't treated as a failure.
Run checks in parallel. It checks up to ten connections at once, and the result for each website appears as soon as it's ready.
Name profiles by country and IP. A profile gets a name such as
DE_198.51.100.7. A non-working connection is markedDEAD, while a profile that fails to launch for another reason is markedERROR.Save a report. It creates an Excel file with a summary for each connection. Accessible websites are highlighted in green and inaccessible ones in red. The script also saves a screenshot of each failure page so you can see exactly what the website displayed.
Protect access credentials. Proxy passwords, VPN keys, and the token are not included in the console output or report. Profiles are also stopped properly, even if you interrupt the check.
The script only observes. It doesn't solve CAPTCHAs, click buttons, or enter anything. Keep the following in mind:
A
challengeresult does not mean you've been banned. The website is asking you to confirm that you're human, and you can usually open it manually in the profile.The script checks only the exact URL you provide. A homepage loading successfully doesn't mean that account login or checkout will work. Add the URL of a specific section to the list if that's what you need to test.
The result is accurate at the time of the check. A rotating proxy may use a different IP a minute later, so the results may change.
Each connection gets a new profile, and new proxies are added to the Octo proxy list. Both use up your subscription limits. Step 3 explains how to avoid leaving them behind after the check.
Why not use curl?
You can check a website through a proxy with a single curl command, but it answers a different question, namely, did the request reach the server? It can't tell you whether the website will open in a browser profile.
curlisn't a browser, and websites can tell. Security systems identify it by its TLS fingerprint and set of headers, and may deny thecurlclient itself rather than your proxy.curldoesn't run JavaScript. A browser can pass the “Just a moment” check automatically in a couple of seconds, whilecurlgets stuck on it.curlsees the response code, not the page. A geo-restriction page, CAPTCHA, or denial with a 200 status code all look like a successfully opened website to it.curlcan't check VPNs. It can connect through HTTP and SOCKS proxies, but you can't pass a WireGuard config to it.
curl still has its uses: it's a quick way to find out whether a proxy is working and what its IP address is. Only the browser in the profile can tell you whether a website will open in that profile.
What you'll need
Octo Browser with a Base subscription or higher, which gives you access to the API.
Node.js version 22.12 or later.
A list of proxies or WireGuard VPN configuration files.
Step 1. Install Node.js
Download Node.js from nodejs.org and install it using the default settings. Then open PowerShell: press Win+R, type PowerShell, and press Enter. Check the installation:
node --version
node --version
The command should display version 22.12 or later. This is required by Puppeteer 25, which was used to test the script. If PowerShell says the command can't be found, close PowerShell, reopen it, and try again.
Step 2. Prepare a folder
Choose a folder for the script, for example D:\proxy_check, create it, and navigate to it in PowerShell. Create a config folder inside it for your VPN configurations:
cd D:\ mkdir proxy_check cd proxy_check mkdir config
cd D:\ mkdir proxy_check cd proxy_check mkdir config
Install Puppeteer. The version is specified explicitly because this is the version the script was tested with:
npm install puppeteer-core@25
npm install puppeteer-core@25
Step 3. The site_access.mjs script
In PowerShell, with proxy_check as the current folder, run notepad site_access.mjs. When asked whether you want to create a new file, click Yes, paste the entire code, and save it by pressing Ctrl+S. Creating the file from the command line helps avoid a file-extension issue: if you create it through the Notepad menu, it may be saved as site_access.mjs.txt, and the script won't run. Create the other files in the following steps in the same way.
The settings are listed at the beginning of the code, each with a comment explaining it. One setting is required: paste your API token into API_TOKEN. You can find it in Octo Browser, under the API tokens tab in your master account settings.
const API_TOKEN = "your_token";
const API_TOKEN = "your_token";
You can leave the other settings at their default values. However, pay attention to these two parameters:
KEEP_PROFILES = false sends profiles to the trash after the check.
SAVE_PROXIES = false prevents the tested proxies from being added to the Octo proxy list. With these settings, the profiles and proxies created for testing won't clutter your working lists in the browser. This is useful if your profile limit is low.
Here's a detailed description of the settings:
Setting | What it controls |
|---|---|
| Octo Browser API token |
| Octo client's local API port, 58888 by default. You can find it in the settings under the Additional tab. |
| Profile operating system: |
|
|
| Number of connections checked simultaneously, from 1 to 10. |
| Proxies specified directly in the code, in addition to those in the file. |
| File containing proxies; |
| Type used for proxy lines that don't specify one. |
|
|
| Folder containing VPN configurations; |
| Protocol used by the configuration files and the mode used to identify them in the Octo API. The defaults are |
| File containing the website list; |
|
|
| Whether to save screenshots of failure pages. |
| How many seconds to wait for a website to respond, for the “Are you human?” check to clear, and for page content to appear. |
Here's the code:
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import { crc32 } from "node:zlib"; const API_TOKEN = ""; // paste your Octo API token between the quotes const LOCAL_PORT = 58888; // port of the local API of the Octo client: Octo client, Settings, Additional const OS = "win"; // OS of the profiles: win, mac or android const HEADLESS = false; // true: profiles run without a window; false: with a window const PARALLEL = 5; // connections checked at the same time, from 1 to 10 const PROXIES = [ // one proxy per line, for example "socks5://login:password@proxy.example.com:10000", ]; const PROXY_FILE = "proxies.txt"; // a file next to the script with one proxy per line, read together with PROXIES const DEFAULT_TYPE = "socks5"; // type for proxy lines without one: http, https, socks5 or ssh const SAVE_PROXIES = true; // true: new proxies are saved to Octo's proxy list; false: a proxy lives only in its profile const VPN_FOLDER = "config"; // folder with WireGuard configs: one VPN profile per file const VPN_PROTOCOL = "wireguard"; // protocol of the configs, as the Octo API names it const VPN_SYN_MODE = "profile_based"; // syn_mode of the VPN, as the Octo API names it const SITES_FILE = "sites.txt"; // sites to check: one per line, # starts a comment const KEEP_PROFILES = true; // false: every profile goes to the trash after its check const SCREENSHOTS = true; // true: save a screenshot of every page that did not open const PAGE_TIMEOUT = 45; // seconds a site gets to answer const CHECK_WAIT = 15; // seconds a "checking your browser" page gets to clear by itself const EMPTY_WAIT = 10; // seconds a blank page gets to show something const HERE = dirname(fileURLToPath(import.meta.url)); const CLOUD = "https://app.octobrowser.net/api/v2/automation"; const LOCAL = `http://localhost:${LOCAL_PORT}/api`; const OS_NAMES = { win: "Windows", mac: "macOS", android: "Android" }; const PROXY_TYPES = ["http", "https", "socks5", "ssh"]; const SHORT_PAGE = 2500; const PAGE_LIMITS = { text: 200000, html: 400000, title: 2000 }; const RETRY_TIMEOUT = 20; const PROXY_FAILURES = 3; const BROWSER_TIMEOUT = 30; const RETRY = new Set(["timeout", "connection_reset", "dns_error", "proxy_refused", "unreachable"]); const sleep = (ms) => new Promise((done) => setTimeout(done, ms)); const anyOf = (phrases) => new RegExp(phrases.join("|")); const secrets = new Set(); const hide = (value) => String(value || "").length >= 4 && secrets.add(String(value)); const printable = (text) => String(text).replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]+/g, " "); const redact = (text) => [...secrets] .sort((a, b) => b.length - a.length) .reduce((clean, secret) => clean.split(secret).join("***"), printable(text)) .replace(/\/\/[^\s/@]+@/g, "//***@"); const firstLine = (text) => redact(String(text).split("\n")[0]).slice(0, 200); const fileName = (text) => String(text).replace(/[^\w.-]+/g, "_"); const localStamp = () => new Date(Date.now() - new Date().getTimezoneOffset() * 60000).toISOString().slice(0, 19).replace(/[:T]/g, "-"); const readText = (file) => readFileSync(file, "utf8").replace(/^\uFEFF/, ""); const fail = (message) => { console.error(message); process.exit(1); }; const GEO = anyOf([ "(not|isn.t|aren.t) (currently |yet )?(available|accessible|offered|permitted|allowed|supported) (in|from|for) your (country|region|location|area|territory|jurisdiction)", "(unavailable|blocked|restricted|prohibited|banned|not supported) (in|from|for) your (country|region|location|area|territory|jurisdiction)", "not available in this (country|region)", "access from your (country|region|location) (is|has been) (blocked|restricted|denied|disabled)", "(from|in) a restricted (country|territory|jurisdiction|region|location)", "your (country|region|location|territory) is (restricted|not supported|blocked|not allowed)", "(do|does) not accept (players|customers|users|visitors|residents) from", "(accessing|visiting|located|you are|you.re|you appear)[^.]{0,60}outside (of )?(the )?(uk|u[.]k[.]?|united kingdom|us|u[.]s[.]?|usa|united states|eu)([ .,!]|$)", "country (that |where )?you are (located in|in|accessing from|visiting from)[^.]{0,30}not (supported|allowed|available)", "(do not|don.t|cannot|can.t) allow access (in|from) your (current )?(country|region|location)", "(unavailable|not available|cannot be accessed|can.t be accessed)[^.]{0,120}european (economic area|union)", "unavailable (due to|for) legal reasons", "configured to block access from your country", "недоступ[а-яё]* (в|на территории|для) ваш[а-яё]* (стран|регион)", "nicht in (deinem|ihrem) land", "pas disponible dans votre (pays|région)", "no está disponible en (tu|su) (país|región)", "não está disponível (no|em) seu país", ]); const PROXY_SEEN = anyOf([ "(vpn|proxy|proxies|anonymizer|unblocker)[^.]{0,60}(detected|not (allowed|permitted|supported))", "(appear|seem)s? to be using (a |an )?(vpn|proxy|unblocker|anonymizer)", "(detected|blocked) (a |an |your )?(vpn|proxy|anonymous proxy)", "(disable|turn off|switch off) (your |the |any )?(vpn|proxy)", ]); const CHECKS = anyOf([ "checking (your browser|if the site connection is secure)", "verif(y|ying) (that )?you are (a )?human", "verify (that )?you are not a (robot|bot)", "(prove|confirm) (that )?you are (a )?human", "are you (a )?(human|robot)", "(complete|pass|performing) (a |the )?(security check|captcha)", "security checkpoint", "enable javascript and cookies to continue", "press (&|and) hold", "unusual (traffic|activity)", "suspicious (activity|traffic)", "automated (access|requests|queries|traffic)", "подтвердите, что вы не робот", "проверка браузера", ]); const REFUSALS = anyOf([ "access (to (this|the) (site|page|website|resource|service) )?(is |has been |was )?(denied|forbidden|blocked|restricted)", "you (have been|are|were) (blocked|banned)", "your (ip|ip address|request|access|connection) (has been|was|is) (temporarily )?(blocked|banned|denied|blacklisted|rejected|limited)", "request (blocked|rejected|denied)", "blocked (by|due to) [^.]{0,40}(security|firewall|policy|administrator|rules)", "403 forbidden", "error 403", "you (don.t|do not) have permission to (access|view)", "not authori[sz]ed to (access|view)", "доступ (к (сайту|ресурсу|странице) )?(запрещ|ограничен|заблокирован|закрыт)", "ваш ip[^.]{0,30}(заблокирован|забанен)", ]); const CLOUDFLARE_ERRORS = { 1005: "the network of this IP is banned", 1006: "this IP is banned", 1007: "this IP is banned", 1008: "this IP is banned", 1010: "the browser signature is banned", 1012: "access denied", 1020: "access denied by a firewall rule", }; function guardOf(header, html) { const server = header("server"); if (server.includes("cloudflare") || header("cf-ray")) return "Cloudflare "; if (server.includes("akamai")) return "Akamai "; if (server.includes("ddos-guard") || html.includes("ddos-guard")) return "DDoS-Guard "; return ""; } function cloudflareError(guard, html, short, words) { const onCloudflare = guard === "Cloudflare " || html.includes("cloudflare"); if (!short || !onCloudflare) return ""; return (words.match(/error(?: code)?:? ?(1\d{3})(?!\d)/) || [])[1] || ""; } function view(look) { const text = String(look.text || ""); const title = String(look.title || "").toLowerCase(); const heading = String(look.heading || "").toLowerCase(); const html = String(look.html || "").toLowerCase(); const header = (name) => String(look.headers?.[name] ?? "").toLowerCase(); const short = text.trim().length < SHORT_PAGE; const words = `${title} | ${heading} | ${text.toLowerCase()}`; const guard = guardOf(header, html); return { status: Number(look.status) || 0, url: String(look.url || "").toLowerCase(), html, title, top: `${title} | ${heading}`, words, short, empty: !text.trim(), refusal: short || Number(look.status) >= 400, header, guard, cloudflare: cloudflareError(guard, html, short, words), }; } const said = (page, phrases) => (page.top.match(phrases) || (page.short && page.words.match(phrases)) || [""])[0]; const quoted = (phrase) => (phrase ? `, the page says: "${phrase}"` : ""); const RULES = [ { verdict: "challenge", detail: "Cloudflare challenge", when: (page) => page.header("cf-mitigated").includes("challenge"), }, { verdict: "blocked", detail: (page, state) => `Cloudflare refused (cf-mitigated: ${state})`, when: (page) => page.header("cf-mitigated"), }, { verdict: "blocked", detail: "AWS WAF refused", when: (page) => page.header("x-amzn-waf-action") === "block", }, { verdict: "challenge", detail: (page, action) => `AWS WAF ${action}`, when: (page) => page.header("x-amzn-waf-action"), }, { verdict: "blocked", detail: "Sucuri firewall refused", when: (page) => page.header("x-sucuri-block") || (page.refusal && page.words.includes("sucuri website firewall")), }, { verdict: "challenge", detail: "Kasada check", when: (page) => (page.status >= 400 && (page.header("x-kpsdk-ct") || page.header("x-kpsdk-cd"))) || (page.short && page.html.includes("kpsdk")), }, { verdict: "geo_blocked", detail: "Cloudflare 1009: the site bans the country of this IP", when: (page) => page.cloudflare === "1009" || (page.refusal && page.words.includes("banned the country or region")), }, { verdict: "geo_blocked", detail: "HTTP 451: unavailable for legal reasons in this country", when: (page) => page.status === 451, }, { verdict: "geo_blocked", detail: (page, phrase) => `the page says: "${phrase}"`, when: (page) => said(page, GEO), }, { verdict: "rate_limited", detail: "Cloudflare 1015: too many requests from this IP", when: (page) => page.cloudflare === "1015", }, { verdict: "blocked", detail: (page, meaning) => `Cloudflare ${page.cloudflare}: ${meaning}`, when: (page) => CLOUDFLARE_ERRORS[page.cloudflare], }, { verdict: "blocked", detail: "Cloudflare: 'you have been blocked'", when: (page) => page.short && /sorry, you have been blocked|attention required! \| cloudflare/.test(page.words), }, { verdict: "challenge", detail: "Cloudflare 'Just a moment' check", when: (page) => page.refusal && (page.title.includes("just a moment") || page.html.includes("cf_chl_opt")), }, { verdict: "challenge", detail: "Cloudflare Turnstile check", when: (page) => page.short && page.html.includes("cf-turnstile"), }, { verdict: "blocked", detail: "Akamai: Access Denied", when: (page) => page.refusal && (page.html.includes("errors.edgesuite.net") || page.html.includes("reference #") || /reference #\d+\.[0-9a-f]{6,}/.test(page.words)), }, { verdict: "challenge", detail: "Akamai check", when: (page) => page.short && (page.html.includes("_sec/cp_challenge") || page.html.includes("sec-if-cpt")), }, { verdict: "blocked", detail: "DataDome refused", when: (page) => page.refusal && page.html.includes("captcha-delivery.com") && /temporarily restricted|you have been blocked|access (is |was )?(denied|blocked)/.test(page.words), }, { verdict: "challenge", detail: "DataDome captcha", when: (page) => page.refusal && page.html.includes("captcha-delivery.com"), }, { verdict: "challenge", detail: "PerimeterX (HUMAN) 'Press & Hold'", when: (page) => (page.refusal && page.html.includes("px-captcha")) || page.title.includes("access to this page has been denied") || (page.short && page.status >= 400 && /_pxappid|px-cloud\.net|px-cdn\.net/.test(page.html)), }, { verdict: "blocked", detail: "Imperva (Incapsula) refused", when: (page) => page.refusal && /incapsula incident id|request unsuccessful\. incapsula|this request was blocked by (our|the) security service/.test( page.words, ), }, { verdict: "challenge", detail: "Imperva check", when: (page) => (page.short && page.words.includes("pardon our interruption")) || (page.empty && page.html.includes("_incapsula_resource")), }, { verdict: "blocked", detail: "F5 BIG-IP refused", when: (page) => page.refusal && page.words.includes("the requested url was rejected"), }, { verdict: "blocked", detail: "AWS CloudFront refused", when: (page) => page.status === 403 && page.short && /request blocked|the request could not be satisfied/.test(page.words), }, { verdict: "challenge", detail: "AWS WAF check", when: (page) => page.short && /token\.awswaf\.com|awswafintegration/.test(page.html), }, { verdict: "challenge", detail: "Radware check", when: (page) => page.url.includes("perfdrive.com") || (page.short && page.html.includes("perfdrive.com")), }, { verdict: "challenge", detail: "Vercel security checkpoint", when: (page) => page.title.includes("vercel security checkpoint"), }, { verdict: "challenge", detail: "SiteGround captcha", when: (page) => page.url.includes("/.well-known/sgcaptcha"), }, { verdict: "blocked", detail: "Wordfence refused", when: (page) => page.short && /your access to this site has been limited|generated by wordfence/.test(page.words), }, { verdict: "blocked", detail: "the site blocked the request by its network policy", when: (page) => page.refusal && page.words.includes("blocked due to a network policy"), }, { verdict: "challenge", detail: "Google 'unusual traffic' check", when: (page) => (page.url.includes("google.") && page.url.includes("/sorry/")) || page.words.includes("our systems have detected unusual traffic"), }, { verdict: "challenge", detail: "Amazon captcha", when: (page) => page.refusal && /enter the characters you see below|to discuss automated access to amazon data/.test(page.words), }, { verdict: "challenge", detail: "captcha page", when: (page) => page.short && /recaptcha|hcaptcha|h-captcha|geetest|funcaptcha|arkoselabs/.test(page.html) && /captcha|robot|human|verify|security/.test(page.words), }, { verdict: "blocked", detail: (page, phrase) => `the site sees a proxy or VPN: "${phrase}"`, when: (page) => said(page, PROXY_SEEN), }, { verdict: "challenge", detail: (page, phrase) => `${page.guard}check page: "${phrase}"`, when: (page) => said(page, CHECKS), }, { verdict: "proxy_error", detail: "HTTP 407: the proxy wants another login or password", when: (page) => page.status === 407, }, { verdict: "rate_limited", detail: "HTTP 429: too many requests from this IP", when: (page) => page.status === 429, }, { verdict: "blocked", detail: (page) => `${page.guard}HTTP ${page.status}${quoted(said(page, REFUSALS))}`, when: (page) => [401, 403, 406].includes(page.status), }, { verdict: "blocked", detail: (page, phrase) => `the page says: "${phrase}"`, when: (page) => said(page, REFUSALS), }, { verdict: "server_error", detail: (page) => `HTTP ${page.status}: Cloudflare could not reach the site's own server`, when: (page) => page.status >= 520 && page.status <= 527, }, { verdict: "server_error", detail: (page) => `HTTP ${page.status}: the site itself fails`, when: (page) => page.status >= 500, }, { verdict: "http_error", detail: (page) => `HTTP ${page.status}`, when: (page) => page.status >= 400, }, ]; export function classify(look) { const page = view(look); for (const rule of RULES) { const match = rule.when(page); if (match) { return { verdict: rule.verdict, detail: typeof rule.detail === "function" ? rule.detail(page, match) : rule.detail, }; } } return { verdict: "ok", detail: `HTTP ${page.status || "?"}` }; } const NETWORK_ERRORS = [ { verdict: "proxy_error", codes: /ERR_SOCKS5_AUTH|ERR_SOCKS_AUTH|ERR_PROXY_AUTH_REQUESTED/, detail: "the proxy rejected its login or password: it may have expired or run out of traffic", }, { verdict: "proxy_error", codes: /ERR_PROXY_CONNECTION_FAILED|ERR_PROXY_AUTH|ERR_NO_SUPPORTED_PROXIES|ERR_PROXY_CERTIFICATE|ERR_MANDATORY_PROXY/, detail: "the proxy itself does not work", }, { verdict: "proxy_refused", codes: /ERR_TUNNEL_CONNECTION_FAILED|ERR_SOCKS_CONNECTION/, detail: "the proxy did not open a connection to this site, its provider may block the site", }, { verdict: "timeout", codes: /ERR_TIMED_OUT|ERR_CONNECTION_TIMED_OUT/, detail: "the site did not answer in time", }, { verdict: "connection_reset", codes: /ERR_CONNECTION_RESET|ERR_CONNECTION_CLOSED|ERR_CONNECTION_ABORTED|ERR_EMPTY_RESPONSE|ERR_SOCKET_NOT_CONNECTED/, detail: "the connection was cut before an answer came", }, { verdict: "connection_reset", codes: /ERR_HTTP2_PROTOCOL_ERROR|ERR_QUIC_PROTOCOL_ERROR/, detail: "the site cut the connection, the way some protection services refuse a visitor", }, { verdict: "connection_refused", codes: /ERR_CONNECTION_REFUSED/, detail: "the site refused the connection", }, { verdict: "dns_error", codes: /ERR_NAME_NOT_RESOLVED|ERR_NAME_RESOLUTION_FAILED|ERR_DNS/, detail: "the address of the site was not found", }, { verdict: "ssl_error", codes: /ERR_CERT_COMMON_NAME_INVALID/, detail: "the site's certificate is issued for another address", }, { verdict: "ssl_error", codes: /ERR_CERT_DATE_INVALID/, detail: "the site's certificate has expired or is not valid yet", }, { verdict: "ssl_error", codes: /ERR_SSL|ERR_CERT|ERR_BAD_SSL|ERR_TLS/, detail: "the secure connection failed, something on the way may replace the site's certificate", }, { verdict: "redirect_loop", codes: /ERR_TOO_MANY_REDIRECTS/, detail: "the site redirects in a circle", }, { verdict: "blocked", codes: /ERR_BLOCKED_BY/, detail: "the request was blocked", }, ]; export function networkError(message, timeout = PAGE_TIMEOUT) { const code = (String(message).match(/(?:net::)?\b(ERR_[A-Z0-9_]+)/) || [])[1]; if (!code) { return /timeout/i.test(message) ? { verdict: "timeout", detail: `no answer in ${timeout} s` } : { verdict: "unreachable", detail: firstLine(message) }; } const known = NETWORK_ERRORS.find((entry) => entry.codes.test(code)); return known ? { verdict: known.verdict, detail: `${code}: ${known.detail}` } : { verdict: "unreachable", detail: code }; } let token = ""; let spent = 0; let limits = null; const running = new Set(); const answerOf = async (response) => ({ status: response.status, ok: response.ok, data: await response.json().catch(() => ({})), }); async function cloud(method, path, body) { for (let attempt = 0; ; attempt++) { spent += 1; const response = await fetch(CLOUD + path, { method, headers: { "X-Octo-Api-Token": token, "Content-Type": "application/json" }, body: body ? JSON.stringify(body) : undefined, signal: AbortSignal.timeout(120000), }); if (response.status === 429 && attempt < 5) { const wait = Number(response.headers.get("retry-after")) || 5; if (wait > 60) throw new Error(`Octo's rate limit is used up for ${wait} s, run the script again later`); await sleep(wait * 1000); continue; } const minute = response.headers.get("x-ratelimit-remaining"); const hour = response.headers.get("x-ratelimit-remaining-hour"); if (minute !== null && hour !== null) { limits = { minute, hour, minuteLimit: response.headers.get("x-ratelimit-limit"), hourLimit: response.headers.get("x-ratelimit-limit-hour"), }; if (Number(minute) < 5) await sleep(5000); } return answerOf(response); } } async function local(path, body) { spent += path === "/profiles/active" ? 0 : 1; const response = await fetch(LOCAL + path, { method: body ? "POST" : "GET", headers: { "Content-Type": "application/json" }, body: body ? JSON.stringify(body) : undefined, signal: AbortSignal.timeout(180000), }); return answerOf(response); } async function stopProfile(uuid) { await local("/profiles/stop", { uuid }).catch(() => {}); running.delete(uuid); } process.on("SIGINT", async () => { console.log(`\nStopping ${running.size} running profile(s)...`); await Promise.all([...running].map(stopProfile)); process.exit(130); }); const splitOutsideBrackets = (text) => text.split(/:(?![^[]*\])/); const isPort = (text) => /^\d{1,5}$/.test(text || "") && Number(text) >= 1 && Number(text) <= 65535; const isAddress = (text) => /^\[.+\]$/.test(text) || text.includes(".") || text === "localhost"; export function parseProxy(line, defaultType = DEFAULT_TYPE) { const scheme = line.match(/^([a-z0-9]+):\/\//i); const type = scheme ? scheme[1].toLowerCase() : defaultType; const rest = scheme ? line.slice(scheme[0].length) : line; let host, port, login, secret; if (rest.includes("@")) { const at = rest.lastIndexOf("@"); [login, ...secret] = rest.slice(0, at).split(":"); [host, port] = splitOutsideBrackets(rest.slice(at + 1)); } else { const parts = splitOutsideBrackets(rest); const addressFirst = parts.length <= 2 || (isPort(parts[1]) && (isAddress(parts[0]) || !isPort(parts.at(-1)))); if (addressFirst) { [host, port, login, ...secret] = parts; } else { [login, ...secret] = parts.slice(0, -2); [host, port] = parts.slice(-2); } } const password = secret.join(":"); if (!PROXY_TYPES.includes(type) || !host || !isPort(port)) return null; const address = host.replace(/^\[(.+)\]$/, "$1"); return { type, host: address, port: Number(port), ...(login ? { login } : {}), ...(password ? { password } : {}) }; } function proxyLabel(proxy) { const host = proxy.host.includes(":") ? `[${proxy.host}]` : proxy.host; return `${proxy.type}://${proxy.login ? `…${proxy.login.slice(-10)}@` : ""}${host}:${proxy.port}`; } async function proxyUuid(job, saved) { const { proxy } = job; const same = (other) => proxy.type === String(other.type).toLowerCase() && proxy.host === other.host && String(proxy.port) === String(other.port) && (proxy.login || "") === (other.login || "") && (proxy.password || "") === (other.password || ""); const known = saved.find(same); if (known) return known.uuid; const added = await cloud("POST", "/proxies", { ...proxy, title: `proxy ${proxy.host}:${proxy.port} #${job.number}`, }); if (!added.data?.data?.uuid) { throw new Error(`could not add the proxy to Octo (HTTP ${added.status} ${added.data?.code || ""})`); } return added.data.data.uuid; } export function checkVpnConfig(text) { const keys = { interface: new Set(), peer: new Set() }; let section = ""; let endpoint = ""; for (const line of text.split("\n")) { const head = line.match(/^\s*\[(\w+)\]/); const pair = line.match(/^\s*(\w+)\s*=\s*(\S+)/); if (head) section = head[1].toLowerCase(); if (!pair || !keys[section]) continue; keys[section].add(pair[1].toLowerCase()); if (section === "peer" && pair[1].toLowerCase() === "endpoint") endpoint = pair[2]; } const required = [ ["Interface", "PrivateKey"], ["Interface", "Address"], ["Peer", "PublicKey"], ["Peer", "Endpoint"], ]; const missing = required .filter(([part, key]) => !keys[part.toLowerCase()].has(key.toLowerCase())) .map(([part, key]) => `${key} in [${part}]`); if (missing.length) return `no ${missing.join(", ")}`; if (!/^(\[[0-9a-f:.]+\]|[a-z0-9.-]+):\d{1,5}$/i.test(endpoint)) { return `Endpoint must be address:port, without http://, not "${endpoint}"`; } return ""; } export function findVpns(folder) { const vpns = []; const skipped = []; if (!existsSync(folder) || !statSync(folder).isDirectory()) return { vpns, skipped }; const files = readdirSync(folder) .filter((file) => statSync(join(folder, file)).isFile()) .sort((a, b) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" })); for (const file of files) { const raw = readFileSync(join(folder, file)); const text = raw .toString("utf8") .replace(/^\uFEFF/, "") .replace(/\r\n/g, "\n"); if (!/^\s*\[Interface\]/im.test(text) || !/^\s*\[Peer\]/im.test(text)) { skipped.push(file); continue; } const problem = checkVpnConfig(text); if (problem) throw new Error(`${file}: ${problem}`); vpns.push({ file, conf: raw.toString("base64") }); } return { vpns, skipped }; } export function readSites(text) { const sites = []; for (const [index, raw] of text.split(/\r?\n/).entries()) { const line = raw.replace(/\s+#.*$/, "").trim(); if (!line || line.startsWith("#") || /^\[.*\]$/.test(line)) continue; let url; try { url = new URL(/^[a-z]+:\/\//i.test(line) ? line : `https://${line}`); } catch { url = null; } if (!url || !["http:", "https:"].includes(url.protocol) || !url.hostname.includes(".")) { throw new Error(`line ${index + 1}: "${line}" is not a site address`); } const site = url.href.replace(/\/$/, ""); if (!sites.includes(site)) sites.push(site); } return sites; } const REGION_NAMES = new Intl.DisplayNames(["en"], { type: "region" }); const COUNTRY_CODES = new Map(); for (let first = 65; first <= 90; first++) { for (let second = 65; second <= 90; second++) { const code = String.fromCharCode(first, second); try { const name = REGION_NAMES.of(code); if (new Intl.Locale(`und-${code}`).region === code && name && name !== code) { COUNTRY_CODES.set(name.toLowerCase(), code); } } catch { continue; } } } async function countryOf(exit) { const code = String(exit.countryCode || exit.country_code || ""); if (/^[A-Za-z]{2}$/.test(code)) return code.toUpperCase(); const byName = COUNTRY_CODES.get(String(exit.country || exit.countryName || "").toLowerCase()); if (byName) return byName; if (!exit.ip) return "XX"; try { const url = `https://get.geojs.io/v1/ip/country/${encodeURIComponent(exit.ip)}.json`; const found = (await (await fetch(url, { signal: AbortSignal.timeout(20000) })).json()).country; return /^[A-Z]{2}$/.test(found || "") ? found : "XX"; } catch { return "XX"; } } let androidModels = []; async function loadAndroidModels() { const answer = await cloud("GET", "/fingerprint/device_models?device_type=phone"); const models = Array.isArray(answer.data?.data) ? answer.data.data : []; androidModels = models.filter((model) => model?.value && model.os_versions?.length); if (!androidModels.length) fail(`Could not read the Android phone models: HTTP ${answer.status}. Nothing was done.`); } function fingerprint() { if (OS !== "android") return { os: OS }; const model = androidModels[Math.floor(Math.random() * androidModels.length)]; const version = model.os_versions[Math.floor(Math.random() * model.os_versions.length)]; return { os: "android", os_arch: "arm", device_type: "phone", device_model: model.value, os_version: String(version), }; } export function hostOf(url) { try { return new URL(url).hostname.replace(/^www\./, ""); } catch { return String(url); } } export function siteName(url) { try { const path = new URL(url).pathname.replace(/\/$/, ""); return hostOf(url) + path; } catch { return String(url); } } export function brandOf(url) { const parts = hostOf(url).split("."); const secondLevel = ["co", "com", "org", "net", "gov", "ac", "edu", "ltd", "plc"]; const deep = parts.length > 2 && secondLevel.includes(parts[parts.length - 2]); return parts[parts.length - (deep ? 3 : 2)] || parts[0]; } const shows = (look) => String(look.text || "").trim().length >= 20 || /<(img|canvas|svg|video)\b/i.test(String(look.html || "")); async function read(page, answer) { const nothing = { ...answer, title: "", heading: "", text: "", html: "" }; for (let attempt = 0; attempt < 3; attempt++) { try { const seen = await page.evaluate( (limits) => ({ text: (document.body?.innerText || "").slice(0, limits.text), heading: (document.querySelector("h1")?.innerText || "").slice(0, limits.title), title: document.title.slice(0, limits.title), html: (document.documentElement?.outerHTML || "").slice(0, limits.html), }), PAGE_LIMITS, ); if (seen.text.trim().length < SHORT_PAGE) { const frames = page.frames().slice(1, 6); const inside = (frame) => frame.evaluate(() => document.body?.innerText || "").catch(() => ""); const texts = await Promise.all( frames.map((frame) => Promise.race([inside(frame), sleep(3000).then(() => "")])), ); seen.text = [seen.text, ...texts].join("\n").slice(0, PAGE_LIMITS.text); } return { ...answer, ...seen, url: page.url() }; } catch (error) { if (/timed out/i.test(error.message)) return { ...nothing, url: page.url(), unresponsive: true }; await sleep(1000); } } return { ...nothing, url: page.url() }; } const RESTRICTION_PAGE = /(^|[./_-])(restricted|restriction|geo-?block(ed)?|geo-?restrict(ed|ion)?|not-?available|unavailable|access-?denied|blocked|forbidden|country-?(not-?)?(allowed|supported|restricted))([./?#_-]|$)/i; export function restrictionPage(asked, reached) { try { const from = new URL(asked); const to = new URL(reached); if (from.hostname === to.hostname && from.pathname === to.pathname) return ""; const where = `${to.hostname}${to.pathname}`; return RESTRICTION_PAGE.test(where) && !RESTRICTION_PAGE.test(`${from.hostname}${from.pathname}`) ? where : ""; } catch { return ""; } } function moved(asked, look, found) { const to = hostOf(look.url); if (!look.url || to === hostOf(asked)) return found; if (brandOf(look.url) === brandOf(asked)) return { ...found, detail: `${found.detail}, opened as ${to}` }; const page = view(look); const lead = `${page.top} | ${String(look.text || "") .toLowerCase() .slice(0, 1500)}`; const phrase = [GEO, PROXY_SEEN, REFUSALS, CHECKS].map((list) => (lead.match(list) || [""])[0]).find(Boolean); if (!page.short && !phrase) { return { ...found, detail: `${found.detail}, but opened another site: ${to} (check that it is the one you need)` }; } return { verdict: "redirected", detail: `sent to another site, ${to}` + (phrase ? `, which says: "${phrase}"` : "") }; } function watchAnswer(page) { const answer = { status: 0, headers: {} }; page.on("response", (response) => { try { if (response.request().isNavigationRequest() && response.frame() === page.mainFrame()) { Object.assign(answer, { status: response.status(), headers: response.headers() }); } } catch { return; } }); return answer; } async function waitFor(page, answer, look, seconds, pause, settled) { for (const until = Date.now() + seconds * 1000; !settled(look) && Date.now() < until;) { await sleep(pause); look = await read(page, answer); } return look; } async function judge(page, answer, url, slow, timeout) { const stuck = (seen) => seen.unresponsive && { verdict: "unresponsive", detail: `the page stopped responding (HTTP ${seen.status})` }; let look = await read(page, answer); if (look.url.startsWith("chrome-error://") && look.status < 400) return networkError(look.text, timeout); let found = classify(look); if (found.verdict === "challenge") { const check = found.detail; look = await waitFor(page, answer, look, CHECK_WAIT, 2500, (seen) => classify(seen).verdict !== "challenge"); found = classify(look); if (found.verdict === "ok") found.detail += `, passed a check by itself (${check})`; } if (found.verdict === "ok" && !shows(look) && !stuck(look)) { look = await waitFor(page, answer, look, EMPTY_WAIT, 2000, (seen) => shows(seen) || seen.unresponsive); found = classify(look); if (found.verdict === "ok" && !shows(look) && !stuck(look)) { return slow ? { verdict: "timeout", detail: `the site answered (HTTP ${look.status}) but the page did not load in ${timeout} s`, } : { verdict: "empty", detail: `the page stayed empty for ${EMPTY_WAIT} s` }; } } if (stuck(look)) return stuck(look); const restriction = found.verdict === "ok" && restrictionPage(url, look.url); if (restriction) return { verdict: "geo_blocked", detail: `sent to a restriction page, ${restriction.replace(/\/$/, "")}` }; if (found.verdict === "ok") found = moved(url, look, found); if (found.verdict === "ok" && slow) found.detail += ", loaded slowly"; return found; } async function inspect(browser, url, shot, timeout) { const page = await browser.newPage(); const answer = watchAnswer(page); page.on("dialog", (dialog) => dialog.dismiss().catch(() => {})); try { let slow = false; try { await page.goto(url, { waitUntil: "domcontentloaded", timeout: timeout * 1000 }); } catch (error) { const failed = /net::ERR_/.test(error.message) && !error.message.includes("ERR_ABORTED"); if (!answer.status || failed) return networkError(error.message, timeout); slow = /timeout/i.test(error.message); } await page.waitForNetworkIdle({ idleTime: 800, timeout: 8000 }).catch(() => {}); const found = await judge(page, answer, url, slow, timeout); if (found.verdict !== "ok" && found.verdict !== "unresponsive" && shot) { found.screenshot = await page.screenshot({ path: shot }).then( () => shot, () => "", ); } return found; } finally { await page.close().catch(() => {}); } } export async function checkSite(browser, url, shot = "") { let found = await inspect(browser, url, shot, PAGE_TIMEOUT); if (RETRY.has(found.verdict)) { const first = found.verdict; await sleep(3000); found = await inspect(browser, url, shot, Math.min(PAGE_TIMEOUT, RETRY_TIMEOUT)); found.detail += found.verdict === first ? " (on the second try too)" : ` (the first try: ${first})`; } return { result: found.verdict === "ok" ? "AVAILABLE" : "UNAVAILABLE", reason: `${found.verdict}: ${printable(found.detail)}`, screenshot: found.screenshot || "", }; } function checkSettings() { const seconds = [PAGE_TIMEOUT, CHECK_WAIT, EMPTY_WAIT]; const problems = [ [!OS_NAMES[OS], `OS is win, mac or android, not "${OS}".`], [typeof HEADLESS !== "boolean", "HEADLESS is true or false, without quotes."], [typeof KEEP_PROFILES !== "boolean", "KEEP_PROFILES is true or false, without quotes."], [typeof SCREENSHOTS !== "boolean", "SCREENSHOTS is true or false, without quotes."], [!Number.isInteger(PARALLEL) || PARALLEL < 1 || PARALLEL > 10, "PARALLEL is a whole number from 1 to 10."], [!PROXY_TYPES.includes(DEFAULT_TYPE), `DEFAULT_TYPE is one of ${PROXY_TYPES.join(", ")}.`], [seconds.some((value) => !(value > 0)), "PAGE_TIMEOUT, CHECK_WAIT and EMPTY_WAIT are seconds above zero."], [!Number.isInteger(LOCAL_PORT) || LOCAL_PORT < 1 || LOCAL_PORT > 65535, "LOCAL_PORT is a port number, 1 to 65535."], [typeof SAVE_PROXIES !== "boolean", "SAVE_PROXIES is true or false, without quotes."], ]; const problem = problems.find(([wrong]) => wrong); if (problem) fail(`${problem[1]} Nothing was done.`); } function readToken() { const found = String(API_TOKEN).trim(); if (!found) fail("No API token: paste it into API_TOKEN at the top of the script. Nothing was done."); return found; } function readProxies() { const file = join(HERE, PROXY_FILE); const fromFile = PROXY_FILE && existsSync(file) ? readText(file).split(/\r?\n/) : []; const lines = [...PROXIES, ...fromFile].map((line) => line.trim()).filter((line) => line && !line.startsWith("#")); const proxies = lines.map((line) => parseProxy(line)); const bad = proxies.flatMap((proxy, index) => (proxy ? [] : [index + 1])); if (bad.length) fail(`Proxy line(s) ${bad.join(", ")} not understood. Nothing was done.`); proxies.forEach((proxy) => hide(proxy.password)); return proxies; } function readVpns() { try { const { vpns, skipped } = findVpns(join(HERE, VPN_FOLDER)); if (skipped.length) console.log(`Not VPN configs, skipped in ${VPN_FOLDER}: ${skipped.join(", ")}`); if (vpns.length) console.log(`VPN configs found in ${VPN_FOLDER}: ${vpns.map((vpn) => vpn.file).join(", ")}`); if (vpns.length && !(String(VPN_PROTOCOL).trim() && String(VPN_SYN_MODE).trim())) { fail("VPN_PROTOCOL and VPN_SYN_MODE can't be empty. Nothing was done."); } for (const vpn of vpns) { hide(vpn.conf); const keys = Buffer.from(vpn.conf, "base64") .toString() .matchAll(/^\s*(?:PrivateKey|PresharedKey)\s*=\s*(\S+)/gim); for (const [, key] of keys) hide(key); } return vpns; } catch (error) { return fail(`VPN config ${error.message} (folder ${VPN_FOLDER}). Nothing was done.`); } } function readSitesFile() { const file = join(HERE, SITES_FILE); if (!existsSync(file)) fail(`${SITES_FILE} not found next to the script: put the sites there. Nothing was done.`); try { const sites = readSites(readText(file)); if (!sites.length) fail(`${SITES_FILE} has no sites. Nothing was done.`); return sites; } catch (error) { return fail(`${SITES_FILE}, ${error.message}. Nothing was done.`); } } async function connectionOf(job, saved) { if (job.vpn) return { type: "vpn", vpn_protocol: VPN_PROTOCOL, conf: job.vpn.conf, syn_mode: VPN_SYN_MODE }; return SAVE_PROXIES ? { uuid: await proxyUuid(job, saved) } : job.proxy; } async function createProfile(job, saved) { const connection = await connectionOf(job, saved); const profile = { title: `checking ${job.number}`, fingerprint: fingerprint(), proxy: connection }; const made = await cloud("POST", "/profiles", profile); if (made.data?.data?.uuid) return made.data.data.uuid; const errors = made.data?.errors ? JSON.stringify(made.data.errors).slice(0, 200) : ""; const why = [made.data?.code, made.data?.msg || made.data?.error, errors].filter(Boolean).join(" "); throw new Error(`could not create a profile (HTTP ${made.status} ${why})`); } async function startProfile(uuid) { const start = { uuid, headless: HEADLESS, debug_port: true, flags: ["--disable-backgrounding-occluded-windows"] }; const started = await local("/profiles/start", start).catch((error) => ({ ok: false, data: { error: error.message }, })); const works = Boolean(started.ok && started.data?.ws_endpoint); if (works) running.add(uuid); return { ...started, works }; } function progress(index, total, site, checked) { const count = `${String(index + 1).padStart(String(total).length)}/${total}`; const reason = /^ok: HTTP [\d?]+$/.test(checked.reason) ? "" : checked.reason; return `${count} ${checked.result.padEnd(11)} ${siteName(site).padEnd(30)} ${reason}`.trimEnd(); } async function visitSites(job, started, name, { sites, puppeteer, stamp }, say) { const entries = []; const ip = printable(started.data.connection_data?.ip || ""); const folder = join(HERE, `screens_${stamp}`, fileName(`${job.number}_${name}`)); if (SCREENSHOTS) mkdirSync(folder, { recursive: true }); let browser; let failures = 0; try { browser = await puppeteer.connect({ browserWSEndpoint: started.data.ws_endpoint, defaultViewport: null, protocolTimeout: BROWSER_TIMEOUT * 1000, }); for (const [index, site] of sites.entries()) { const number = String(index + 1).padStart(String(sites.length).length, "0"); const shot = SCREENSHOTS ? join(folder, `${number}_${fileName(siteName(site))}.png`) : ""; const checked = await checkSite(browser, site, shot); entries.push({ site, ...checked, ip }); say(progress(index, sites.length, site, checked)); failures = checked.reason.startsWith("proxy_error:") ? failures + 1 : 0; const rest = sites.slice(index + 1); if (failures === PROXY_FAILURES && rest.length) { const kind = job.vpn ? "VPN" : "proxy"; const reason = `not checked: the ${kind} stopped working after site ${index + 1}`; say(`the ${kind} stopped working: ${PROXY_FAILURES} proxy errors in a row, ${rest.length} site(s) not checked`); entries.push(...rest.map((left) => ({ site: left, result: "SKIPPED", reason, ip }))); break; } } } catch (error) { say(`stopped after ${entries.length} of ${sites.length} site(s): ${firstLine(error.message)}`); } finally { await browser?.disconnect().catch(() => {}); } return entries; } function startFailure(job, started, sites) { const reason = redact(started.data?.code || started.data?.error || `HTTP ${started.status}`); const dead = /proxy/i.test(reason) || [4, 5].includes(started.data?.error_code); const name = `${dead ? "DEAD" : "ERROR"}_${fileName(job.vpn ? job.vpn.file : job.proxy.host)}`; const problem = dead ? `the ${job.vpn ? "VPN" : "proxy"} does not work` : "could not start the profile"; return { name, message: `${job.label} -> ${name}: ${problem} (${reason})`, entries: sites.map((site) => ({ site, result: dead ? "DEAD" : "ERROR", reason })), }; } async function finishProfile(uuid, name, say) { const renamed = await cloud("PATCH", `/profiles/${uuid}`, { title: name }); if (!renamed.ok) say(`could not rename the profile (HTTP ${renamed.status})`); if (!KEEP_PROFILES) await cloud("DELETE", "/profiles", { uuids: [uuid], skip_trash_bin: false }); } async function checkConnection(job, context) { let tag = `#${job.number}`; const say = (text) => console.log(`[${tag}] ${text}`); const uuid = await createProfile(job, context.saved); say(`${job.label}: starting the profile...`); const started = await startProfile(uuid); let name, entries; if (started.works) { const exit = started.data.connection_data || {}; name = `${await countryOf(exit)}_${printable(exit.ip || "no-ip")}`; tag = `#${job.number} ${name}`; say(`${job.label}: started, ${context.sites.length} site(s) to check`); try { entries = await visitSites(job, started, name, context, say); } finally { await stopProfile(uuid); } } else { if (started.ok || started.status === undefined) await stopProfile(uuid); const failure = startFailure(job, started, context.sites); say(failure.message); ({ name, entries } = failure); } await finishProfile(uuid, name, say); const blank = { profile: name, proxy: `#${job.number} ${job.label}`, ip: "", screenshot: "" }; const rows = entries.map((entry) => ({ ...blank, ...entry })); if (rows.some((entry) => entry.result.endsWith("AVAILABLE"))) say(`done: ${summary(rows, context.sites.length)}`); return { name, rows }; } function reasonsOf(rows) { const reasons = new Map(); for (const entry of rows.filter((row) => row.result === "UNAVAILABLE")) { const reason = entry.reason.split(":")[0]; reasons.set(reason, (reasons.get(reason) || 0) + 1); } return [...reasons] .sort((a, b) => b[1] - a[1]) .map(([reason, times]) => `${times} ${reason}`) .join(", "); } function unchecked(rows, expected) { const skipped = rows.filter((entry) => entry.result === "SKIPPED"); const missed = expected - rows.length; return ( (skipped.length ? `, ${skipped.length} not checked: ${skipped[0].reason.replace(/^not checked: /, "")}` : "") + (missed ? `, ${missed} not checked` : "") ); } function summary(rows, expected) { const count = (result) => rows.filter((entry) => entry.result === result).length; if (count("DEAD")) return "does not work"; if (count("ERROR")) return `not checked: ${rows[0].reason}`; const why = reasonsOf(rows); return ( `${count("AVAILABLE")} AVAILABLE, ${count("UNAVAILABLE")} UNAVAILABLE` + (why ? ` (${why})` : "") + unchecked(rows, expected) ); } async function runAll(jobs, limit, work) { const results = new Array(jobs.length); let next = 0; const worker = async () => { while (next < jobs.length) { const index = next++; const job = jobs[index]; const done = await work(job).catch((error) => { console.log(`[#${job.number}] ${job.label}: ${firstLine(error.message)}`); return { name: "", rows: [] }; }); results[index] = { number: job.number, label: job.label, ...done }; } }; await Promise.all(Array.from({ length: limit }, worker)); return results; } function printTable(sites, results) { const columns = results.filter((column) => column.name); const repeated = (name) => columns.filter((column) => column.name === name).length > 1; const titles = columns.map((column) => (repeated(column.name) ? `${column.name} #${column.number}` : column.name)); const width = Math.max(11, ...titles.map((title) => title.length)) + 2; const siteWidth = Math.max(4, ...sites.map((site) => siteName(site).length)) + 2; console.log("Site".padEnd(siteWidth) + titles.map((title) => title.padEnd(width)).join("")); for (const site of sites) { const cells = columns.map((column) => column.rows.find((entry) => entry.site === site)?.result || "-"); console.log(siteName(site).padEnd(siteWidth) + cells.map((cell) => cell.padEnd(width)).join("")); } console.log(""); columns.forEach((column, index) => console.log(`${titles[index]}: ${summary(column.rows, sites.length)}`)); } const REPORT_COLUMNS = ["profile", "proxy", "site", "result", "reason", "ip"]; function zip(files) { const parts = []; const directory = []; let offset = 0; for (const [name, text] of files) { const title = Buffer.from(name); const data = Buffer.from(text); const local = Buffer.alloc(30); local.writeUInt32LE(0x04034b50, 0); local.writeUInt16LE(20, 4); local.writeUInt16LE(0x0800, 6); local.writeUInt16LE(0x21, 12); local.writeUInt32LE(crc32(data), 14); local.writeUInt32LE(data.length, 18); local.writeUInt32LE(data.length, 22); local.writeUInt16LE(title.length, 26); const central = Buffer.alloc(46); central.writeUInt32LE(0x02014b50, 0); central.writeUInt16LE(20, 4); central.writeUInt16LE(20, 6); local.copy(central, 8, 6, 30); central.writeUInt32LE(offset, 42); parts.push(local, title, data); directory.push(central, title); offset += local.length + title.length + data.length; } const index = Buffer.concat(directory); const end = Buffer.alloc(22); end.writeUInt32LE(0x06054b50, 0); end.writeUInt16LE(files.length, 8); end.writeUInt16LE(files.length, 10); end.writeUInt32LE(index.length, 12); end.writeUInt32LE(offset, 16); return Buffer.concat([...parts, index, end]); } const XLSX_ROW_STYLES = { AVAILABLE: 2, UNAVAILABLE: 3 }; const XLSX_OTHER_STYLE = 4; const XLSX_STYLES = '<fonts count="5"><font><sz val="11"/><name val="Calibri"/></font>' + '<font><b/><sz val="11"/><name val="Calibri"/></font>' + '<font><sz val="11"/><color rgb="FF006100"/><name val="Calibri"/></font>' + '<font><sz val="11"/><color rgb="FF9C0006"/><name val="Calibri"/></font>' + '<font><sz val="11"/><color rgb="FF595959"/><name val="Calibri"/></font></fonts>' + '<fills count="5"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill>' + '<fill><patternFill patternType="solid"><fgColor rgb="FFC6EFCE"/></patternFill></fill>' + '<fill><patternFill patternType="solid"><fgColor rgb="FFFFC7CE"/></patternFill></fill>' + '<fill><patternFill patternType="solid"><fgColor rgb="FFE7E6E6"/></patternFill></fill></fills>' + '<borders count="1"><border/></borders>' + '<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>' + '<cellXfs count="5"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>' + '<xf numFmtId="0" fontId="1" fillId="0" borderId="0" xfId="0" applyFont="1"/>' + '<xf numFmtId="0" fontId="2" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1"/>' + '<xf numFmtId="0" fontId="3" fillId="3" borderId="0" xfId="0" applyFont="1" applyFill="1"/>' + '<xf numFmtId="0" fontId="4" fillId="4" borderId="0" xfId="0" applyFont="1" applyFill="1"/></cellXfs>' + '<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>'; const SUMMARY_COLUMNS = ["profile", "proxy", "AVAILABLE", "UNAVAILABLE", "why unavailable", "ip"]; function summaryRows(results, siteCount) { return results.map((result) => { const count = (word) => result.rows.filter((entry) => entry.result === word).length; const dead = count("DEAD") || count("ERROR"); const note = dead ? summary(result.rows, siteCount) : `${reasonsOf(result.rows)}${unchecked(result.rows, siteCount)}`.replace(/^, /, ""); return { values: [ result.name || "not started", `#${result.number} ${result.label}`, dead || !result.rows.length ? "" : count("AVAILABLE"), dead || !result.rows.length ? "" : count("UNAVAILABLE"), !result.rows.length ? "the profile was not created" : note, result.rows[0]?.ip || "", ], dead: dead || !result.rows.length, }; }); } function xlsxSheet(results, siteCount) { const escapes = { "<": "<", ">": ">", "&": "&" }; const text = (value) => printable(value ?? "") .replace(/[\uFFFE\uFFFF]/g, "") .slice(0, 32000) .replace(/[<>&]/g, (sign) => escapes[sign]); const cell = (column, line, value, style) => { const where = `${String.fromCharCode(65 + column)}${line}`; if (typeof value === "number") return `<c r="${where}" s="${style}"><v>${value}</v></c>`; return `<c r="${where}" t="inlineStr" s="${style}"><is><t xml:space="preserve">${text(value)}</t></is></c>`; }; const line = (values, number, styles) => `<row r="${number}">${values .map((value, column) => cell(column, number, value, Array.isArray(styles) ? styles[column] : styles)) .join("")}</row>`; const rows = results.flatMap((result) => result.rows); const lines = []; const add = (values, styles) => lines.push(line(values, lines.length + 1, styles)); add(["TOTAL", `${siteCount} site(s) through ${results.length} connection(s)`], 1); add(SUMMARY_COLUMNS, 1); for (const { values, dead } of summaryRows(results, siteCount)) { add(values, dead ? XLSX_OTHER_STYLE : [0, 0, XLSX_ROW_STYLES.AVAILABLE, XLSX_ROW_STYLES.UNAVAILABLE, 0, 0]); } lines.push(`<row r="${lines.length + 1}"/>`); const header = lines.length + 1; add(REPORT_COLUMNS, 1); for (const entry of rows) { add( REPORT_COLUMNS.map((column) => entry[column]), XLSX_ROW_STYLES[entry.result] || XLSX_OTHER_STYLE, ); } const widths = REPORT_COLUMNS.map((column, i) => Math.min( 90, Math.max( column.length, SUMMARY_COLUMNS[i].length, ...rows.map((entry) => String(entry[column] ?? "").length), ...summaryRows(results, siteCount).map((row) => String(row.values[i] ?? "").length), ) + 2, ), ); const last = `${String.fromCharCode(64 + REPORT_COLUMNS.length)}${lines.length}`; return ( `<cols>${widths.map((width, i) => `<col min="${i + 1}" max="${i + 1}" width="${width}" customWidth="1"/>`).join("")}</cols>` + `<sheetData>${lines.join("")}</sheetData><autoFilter ref="A${header}:${last}"/>` ); } function writeXlsx(results, siteCount, stamp) { const head = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'; const main = "http://schemas.openxmlformats.org/spreadsheetml/2006/main"; const office = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"; const packageRels = "http://schemas.openxmlformats.org/package/2006/relationships"; const type = "application/vnd.openxmlformats-officedocument.spreadsheetml"; const file = join(HERE, `site_access_${stamp}.xlsx`); const files = [ [ "[Content_Types].xml", `${head}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">` + '<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>' + '<Default Extension="xml" ContentType="application/xml"/>' + `<Override PartName="/xl/workbook.xml" ContentType="${type}.sheet.main+xml"/>` + `<Override PartName="/xl/worksheets/sheet1.xml" ContentType="${type}.worksheet+xml"/>` + `<Override PartName="/xl/styles.xml" ContentType="${type}.styles+xml"/></Types>`, ], [ "_rels/.rels", `${head}<Relationships xmlns="${packageRels}">` + `<Relationship Id="rId1" Type="${office}/officeDocument" Target="xl/workbook.xml"/></Relationships>`, ], [ "xl/workbook.xml", `${head}<workbook xmlns="${main}" xmlns:r="${office}">` + '<sheets><sheet name="Report" sheetId="1" r:id="rId1"/></sheets></workbook>', ], [ "xl/_rels/workbook.xml.rels", `${head}<Relationships xmlns="${packageRels}">` + `<Relationship Id="rId1" Type="${office}/worksheet" Target="worksheets/sheet1.xml"/>` + `<Relationship Id="rId2" Type="${office}/styles" Target="styles.xml"/></Relationships>`, ], ["xl/styles.xml", `${head}<styleSheet xmlns="${main}">${XLSX_STYLES}</styleSheet>`], ["xl/worksheets/sheet1.xml", `${head}<worksheet xmlns="${main}">${xlsxSheet(results, siteCount)}</worksheet>`], ]; writeFileSync(file, zip(files)); return file; } async function main() { checkSettings(); token = readToken(); hide(token); const proxies = readProxies(); const vpns = readVpns(); if (!proxies.length && !vpns.length) { fail( `Nothing to check: put proxies into ${PROXY_FILE || "PROXIES"} or WireGuard configs into ${VPN_FOLDER}. Nothing was done.`, ); } const sites = readSitesFile(); const puppeteer = await import("puppeteer-core").then( (module) => module.default, () => fail("Puppeteer is not installed: run npm install puppeteer-core in this folder."), ); await local("/profiles/active").catch(() => fail(`The Octo client is not running, or its local port is not ${LOCAL_PORT}: set LOCAL_PORT. Nothing was done.`), ); if (OS === "android") await loadAndroidModels(); const list = SAVE_PROXIES && proxies.length ? await cloud("GET", "/proxies") : { ok: true }; if (!list.ok) fail(`Could not read the saved proxies: HTTP ${list.status}. Nothing was done.`); const saved = Array.isArray(list.data?.data) ? list.data.data : []; const jobs = [ ...proxies.map((proxy) => ({ proxy, label: proxyLabel(proxy) })), ...vpns.map((vpn) => ({ vpn, label: `VPN ${vpn.file}` })), ].map((job, index) => ({ ...job, number: index + 1 })); const workers = Math.min(PARALLEL, jobs.length); const stamp = localStamp(); console.log( `Checking ${sites.length} site(s) through ${proxies.length} proxy(ies) and ${vpns.length} VPN config(s), ` + `one ${OS_NAMES[OS]} profile each, ${HEADLESS ? "without a window" : "in a window"}, ${workers} at a time.\n`, ); const results = await runAll(jobs, workers, (job) => checkConnection(job, { sites, puppeteer, saved, stamp })); const rows = results.flatMap((result) => result.rows); console.log(""); printTable(sites, results); console.log(`\nReport: ${writeXlsx(results, sites.length, stamp)}`); if (rows.some((entry) => entry.screenshot)) console.log(`Screenshots: ${join(HERE, `screens_${stamp}`)}`); const left = limits ? ` Left: ${limits.minute}${limits.minuteLimit ? ` of ${limits.minuteLimit}` : ""} this minute, ` + `${limits.hour}${limits.hourLimit ? ` of ${limits.hourLimit}` : ""} this hour.` : ""; console.log(`${spent} request(s) counted by Octo's rate limits.${left}`); } main().catch((error) => fail(`Stopped: ${firstLine(error.message || error)}`));
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import { crc32 } from "node:zlib"; const API_TOKEN = ""; // paste your Octo API token between the quotes const LOCAL_PORT = 58888; // port of the local API of the Octo client: Octo client, Settings, Additional const OS = "win"; // OS of the profiles: win, mac or android const HEADLESS = false; // true: profiles run without a window; false: with a window const PARALLEL = 5; // connections checked at the same time, from 1 to 10 const PROXIES = [ // one proxy per line, for example "socks5://login:password@proxy.example.com:10000", ]; const PROXY_FILE = "proxies.txt"; // a file next to the script with one proxy per line, read together with PROXIES const DEFAULT_TYPE = "socks5"; // type for proxy lines without one: http, https, socks5 or ssh const SAVE_PROXIES = true; // true: new proxies are saved to Octo's proxy list; false: a proxy lives only in its profile const VPN_FOLDER = "config"; // folder with WireGuard configs: one VPN profile per file const VPN_PROTOCOL = "wireguard"; // protocol of the configs, as the Octo API names it const VPN_SYN_MODE = "profile_based"; // syn_mode of the VPN, as the Octo API names it const SITES_FILE = "sites.txt"; // sites to check: one per line, # starts a comment const KEEP_PROFILES = true; // false: every profile goes to the trash after its check const SCREENSHOTS = true; // true: save a screenshot of every page that did not open const PAGE_TIMEOUT = 45; // seconds a site gets to answer const CHECK_WAIT = 15; // seconds a "checking your browser" page gets to clear by itself const EMPTY_WAIT = 10; // seconds a blank page gets to show something const HERE = dirname(fileURLToPath(import.meta.url)); const CLOUD = "https://app.octobrowser.net/api/v2/automation"; const LOCAL = `http://localhost:${LOCAL_PORT}/api`; const OS_NAMES = { win: "Windows", mac: "macOS", android: "Android" }; const PROXY_TYPES = ["http", "https", "socks5", "ssh"]; const SHORT_PAGE = 2500; const PAGE_LIMITS = { text: 200000, html: 400000, title: 2000 }; const RETRY_TIMEOUT = 20; const PROXY_FAILURES = 3; const BROWSER_TIMEOUT = 30; const RETRY = new Set(["timeout", "connection_reset", "dns_error", "proxy_refused", "unreachable"]); const sleep = (ms) => new Promise((done) => setTimeout(done, ms)); const anyOf = (phrases) => new RegExp(phrases.join("|")); const secrets = new Set(); const hide = (value) => String(value || "").length >= 4 && secrets.add(String(value)); const printable = (text) => String(text).replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]+/g, " "); const redact = (text) => [...secrets] .sort((a, b) => b.length - a.length) .reduce((clean, secret) => clean.split(secret).join("***"), printable(text)) .replace(/\/\/[^\s/@]+@/g, "//***@"); const firstLine = (text) => redact(String(text).split("\n")[0]).slice(0, 200); const fileName = (text) => String(text).replace(/[^\w.-]+/g, "_"); const localStamp = () => new Date(Date.now() - new Date().getTimezoneOffset() * 60000).toISOString().slice(0, 19).replace(/[:T]/g, "-"); const readText = (file) => readFileSync(file, "utf8").replace(/^\uFEFF/, ""); const fail = (message) => { console.error(message); process.exit(1); }; const GEO = anyOf([ "(not|isn.t|aren.t) (currently |yet )?(available|accessible|offered|permitted|allowed|supported) (in|from|for) your (country|region|location|area|territory|jurisdiction)", "(unavailable|blocked|restricted|prohibited|banned|not supported) (in|from|for) your (country|region|location|area|territory|jurisdiction)", "not available in this (country|region)", "access from your (country|region|location) (is|has been) (blocked|restricted|denied|disabled)", "(from|in) a restricted (country|territory|jurisdiction|region|location)", "your (country|region|location|territory) is (restricted|not supported|blocked|not allowed)", "(do|does) not accept (players|customers|users|visitors|residents) from", "(accessing|visiting|located|you are|you.re|you appear)[^.]{0,60}outside (of )?(the )?(uk|u[.]k[.]?|united kingdom|us|u[.]s[.]?|usa|united states|eu)([ .,!]|$)", "country (that |where )?you are (located in|in|accessing from|visiting from)[^.]{0,30}not (supported|allowed|available)", "(do not|don.t|cannot|can.t) allow access (in|from) your (current )?(country|region|location)", "(unavailable|not available|cannot be accessed|can.t be accessed)[^.]{0,120}european (economic area|union)", "unavailable (due to|for) legal reasons", "configured to block access from your country", "недоступ[а-яё]* (в|на территории|для) ваш[а-яё]* (стран|регион)", "nicht in (deinem|ihrem) land", "pas disponible dans votre (pays|région)", "no está disponible en (tu|su) (país|región)", "não está disponível (no|em) seu país", ]); const PROXY_SEEN = anyOf([ "(vpn|proxy|proxies|anonymizer|unblocker)[^.]{0,60}(detected|not (allowed|permitted|supported))", "(appear|seem)s? to be using (a |an )?(vpn|proxy|unblocker|anonymizer)", "(detected|blocked) (a |an |your )?(vpn|proxy|anonymous proxy)", "(disable|turn off|switch off) (your |the |any )?(vpn|proxy)", ]); const CHECKS = anyOf([ "checking (your browser|if the site connection is secure)", "verif(y|ying) (that )?you are (a )?human", "verify (that )?you are not a (robot|bot)", "(prove|confirm) (that )?you are (a )?human", "are you (a )?(human|robot)", "(complete|pass|performing) (a |the )?(security check|captcha)", "security checkpoint", "enable javascript and cookies to continue", "press (&|and) hold", "unusual (traffic|activity)", "suspicious (activity|traffic)", "automated (access|requests|queries|traffic)", "подтвердите, что вы не робот", "проверка браузера", ]); const REFUSALS = anyOf([ "access (to (this|the) (site|page|website|resource|service) )?(is |has been |was )?(denied|forbidden|blocked|restricted)", "you (have been|are|were) (blocked|banned)", "your (ip|ip address|request|access|connection) (has been|was|is) (temporarily )?(blocked|banned|denied|blacklisted|rejected|limited)", "request (blocked|rejected|denied)", "blocked (by|due to) [^.]{0,40}(security|firewall|policy|administrator|rules)", "403 forbidden", "error 403", "you (don.t|do not) have permission to (access|view)", "not authori[sz]ed to (access|view)", "доступ (к (сайту|ресурсу|странице) )?(запрещ|ограничен|заблокирован|закрыт)", "ваш ip[^.]{0,30}(заблокирован|забанен)", ]); const CLOUDFLARE_ERRORS = { 1005: "the network of this IP is banned", 1006: "this IP is banned", 1007: "this IP is banned", 1008: "this IP is banned", 1010: "the browser signature is banned", 1012: "access denied", 1020: "access denied by a firewall rule", }; function guardOf(header, html) { const server = header("server"); if (server.includes("cloudflare") || header("cf-ray")) return "Cloudflare "; if (server.includes("akamai")) return "Akamai "; if (server.includes("ddos-guard") || html.includes("ddos-guard")) return "DDoS-Guard "; return ""; } function cloudflareError(guard, html, short, words) { const onCloudflare = guard === "Cloudflare " || html.includes("cloudflare"); if (!short || !onCloudflare) return ""; return (words.match(/error(?: code)?:? ?(1\d{3})(?!\d)/) || [])[1] || ""; } function view(look) { const text = String(look.text || ""); const title = String(look.title || "").toLowerCase(); const heading = String(look.heading || "").toLowerCase(); const html = String(look.html || "").toLowerCase(); const header = (name) => String(look.headers?.[name] ?? "").toLowerCase(); const short = text.trim().length < SHORT_PAGE; const words = `${title} | ${heading} | ${text.toLowerCase()}`; const guard = guardOf(header, html); return { status: Number(look.status) || 0, url: String(look.url || "").toLowerCase(), html, title, top: `${title} | ${heading}`, words, short, empty: !text.trim(), refusal: short || Number(look.status) >= 400, header, guard, cloudflare: cloudflareError(guard, html, short, words), }; } const said = (page, phrases) => (page.top.match(phrases) || (page.short && page.words.match(phrases)) || [""])[0]; const quoted = (phrase) => (phrase ? `, the page says: "${phrase}"` : ""); const RULES = [ { verdict: "challenge", detail: "Cloudflare challenge", when: (page) => page.header("cf-mitigated").includes("challenge"), }, { verdict: "blocked", detail: (page, state) => `Cloudflare refused (cf-mitigated: ${state})`, when: (page) => page.header("cf-mitigated"), }, { verdict: "blocked", detail: "AWS WAF refused", when: (page) => page.header("x-amzn-waf-action") === "block", }, { verdict: "challenge", detail: (page, action) => `AWS WAF ${action}`, when: (page) => page.header("x-amzn-waf-action"), }, { verdict: "blocked", detail: "Sucuri firewall refused", when: (page) => page.header("x-sucuri-block") || (page.refusal && page.words.includes("sucuri website firewall")), }, { verdict: "challenge", detail: "Kasada check", when: (page) => (page.status >= 400 && (page.header("x-kpsdk-ct") || page.header("x-kpsdk-cd"))) || (page.short && page.html.includes("kpsdk")), }, { verdict: "geo_blocked", detail: "Cloudflare 1009: the site bans the country of this IP", when: (page) => page.cloudflare === "1009" || (page.refusal && page.words.includes("banned the country or region")), }, { verdict: "geo_blocked", detail: "HTTP 451: unavailable for legal reasons in this country", when: (page) => page.status === 451, }, { verdict: "geo_blocked", detail: (page, phrase) => `the page says: "${phrase}"`, when: (page) => said(page, GEO), }, { verdict: "rate_limited", detail: "Cloudflare 1015: too many requests from this IP", when: (page) => page.cloudflare === "1015", }, { verdict: "blocked", detail: (page, meaning) => `Cloudflare ${page.cloudflare}: ${meaning}`, when: (page) => CLOUDFLARE_ERRORS[page.cloudflare], }, { verdict: "blocked", detail: "Cloudflare: 'you have been blocked'", when: (page) => page.short && /sorry, you have been blocked|attention required! \| cloudflare/.test(page.words), }, { verdict: "challenge", detail: "Cloudflare 'Just a moment' check", when: (page) => page.refusal && (page.title.includes("just a moment") || page.html.includes("cf_chl_opt")), }, { verdict: "challenge", detail: "Cloudflare Turnstile check", when: (page) => page.short && page.html.includes("cf-turnstile"), }, { verdict: "blocked", detail: "Akamai: Access Denied", when: (page) => page.refusal && (page.html.includes("errors.edgesuite.net") || page.html.includes("reference #") || /reference #\d+\.[0-9a-f]{6,}/.test(page.words)), }, { verdict: "challenge", detail: "Akamai check", when: (page) => page.short && (page.html.includes("_sec/cp_challenge") || page.html.includes("sec-if-cpt")), }, { verdict: "blocked", detail: "DataDome refused", when: (page) => page.refusal && page.html.includes("captcha-delivery.com") && /temporarily restricted|you have been blocked|access (is |was )?(denied|blocked)/.test(page.words), }, { verdict: "challenge", detail: "DataDome captcha", when: (page) => page.refusal && page.html.includes("captcha-delivery.com"), }, { verdict: "challenge", detail: "PerimeterX (HUMAN) 'Press & Hold'", when: (page) => (page.refusal && page.html.includes("px-captcha")) || page.title.includes("access to this page has been denied") || (page.short && page.status >= 400 && /_pxappid|px-cloud\.net|px-cdn\.net/.test(page.html)), }, { verdict: "blocked", detail: "Imperva (Incapsula) refused", when: (page) => page.refusal && /incapsula incident id|request unsuccessful\. incapsula|this request was blocked by (our|the) security service/.test( page.words, ), }, { verdict: "challenge", detail: "Imperva check", when: (page) => (page.short && page.words.includes("pardon our interruption")) || (page.empty && page.html.includes("_incapsula_resource")), }, { verdict: "blocked", detail: "F5 BIG-IP refused", when: (page) => page.refusal && page.words.includes("the requested url was rejected"), }, { verdict: "blocked", detail: "AWS CloudFront refused", when: (page) => page.status === 403 && page.short && /request blocked|the request could not be satisfied/.test(page.words), }, { verdict: "challenge", detail: "AWS WAF check", when: (page) => page.short && /token\.awswaf\.com|awswafintegration/.test(page.html), }, { verdict: "challenge", detail: "Radware check", when: (page) => page.url.includes("perfdrive.com") || (page.short && page.html.includes("perfdrive.com")), }, { verdict: "challenge", detail: "Vercel security checkpoint", when: (page) => page.title.includes("vercel security checkpoint"), }, { verdict: "challenge", detail: "SiteGround captcha", when: (page) => page.url.includes("/.well-known/sgcaptcha"), }, { verdict: "blocked", detail: "Wordfence refused", when: (page) => page.short && /your access to this site has been limited|generated by wordfence/.test(page.words), }, { verdict: "blocked", detail: "the site blocked the request by its network policy", when: (page) => page.refusal && page.words.includes("blocked due to a network policy"), }, { verdict: "challenge", detail: "Google 'unusual traffic' check", when: (page) => (page.url.includes("google.") && page.url.includes("/sorry/")) || page.words.includes("our systems have detected unusual traffic"), }, { verdict: "challenge", detail: "Amazon captcha", when: (page) => page.refusal && /enter the characters you see below|to discuss automated access to amazon data/.test(page.words), }, { verdict: "challenge", detail: "captcha page", when: (page) => page.short && /recaptcha|hcaptcha|h-captcha|geetest|funcaptcha|arkoselabs/.test(page.html) && /captcha|robot|human|verify|security/.test(page.words), }, { verdict: "blocked", detail: (page, phrase) => `the site sees a proxy or VPN: "${phrase}"`, when: (page) => said(page, PROXY_SEEN), }, { verdict: "challenge", detail: (page, phrase) => `${page.guard}check page: "${phrase}"`, when: (page) => said(page, CHECKS), }, { verdict: "proxy_error", detail: "HTTP 407: the proxy wants another login or password", when: (page) => page.status === 407, }, { verdict: "rate_limited", detail: "HTTP 429: too many requests from this IP", when: (page) => page.status === 429, }, { verdict: "blocked", detail: (page) => `${page.guard}HTTP ${page.status}${quoted(said(page, REFUSALS))}`, when: (page) => [401, 403, 406].includes(page.status), }, { verdict: "blocked", detail: (page, phrase) => `the page says: "${phrase}"`, when: (page) => said(page, REFUSALS), }, { verdict: "server_error", detail: (page) => `HTTP ${page.status}: Cloudflare could not reach the site's own server`, when: (page) => page.status >= 520 && page.status <= 527, }, { verdict: "server_error", detail: (page) => `HTTP ${page.status}: the site itself fails`, when: (page) => page.status >= 500, }, { verdict: "http_error", detail: (page) => `HTTP ${page.status}`, when: (page) => page.status >= 400, }, ]; export function classify(look) { const page = view(look); for (const rule of RULES) { const match = rule.when(page); if (match) { return { verdict: rule.verdict, detail: typeof rule.detail === "function" ? rule.detail(page, match) : rule.detail, }; } } return { verdict: "ok", detail: `HTTP ${page.status || "?"}` }; } const NETWORK_ERRORS = [ { verdict: "proxy_error", codes: /ERR_SOCKS5_AUTH|ERR_SOCKS_AUTH|ERR_PROXY_AUTH_REQUESTED/, detail: "the proxy rejected its login or password: it may have expired or run out of traffic", }, { verdict: "proxy_error", codes: /ERR_PROXY_CONNECTION_FAILED|ERR_PROXY_AUTH|ERR_NO_SUPPORTED_PROXIES|ERR_PROXY_CERTIFICATE|ERR_MANDATORY_PROXY/, detail: "the proxy itself does not work", }, { verdict: "proxy_refused", codes: /ERR_TUNNEL_CONNECTION_FAILED|ERR_SOCKS_CONNECTION/, detail: "the proxy did not open a connection to this site, its provider may block the site", }, { verdict: "timeout", codes: /ERR_TIMED_OUT|ERR_CONNECTION_TIMED_OUT/, detail: "the site did not answer in time", }, { verdict: "connection_reset", codes: /ERR_CONNECTION_RESET|ERR_CONNECTION_CLOSED|ERR_CONNECTION_ABORTED|ERR_EMPTY_RESPONSE|ERR_SOCKET_NOT_CONNECTED/, detail: "the connection was cut before an answer came", }, { verdict: "connection_reset", codes: /ERR_HTTP2_PROTOCOL_ERROR|ERR_QUIC_PROTOCOL_ERROR/, detail: "the site cut the connection, the way some protection services refuse a visitor", }, { verdict: "connection_refused", codes: /ERR_CONNECTION_REFUSED/, detail: "the site refused the connection", }, { verdict: "dns_error", codes: /ERR_NAME_NOT_RESOLVED|ERR_NAME_RESOLUTION_FAILED|ERR_DNS/, detail: "the address of the site was not found", }, { verdict: "ssl_error", codes: /ERR_CERT_COMMON_NAME_INVALID/, detail: "the site's certificate is issued for another address", }, { verdict: "ssl_error", codes: /ERR_CERT_DATE_INVALID/, detail: "the site's certificate has expired or is not valid yet", }, { verdict: "ssl_error", codes: /ERR_SSL|ERR_CERT|ERR_BAD_SSL|ERR_TLS/, detail: "the secure connection failed, something on the way may replace the site's certificate", }, { verdict: "redirect_loop", codes: /ERR_TOO_MANY_REDIRECTS/, detail: "the site redirects in a circle", }, { verdict: "blocked", codes: /ERR_BLOCKED_BY/, detail: "the request was blocked", }, ]; export function networkError(message, timeout = PAGE_TIMEOUT) { const code = (String(message).match(/(?:net::)?\b(ERR_[A-Z0-9_]+)/) || [])[1]; if (!code) { return /timeout/i.test(message) ? { verdict: "timeout", detail: `no answer in ${timeout} s` } : { verdict: "unreachable", detail: firstLine(message) }; } const known = NETWORK_ERRORS.find((entry) => entry.codes.test(code)); return known ? { verdict: known.verdict, detail: `${code}: ${known.detail}` } : { verdict: "unreachable", detail: code }; } let token = ""; let spent = 0; let limits = null; const running = new Set(); const answerOf = async (response) => ({ status: response.status, ok: response.ok, data: await response.json().catch(() => ({})), }); async function cloud(method, path, body) { for (let attempt = 0; ; attempt++) { spent += 1; const response = await fetch(CLOUD + path, { method, headers: { "X-Octo-Api-Token": token, "Content-Type": "application/json" }, body: body ? JSON.stringify(body) : undefined, signal: AbortSignal.timeout(120000), }); if (response.status === 429 && attempt < 5) { const wait = Number(response.headers.get("retry-after")) || 5; if (wait > 60) throw new Error(`Octo's rate limit is used up for ${wait} s, run the script again later`); await sleep(wait * 1000); continue; } const minute = response.headers.get("x-ratelimit-remaining"); const hour = response.headers.get("x-ratelimit-remaining-hour"); if (minute !== null && hour !== null) { limits = { minute, hour, minuteLimit: response.headers.get("x-ratelimit-limit"), hourLimit: response.headers.get("x-ratelimit-limit-hour"), }; if (Number(minute) < 5) await sleep(5000); } return answerOf(response); } } async function local(path, body) { spent += path === "/profiles/active" ? 0 : 1; const response = await fetch(LOCAL + path, { method: body ? "POST" : "GET", headers: { "Content-Type": "application/json" }, body: body ? JSON.stringify(body) : undefined, signal: AbortSignal.timeout(180000), }); return answerOf(response); } async function stopProfile(uuid) { await local("/profiles/stop", { uuid }).catch(() => {}); running.delete(uuid); } process.on("SIGINT", async () => { console.log(`\nStopping ${running.size} running profile(s)...`); await Promise.all([...running].map(stopProfile)); process.exit(130); }); const splitOutsideBrackets = (text) => text.split(/:(?![^[]*\])/); const isPort = (text) => /^\d{1,5}$/.test(text || "") && Number(text) >= 1 && Number(text) <= 65535; const isAddress = (text) => /^\[.+\]$/.test(text) || text.includes(".") || text === "localhost"; export function parseProxy(line, defaultType = DEFAULT_TYPE) { const scheme = line.match(/^([a-z0-9]+):\/\//i); const type = scheme ? scheme[1].toLowerCase() : defaultType; const rest = scheme ? line.slice(scheme[0].length) : line; let host, port, login, secret; if (rest.includes("@")) { const at = rest.lastIndexOf("@"); [login, ...secret] = rest.slice(0, at).split(":"); [host, port] = splitOutsideBrackets(rest.slice(at + 1)); } else { const parts = splitOutsideBrackets(rest); const addressFirst = parts.length <= 2 || (isPort(parts[1]) && (isAddress(parts[0]) || !isPort(parts.at(-1)))); if (addressFirst) { [host, port, login, ...secret] = parts; } else { [login, ...secret] = parts.slice(0, -2); [host, port] = parts.slice(-2); } } const password = secret.join(":"); if (!PROXY_TYPES.includes(type) || !host || !isPort(port)) return null; const address = host.replace(/^\[(.+)\]$/, "$1"); return { type, host: address, port: Number(port), ...(login ? { login } : {}), ...(password ? { password } : {}) }; } function proxyLabel(proxy) { const host = proxy.host.includes(":") ? `[${proxy.host}]` : proxy.host; return `${proxy.type}://${proxy.login ? `…${proxy.login.slice(-10)}@` : ""}${host}:${proxy.port}`; } async function proxyUuid(job, saved) { const { proxy } = job; const same = (other) => proxy.type === String(other.type).toLowerCase() && proxy.host === other.host && String(proxy.port) === String(other.port) && (proxy.login || "") === (other.login || "") && (proxy.password || "") === (other.password || ""); const known = saved.find(same); if (known) return known.uuid; const added = await cloud("POST", "/proxies", { ...proxy, title: `proxy ${proxy.host}:${proxy.port} #${job.number}`, }); if (!added.data?.data?.uuid) { throw new Error(`could not add the proxy to Octo (HTTP ${added.status} ${added.data?.code || ""})`); } return added.data.data.uuid; } export function checkVpnConfig(text) { const keys = { interface: new Set(), peer: new Set() }; let section = ""; let endpoint = ""; for (const line of text.split("\n")) { const head = line.match(/^\s*\[(\w+)\]/); const pair = line.match(/^\s*(\w+)\s*=\s*(\S+)/); if (head) section = head[1].toLowerCase(); if (!pair || !keys[section]) continue; keys[section].add(pair[1].toLowerCase()); if (section === "peer" && pair[1].toLowerCase() === "endpoint") endpoint = pair[2]; } const required = [ ["Interface", "PrivateKey"], ["Interface", "Address"], ["Peer", "PublicKey"], ["Peer", "Endpoint"], ]; const missing = required .filter(([part, key]) => !keys[part.toLowerCase()].has(key.toLowerCase())) .map(([part, key]) => `${key} in [${part}]`); if (missing.length) return `no ${missing.join(", ")}`; if (!/^(\[[0-9a-f:.]+\]|[a-z0-9.-]+):\d{1,5}$/i.test(endpoint)) { return `Endpoint must be address:port, without http://, not "${endpoint}"`; } return ""; } export function findVpns(folder) { const vpns = []; const skipped = []; if (!existsSync(folder) || !statSync(folder).isDirectory()) return { vpns, skipped }; const files = readdirSync(folder) .filter((file) => statSync(join(folder, file)).isFile()) .sort((a, b) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" })); for (const file of files) { const raw = readFileSync(join(folder, file)); const text = raw .toString("utf8") .replace(/^\uFEFF/, "") .replace(/\r\n/g, "\n"); if (!/^\s*\[Interface\]/im.test(text) || !/^\s*\[Peer\]/im.test(text)) { skipped.push(file); continue; } const problem = checkVpnConfig(text); if (problem) throw new Error(`${file}: ${problem}`); vpns.push({ file, conf: raw.toString("base64") }); } return { vpns, skipped }; } export function readSites(text) { const sites = []; for (const [index, raw] of text.split(/\r?\n/).entries()) { const line = raw.replace(/\s+#.*$/, "").trim(); if (!line || line.startsWith("#") || /^\[.*\]$/.test(line)) continue; let url; try { url = new URL(/^[a-z]+:\/\//i.test(line) ? line : `https://${line}`); } catch { url = null; } if (!url || !["http:", "https:"].includes(url.protocol) || !url.hostname.includes(".")) { throw new Error(`line ${index + 1}: "${line}" is not a site address`); } const site = url.href.replace(/\/$/, ""); if (!sites.includes(site)) sites.push(site); } return sites; } const REGION_NAMES = new Intl.DisplayNames(["en"], { type: "region" }); const COUNTRY_CODES = new Map(); for (let first = 65; first <= 90; first++) { for (let second = 65; second <= 90; second++) { const code = String.fromCharCode(first, second); try { const name = REGION_NAMES.of(code); if (new Intl.Locale(`und-${code}`).region === code && name && name !== code) { COUNTRY_CODES.set(name.toLowerCase(), code); } } catch { continue; } } } async function countryOf(exit) { const code = String(exit.countryCode || exit.country_code || ""); if (/^[A-Za-z]{2}$/.test(code)) return code.toUpperCase(); const byName = COUNTRY_CODES.get(String(exit.country || exit.countryName || "").toLowerCase()); if (byName) return byName; if (!exit.ip) return "XX"; try { const url = `https://get.geojs.io/v1/ip/country/${encodeURIComponent(exit.ip)}.json`; const found = (await (await fetch(url, { signal: AbortSignal.timeout(20000) })).json()).country; return /^[A-Z]{2}$/.test(found || "") ? found : "XX"; } catch { return "XX"; } } let androidModels = []; async function loadAndroidModels() { const answer = await cloud("GET", "/fingerprint/device_models?device_type=phone"); const models = Array.isArray(answer.data?.data) ? answer.data.data : []; androidModels = models.filter((model) => model?.value && model.os_versions?.length); if (!androidModels.length) fail(`Could not read the Android phone models: HTTP ${answer.status}. Nothing was done.`); } function fingerprint() { if (OS !== "android") return { os: OS }; const model = androidModels[Math.floor(Math.random() * androidModels.length)]; const version = model.os_versions[Math.floor(Math.random() * model.os_versions.length)]; return { os: "android", os_arch: "arm", device_type: "phone", device_model: model.value, os_version: String(version), }; } export function hostOf(url) { try { return new URL(url).hostname.replace(/^www\./, ""); } catch { return String(url); } } export function siteName(url) { try { const path = new URL(url).pathname.replace(/\/$/, ""); return hostOf(url) + path; } catch { return String(url); } } export function brandOf(url) { const parts = hostOf(url).split("."); const secondLevel = ["co", "com", "org", "net", "gov", "ac", "edu", "ltd", "plc"]; const deep = parts.length > 2 && secondLevel.includes(parts[parts.length - 2]); return parts[parts.length - (deep ? 3 : 2)] || parts[0]; } const shows = (look) => String(look.text || "").trim().length >= 20 || /<(img|canvas|svg|video)\b/i.test(String(look.html || "")); async function read(page, answer) { const nothing = { ...answer, title: "", heading: "", text: "", html: "" }; for (let attempt = 0; attempt < 3; attempt++) { try { const seen = await page.evaluate( (limits) => ({ text: (document.body?.innerText || "").slice(0, limits.text), heading: (document.querySelector("h1")?.innerText || "").slice(0, limits.title), title: document.title.slice(0, limits.title), html: (document.documentElement?.outerHTML || "").slice(0, limits.html), }), PAGE_LIMITS, ); if (seen.text.trim().length < SHORT_PAGE) { const frames = page.frames().slice(1, 6); const inside = (frame) => frame.evaluate(() => document.body?.innerText || "").catch(() => ""); const texts = await Promise.all( frames.map((frame) => Promise.race([inside(frame), sleep(3000).then(() => "")])), ); seen.text = [seen.text, ...texts].join("\n").slice(0, PAGE_LIMITS.text); } return { ...answer, ...seen, url: page.url() }; } catch (error) { if (/timed out/i.test(error.message)) return { ...nothing, url: page.url(), unresponsive: true }; await sleep(1000); } } return { ...nothing, url: page.url() }; } const RESTRICTION_PAGE = /(^|[./_-])(restricted|restriction|geo-?block(ed)?|geo-?restrict(ed|ion)?|not-?available|unavailable|access-?denied|blocked|forbidden|country-?(not-?)?(allowed|supported|restricted))([./?#_-]|$)/i; export function restrictionPage(asked, reached) { try { const from = new URL(asked); const to = new URL(reached); if (from.hostname === to.hostname && from.pathname === to.pathname) return ""; const where = `${to.hostname}${to.pathname}`; return RESTRICTION_PAGE.test(where) && !RESTRICTION_PAGE.test(`${from.hostname}${from.pathname}`) ? where : ""; } catch { return ""; } } function moved(asked, look, found) { const to = hostOf(look.url); if (!look.url || to === hostOf(asked)) return found; if (brandOf(look.url) === brandOf(asked)) return { ...found, detail: `${found.detail}, opened as ${to}` }; const page = view(look); const lead = `${page.top} | ${String(look.text || "") .toLowerCase() .slice(0, 1500)}`; const phrase = [GEO, PROXY_SEEN, REFUSALS, CHECKS].map((list) => (lead.match(list) || [""])[0]).find(Boolean); if (!page.short && !phrase) { return { ...found, detail: `${found.detail}, but opened another site: ${to} (check that it is the one you need)` }; } return { verdict: "redirected", detail: `sent to another site, ${to}` + (phrase ? `, which says: "${phrase}"` : "") }; } function watchAnswer(page) { const answer = { status: 0, headers: {} }; page.on("response", (response) => { try { if (response.request().isNavigationRequest() && response.frame() === page.mainFrame()) { Object.assign(answer, { status: response.status(), headers: response.headers() }); } } catch { return; } }); return answer; } async function waitFor(page, answer, look, seconds, pause, settled) { for (const until = Date.now() + seconds * 1000; !settled(look) && Date.now() < until;) { await sleep(pause); look = await read(page, answer); } return look; } async function judge(page, answer, url, slow, timeout) { const stuck = (seen) => seen.unresponsive && { verdict: "unresponsive", detail: `the page stopped responding (HTTP ${seen.status})` }; let look = await read(page, answer); if (look.url.startsWith("chrome-error://") && look.status < 400) return networkError(look.text, timeout); let found = classify(look); if (found.verdict === "challenge") { const check = found.detail; look = await waitFor(page, answer, look, CHECK_WAIT, 2500, (seen) => classify(seen).verdict !== "challenge"); found = classify(look); if (found.verdict === "ok") found.detail += `, passed a check by itself (${check})`; } if (found.verdict === "ok" && !shows(look) && !stuck(look)) { look = await waitFor(page, answer, look, EMPTY_WAIT, 2000, (seen) => shows(seen) || seen.unresponsive); found = classify(look); if (found.verdict === "ok" && !shows(look) && !stuck(look)) { return slow ? { verdict: "timeout", detail: `the site answered (HTTP ${look.status}) but the page did not load in ${timeout} s`, } : { verdict: "empty", detail: `the page stayed empty for ${EMPTY_WAIT} s` }; } } if (stuck(look)) return stuck(look); const restriction = found.verdict === "ok" && restrictionPage(url, look.url); if (restriction) return { verdict: "geo_blocked", detail: `sent to a restriction page, ${restriction.replace(/\/$/, "")}` }; if (found.verdict === "ok") found = moved(url, look, found); if (found.verdict === "ok" && slow) found.detail += ", loaded slowly"; return found; } async function inspect(browser, url, shot, timeout) { const page = await browser.newPage(); const answer = watchAnswer(page); page.on("dialog", (dialog) => dialog.dismiss().catch(() => {})); try { let slow = false; try { await page.goto(url, { waitUntil: "domcontentloaded", timeout: timeout * 1000 }); } catch (error) { const failed = /net::ERR_/.test(error.message) && !error.message.includes("ERR_ABORTED"); if (!answer.status || failed) return networkError(error.message, timeout); slow = /timeout/i.test(error.message); } await page.waitForNetworkIdle({ idleTime: 800, timeout: 8000 }).catch(() => {}); const found = await judge(page, answer, url, slow, timeout); if (found.verdict !== "ok" && found.verdict !== "unresponsive" && shot) { found.screenshot = await page.screenshot({ path: shot }).then( () => shot, () => "", ); } return found; } finally { await page.close().catch(() => {}); } } export async function checkSite(browser, url, shot = "") { let found = await inspect(browser, url, shot, PAGE_TIMEOUT); if (RETRY.has(found.verdict)) { const first = found.verdict; await sleep(3000); found = await inspect(browser, url, shot, Math.min(PAGE_TIMEOUT, RETRY_TIMEOUT)); found.detail += found.verdict === first ? " (on the second try too)" : ` (the first try: ${first})`; } return { result: found.verdict === "ok" ? "AVAILABLE" : "UNAVAILABLE", reason: `${found.verdict}: ${printable(found.detail)}`, screenshot: found.screenshot || "", }; } function checkSettings() { const seconds = [PAGE_TIMEOUT, CHECK_WAIT, EMPTY_WAIT]; const problems = [ [!OS_NAMES[OS], `OS is win, mac or android, not "${OS}".`], [typeof HEADLESS !== "boolean", "HEADLESS is true or false, without quotes."], [typeof KEEP_PROFILES !== "boolean", "KEEP_PROFILES is true or false, without quotes."], [typeof SCREENSHOTS !== "boolean", "SCREENSHOTS is true or false, without quotes."], [!Number.isInteger(PARALLEL) || PARALLEL < 1 || PARALLEL > 10, "PARALLEL is a whole number from 1 to 10."], [!PROXY_TYPES.includes(DEFAULT_TYPE), `DEFAULT_TYPE is one of ${PROXY_TYPES.join(", ")}.`], [seconds.some((value) => !(value > 0)), "PAGE_TIMEOUT, CHECK_WAIT and EMPTY_WAIT are seconds above zero."], [!Number.isInteger(LOCAL_PORT) || LOCAL_PORT < 1 || LOCAL_PORT > 65535, "LOCAL_PORT is a port number, 1 to 65535."], [typeof SAVE_PROXIES !== "boolean", "SAVE_PROXIES is true or false, without quotes."], ]; const problem = problems.find(([wrong]) => wrong); if (problem) fail(`${problem[1]} Nothing was done.`); } function readToken() { const found = String(API_TOKEN).trim(); if (!found) fail("No API token: paste it into API_TOKEN at the top of the script. Nothing was done."); return found; } function readProxies() { const file = join(HERE, PROXY_FILE); const fromFile = PROXY_FILE && existsSync(file) ? readText(file).split(/\r?\n/) : []; const lines = [...PROXIES, ...fromFile].map((line) => line.trim()).filter((line) => line && !line.startsWith("#")); const proxies = lines.map((line) => parseProxy(line)); const bad = proxies.flatMap((proxy, index) => (proxy ? [] : [index + 1])); if (bad.length) fail(`Proxy line(s) ${bad.join(", ")} not understood. Nothing was done.`); proxies.forEach((proxy) => hide(proxy.password)); return proxies; } function readVpns() { try { const { vpns, skipped } = findVpns(join(HERE, VPN_FOLDER)); if (skipped.length) console.log(`Not VPN configs, skipped in ${VPN_FOLDER}: ${skipped.join(", ")}`); if (vpns.length) console.log(`VPN configs found in ${VPN_FOLDER}: ${vpns.map((vpn) => vpn.file).join(", ")}`); if (vpns.length && !(String(VPN_PROTOCOL).trim() && String(VPN_SYN_MODE).trim())) { fail("VPN_PROTOCOL and VPN_SYN_MODE can't be empty. Nothing was done."); } for (const vpn of vpns) { hide(vpn.conf); const keys = Buffer.from(vpn.conf, "base64") .toString() .matchAll(/^\s*(?:PrivateKey|PresharedKey)\s*=\s*(\S+)/gim); for (const [, key] of keys) hide(key); } return vpns; } catch (error) { return fail(`VPN config ${error.message} (folder ${VPN_FOLDER}). Nothing was done.`); } } function readSitesFile() { const file = join(HERE, SITES_FILE); if (!existsSync(file)) fail(`${SITES_FILE} not found next to the script: put the sites there. Nothing was done.`); try { const sites = readSites(readText(file)); if (!sites.length) fail(`${SITES_FILE} has no sites. Nothing was done.`); return sites; } catch (error) { return fail(`${SITES_FILE}, ${error.message}. Nothing was done.`); } } async function connectionOf(job, saved) { if (job.vpn) return { type: "vpn", vpn_protocol: VPN_PROTOCOL, conf: job.vpn.conf, syn_mode: VPN_SYN_MODE }; return SAVE_PROXIES ? { uuid: await proxyUuid(job, saved) } : job.proxy; } async function createProfile(job, saved) { const connection = await connectionOf(job, saved); const profile = { title: `checking ${job.number}`, fingerprint: fingerprint(), proxy: connection }; const made = await cloud("POST", "/profiles", profile); if (made.data?.data?.uuid) return made.data.data.uuid; const errors = made.data?.errors ? JSON.stringify(made.data.errors).slice(0, 200) : ""; const why = [made.data?.code, made.data?.msg || made.data?.error, errors].filter(Boolean).join(" "); throw new Error(`could not create a profile (HTTP ${made.status} ${why})`); } async function startProfile(uuid) { const start = { uuid, headless: HEADLESS, debug_port: true, flags: ["--disable-backgrounding-occluded-windows"] }; const started = await local("/profiles/start", start).catch((error) => ({ ok: false, data: { error: error.message }, })); const works = Boolean(started.ok && started.data?.ws_endpoint); if (works) running.add(uuid); return { ...started, works }; } function progress(index, total, site, checked) { const count = `${String(index + 1).padStart(String(total).length)}/${total}`; const reason = /^ok: HTTP [\d?]+$/.test(checked.reason) ? "" : checked.reason; return `${count} ${checked.result.padEnd(11)} ${siteName(site).padEnd(30)} ${reason}`.trimEnd(); } async function visitSites(job, started, name, { sites, puppeteer, stamp }, say) { const entries = []; const ip = printable(started.data.connection_data?.ip || ""); const folder = join(HERE, `screens_${stamp}`, fileName(`${job.number}_${name}`)); if (SCREENSHOTS) mkdirSync(folder, { recursive: true }); let browser; let failures = 0; try { browser = await puppeteer.connect({ browserWSEndpoint: started.data.ws_endpoint, defaultViewport: null, protocolTimeout: BROWSER_TIMEOUT * 1000, }); for (const [index, site] of sites.entries()) { const number = String(index + 1).padStart(String(sites.length).length, "0"); const shot = SCREENSHOTS ? join(folder, `${number}_${fileName(siteName(site))}.png`) : ""; const checked = await checkSite(browser, site, shot); entries.push({ site, ...checked, ip }); say(progress(index, sites.length, site, checked)); failures = checked.reason.startsWith("proxy_error:") ? failures + 1 : 0; const rest = sites.slice(index + 1); if (failures === PROXY_FAILURES && rest.length) { const kind = job.vpn ? "VPN" : "proxy"; const reason = `not checked: the ${kind} stopped working after site ${index + 1}`; say(`the ${kind} stopped working: ${PROXY_FAILURES} proxy errors in a row, ${rest.length} site(s) not checked`); entries.push(...rest.map((left) => ({ site: left, result: "SKIPPED", reason, ip }))); break; } } } catch (error) { say(`stopped after ${entries.length} of ${sites.length} site(s): ${firstLine(error.message)}`); } finally { await browser?.disconnect().catch(() => {}); } return entries; } function startFailure(job, started, sites) { const reason = redact(started.data?.code || started.data?.error || `HTTP ${started.status}`); const dead = /proxy/i.test(reason) || [4, 5].includes(started.data?.error_code); const name = `${dead ? "DEAD" : "ERROR"}_${fileName(job.vpn ? job.vpn.file : job.proxy.host)}`; const problem = dead ? `the ${job.vpn ? "VPN" : "proxy"} does not work` : "could not start the profile"; return { name, message: `${job.label} -> ${name}: ${problem} (${reason})`, entries: sites.map((site) => ({ site, result: dead ? "DEAD" : "ERROR", reason })), }; } async function finishProfile(uuid, name, say) { const renamed = await cloud("PATCH", `/profiles/${uuid}`, { title: name }); if (!renamed.ok) say(`could not rename the profile (HTTP ${renamed.status})`); if (!KEEP_PROFILES) await cloud("DELETE", "/profiles", { uuids: [uuid], skip_trash_bin: false }); } async function checkConnection(job, context) { let tag = `#${job.number}`; const say = (text) => console.log(`[${tag}] ${text}`); const uuid = await createProfile(job, context.saved); say(`${job.label}: starting the profile...`); const started = await startProfile(uuid); let name, entries; if (started.works) { const exit = started.data.connection_data || {}; name = `${await countryOf(exit)}_${printable(exit.ip || "no-ip")}`; tag = `#${job.number} ${name}`; say(`${job.label}: started, ${context.sites.length} site(s) to check`); try { entries = await visitSites(job, started, name, context, say); } finally { await stopProfile(uuid); } } else { if (started.ok || started.status === undefined) await stopProfile(uuid); const failure = startFailure(job, started, context.sites); say(failure.message); ({ name, entries } = failure); } await finishProfile(uuid, name, say); const blank = { profile: name, proxy: `#${job.number} ${job.label}`, ip: "", screenshot: "" }; const rows = entries.map((entry) => ({ ...blank, ...entry })); if (rows.some((entry) => entry.result.endsWith("AVAILABLE"))) say(`done: ${summary(rows, context.sites.length)}`); return { name, rows }; } function reasonsOf(rows) { const reasons = new Map(); for (const entry of rows.filter((row) => row.result === "UNAVAILABLE")) { const reason = entry.reason.split(":")[0]; reasons.set(reason, (reasons.get(reason) || 0) + 1); } return [...reasons] .sort((a, b) => b[1] - a[1]) .map(([reason, times]) => `${times} ${reason}`) .join(", "); } function unchecked(rows, expected) { const skipped = rows.filter((entry) => entry.result === "SKIPPED"); const missed = expected - rows.length; return ( (skipped.length ? `, ${skipped.length} not checked: ${skipped[0].reason.replace(/^not checked: /, "")}` : "") + (missed ? `, ${missed} not checked` : "") ); } function summary(rows, expected) { const count = (result) => rows.filter((entry) => entry.result === result).length; if (count("DEAD")) return "does not work"; if (count("ERROR")) return `not checked: ${rows[0].reason}`; const why = reasonsOf(rows); return ( `${count("AVAILABLE")} AVAILABLE, ${count("UNAVAILABLE")} UNAVAILABLE` + (why ? ` (${why})` : "") + unchecked(rows, expected) ); } async function runAll(jobs, limit, work) { const results = new Array(jobs.length); let next = 0; const worker = async () => { while (next < jobs.length) { const index = next++; const job = jobs[index]; const done = await work(job).catch((error) => { console.log(`[#${job.number}] ${job.label}: ${firstLine(error.message)}`); return { name: "", rows: [] }; }); results[index] = { number: job.number, label: job.label, ...done }; } }; await Promise.all(Array.from({ length: limit }, worker)); return results; } function printTable(sites, results) { const columns = results.filter((column) => column.name); const repeated = (name) => columns.filter((column) => column.name === name).length > 1; const titles = columns.map((column) => (repeated(column.name) ? `${column.name} #${column.number}` : column.name)); const width = Math.max(11, ...titles.map((title) => title.length)) + 2; const siteWidth = Math.max(4, ...sites.map((site) => siteName(site).length)) + 2; console.log("Site".padEnd(siteWidth) + titles.map((title) => title.padEnd(width)).join("")); for (const site of sites) { const cells = columns.map((column) => column.rows.find((entry) => entry.site === site)?.result || "-"); console.log(siteName(site).padEnd(siteWidth) + cells.map((cell) => cell.padEnd(width)).join("")); } console.log(""); columns.forEach((column, index) => console.log(`${titles[index]}: ${summary(column.rows, sites.length)}`)); } const REPORT_COLUMNS = ["profile", "proxy", "site", "result", "reason", "ip"]; function zip(files) { const parts = []; const directory = []; let offset = 0; for (const [name, text] of files) { const title = Buffer.from(name); const data = Buffer.from(text); const local = Buffer.alloc(30); local.writeUInt32LE(0x04034b50, 0); local.writeUInt16LE(20, 4); local.writeUInt16LE(0x0800, 6); local.writeUInt16LE(0x21, 12); local.writeUInt32LE(crc32(data), 14); local.writeUInt32LE(data.length, 18); local.writeUInt32LE(data.length, 22); local.writeUInt16LE(title.length, 26); const central = Buffer.alloc(46); central.writeUInt32LE(0x02014b50, 0); central.writeUInt16LE(20, 4); central.writeUInt16LE(20, 6); local.copy(central, 8, 6, 30); central.writeUInt32LE(offset, 42); parts.push(local, title, data); directory.push(central, title); offset += local.length + title.length + data.length; } const index = Buffer.concat(directory); const end = Buffer.alloc(22); end.writeUInt32LE(0x06054b50, 0); end.writeUInt16LE(files.length, 8); end.writeUInt16LE(files.length, 10); end.writeUInt32LE(index.length, 12); end.writeUInt32LE(offset, 16); return Buffer.concat([...parts, index, end]); } const XLSX_ROW_STYLES = { AVAILABLE: 2, UNAVAILABLE: 3 }; const XLSX_OTHER_STYLE = 4; const XLSX_STYLES = '<fonts count="5"><font><sz val="11"/><name val="Calibri"/></font>' + '<font><b/><sz val="11"/><name val="Calibri"/></font>' + '<font><sz val="11"/><color rgb="FF006100"/><name val="Calibri"/></font>' + '<font><sz val="11"/><color rgb="FF9C0006"/><name val="Calibri"/></font>' + '<font><sz val="11"/><color rgb="FF595959"/><name val="Calibri"/></font></fonts>' + '<fills count="5"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill>' + '<fill><patternFill patternType="solid"><fgColor rgb="FFC6EFCE"/></patternFill></fill>' + '<fill><patternFill patternType="solid"><fgColor rgb="FFFFC7CE"/></patternFill></fill>' + '<fill><patternFill patternType="solid"><fgColor rgb="FFE7E6E6"/></patternFill></fill></fills>' + '<borders count="1"><border/></borders>' + '<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>' + '<cellXfs count="5"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>' + '<xf numFmtId="0" fontId="1" fillId="0" borderId="0" xfId="0" applyFont="1"/>' + '<xf numFmtId="0" fontId="2" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1"/>' + '<xf numFmtId="0" fontId="3" fillId="3" borderId="0" xfId="0" applyFont="1" applyFill="1"/>' + '<xf numFmtId="0" fontId="4" fillId="4" borderId="0" xfId="0" applyFont="1" applyFill="1"/></cellXfs>' + '<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>'; const SUMMARY_COLUMNS = ["profile", "proxy", "AVAILABLE", "UNAVAILABLE", "why unavailable", "ip"]; function summaryRows(results, siteCount) { return results.map((result) => { const count = (word) => result.rows.filter((entry) => entry.result === word).length; const dead = count("DEAD") || count("ERROR"); const note = dead ? summary(result.rows, siteCount) : `${reasonsOf(result.rows)}${unchecked(result.rows, siteCount)}`.replace(/^, /, ""); return { values: [ result.name || "not started", `#${result.number} ${result.label}`, dead || !result.rows.length ? "" : count("AVAILABLE"), dead || !result.rows.length ? "" : count("UNAVAILABLE"), !result.rows.length ? "the profile was not created" : note, result.rows[0]?.ip || "", ], dead: dead || !result.rows.length, }; }); } function xlsxSheet(results, siteCount) { const escapes = { "<": "<", ">": ">", "&": "&" }; const text = (value) => printable(value ?? "") .replace(/[\uFFFE\uFFFF]/g, "") .slice(0, 32000) .replace(/[<>&]/g, (sign) => escapes[sign]); const cell = (column, line, value, style) => { const where = `${String.fromCharCode(65 + column)}${line}`; if (typeof value === "number") return `<c r="${where}" s="${style}"><v>${value}</v></c>`; return `<c r="${where}" t="inlineStr" s="${style}"><is><t xml:space="preserve">${text(value)}</t></is></c>`; }; const line = (values, number, styles) => `<row r="${number}">${values .map((value, column) => cell(column, number, value, Array.isArray(styles) ? styles[column] : styles)) .join("")}</row>`; const rows = results.flatMap((result) => result.rows); const lines = []; const add = (values, styles) => lines.push(line(values, lines.length + 1, styles)); add(["TOTAL", `${siteCount} site(s) through ${results.length} connection(s)`], 1); add(SUMMARY_COLUMNS, 1); for (const { values, dead } of summaryRows(results, siteCount)) { add(values, dead ? XLSX_OTHER_STYLE : [0, 0, XLSX_ROW_STYLES.AVAILABLE, XLSX_ROW_STYLES.UNAVAILABLE, 0, 0]); } lines.push(`<row r="${lines.length + 1}"/>`); const header = lines.length + 1; add(REPORT_COLUMNS, 1); for (const entry of rows) { add( REPORT_COLUMNS.map((column) => entry[column]), XLSX_ROW_STYLES[entry.result] || XLSX_OTHER_STYLE, ); } const widths = REPORT_COLUMNS.map((column, i) => Math.min( 90, Math.max( column.length, SUMMARY_COLUMNS[i].length, ...rows.map((entry) => String(entry[column] ?? "").length), ...summaryRows(results, siteCount).map((row) => String(row.values[i] ?? "").length), ) + 2, ), ); const last = `${String.fromCharCode(64 + REPORT_COLUMNS.length)}${lines.length}`; return ( `<cols>${widths.map((width, i) => `<col min="${i + 1}" max="${i + 1}" width="${width}" customWidth="1"/>`).join("")}</cols>` + `<sheetData>${lines.join("")}</sheetData><autoFilter ref="A${header}:${last}"/>` ); } function writeXlsx(results, siteCount, stamp) { const head = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'; const main = "http://schemas.openxmlformats.org/spreadsheetml/2006/main"; const office = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"; const packageRels = "http://schemas.openxmlformats.org/package/2006/relationships"; const type = "application/vnd.openxmlformats-officedocument.spreadsheetml"; const file = join(HERE, `site_access_${stamp}.xlsx`); const files = [ [ "[Content_Types].xml", `${head}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">` + '<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>' + '<Default Extension="xml" ContentType="application/xml"/>' + `<Override PartName="/xl/workbook.xml" ContentType="${type}.sheet.main+xml"/>` + `<Override PartName="/xl/worksheets/sheet1.xml" ContentType="${type}.worksheet+xml"/>` + `<Override PartName="/xl/styles.xml" ContentType="${type}.styles+xml"/></Types>`, ], [ "_rels/.rels", `${head}<Relationships xmlns="${packageRels}">` + `<Relationship Id="rId1" Type="${office}/officeDocument" Target="xl/workbook.xml"/></Relationships>`, ], [ "xl/workbook.xml", `${head}<workbook xmlns="${main}" xmlns:r="${office}">` + '<sheets><sheet name="Report" sheetId="1" r:id="rId1"/></sheets></workbook>', ], [ "xl/_rels/workbook.xml.rels", `${head}<Relationships xmlns="${packageRels}">` + `<Relationship Id="rId1" Type="${office}/worksheet" Target="worksheets/sheet1.xml"/>` + `<Relationship Id="rId2" Type="${office}/styles" Target="styles.xml"/></Relationships>`, ], ["xl/styles.xml", `${head}<styleSheet xmlns="${main}">${XLSX_STYLES}</styleSheet>`], ["xl/worksheets/sheet1.xml", `${head}<worksheet xmlns="${main}">${xlsxSheet(results, siteCount)}</worksheet>`], ]; writeFileSync(file, zip(files)); return file; } async function main() { checkSettings(); token = readToken(); hide(token); const proxies = readProxies(); const vpns = readVpns(); if (!proxies.length && !vpns.length) { fail( `Nothing to check: put proxies into ${PROXY_FILE || "PROXIES"} or WireGuard configs into ${VPN_FOLDER}. Nothing was done.`, ); } const sites = readSitesFile(); const puppeteer = await import("puppeteer-core").then( (module) => module.default, () => fail("Puppeteer is not installed: run npm install puppeteer-core in this folder."), ); await local("/profiles/active").catch(() => fail(`The Octo client is not running, or its local port is not ${LOCAL_PORT}: set LOCAL_PORT. Nothing was done.`), ); if (OS === "android") await loadAndroidModels(); const list = SAVE_PROXIES && proxies.length ? await cloud("GET", "/proxies") : { ok: true }; if (!list.ok) fail(`Could not read the saved proxies: HTTP ${list.status}. Nothing was done.`); const saved = Array.isArray(list.data?.data) ? list.data.data : []; const jobs = [ ...proxies.map((proxy) => ({ proxy, label: proxyLabel(proxy) })), ...vpns.map((vpn) => ({ vpn, label: `VPN ${vpn.file}` })), ].map((job, index) => ({ ...job, number: index + 1 })); const workers = Math.min(PARALLEL, jobs.length); const stamp = localStamp(); console.log( `Checking ${sites.length} site(s) through ${proxies.length} proxy(ies) and ${vpns.length} VPN config(s), ` + `one ${OS_NAMES[OS]} profile each, ${HEADLESS ? "without a window" : "in a window"}, ${workers} at a time.\n`, ); const results = await runAll(jobs, workers, (job) => checkConnection(job, { sites, puppeteer, saved, stamp })); const rows = results.flatMap((result) => result.rows); console.log(""); printTable(sites, results); console.log(`\nReport: ${writeXlsx(results, sites.length, stamp)}`); if (rows.some((entry) => entry.screenshot)) console.log(`Screenshots: ${join(HERE, `screens_${stamp}`)}`); const left = limits ? ` Left: ${limits.minute}${limits.minuteLimit ? ` of ${limits.minuteLimit}` : ""} this minute, ` + `${limits.hour}${limits.hourLimit ? ` of ${limits.hourLimit}` : ""} this hour.` : ""; console.log(`${spent} request(s) counted by Octo's rate limits.${left}`); } main().catch((error) => fail(`Stopped: ${firstLine(error.message || error)}`));
Step 4. Create a list of websites
Create a file by running notepad sites.txt. Follow these rules:
Put each address on a new line.
You can include the
https://prefix or leave it out.Start comment lines with
#. Comments are useful for dividing the list into groups.
# Search and reference sites google.com wikipedia.org # Online stores amazon.com ebay.com
# Search and reference sites google.com wikipedia.org # Online stores amazon.com ebay.com
Step 5. Add proxies and VPNs
The script needs at least one connection to work: either a proxy or a VPN configuration. You can also configure both types of connection.
Proxies. Create a file by running notepad proxies.txt and add your proxies, one per line. The script accepts the same protocols and line formats as bulk proxy import in Octo Browser. Supported protocols: http, https, socks5, and ssh. Supported formats:
protocol://ip:port protocol://login:password:ip:port protocol://login:password@ip:port protocol://ip:port:login:password
protocol://ip:port protocol://login:password:ip:port protocol://login:password@ip:port protocol://ip:port:login:password
IPv6 addresses must be enclosed in square brackets: socks5://[2001:db8::1]:1080:login:password. You can also omit the protocol from a line; in that case, the type specified in DEFAULT_TYPE is used. Lines starting with # are skipped.
VPNs. Put your WireGuard configuration files in the config folder. The filename can be anything: the script identifies a config by its contents, specifically the [Interface] and [Peer] sections. The config isn't added to the Octo proxy list; it exists only inside its own profile.
[Interface] PrivateKey = <client key> Address = 10.0.0.2/32 DNS = 1.1.1.1 [Peer] PublicKey = <server key>
[Interface] PrivateKey = <client key> Address = 10.0.0.2/32 DNS = 1.1.1.1 [Peer] PublicKey = <server key>
Before running, the script checks each config for PrivateKey, Address, PublicKey, and Endpoint, and verifies that Endpoint is written as an address and port, without http://. If the script finds an error, it displays the filename and a description of the issue, then exits without creating any profiles.
Your folder structure should look like this:
D:\proxy_check\ site_access.mjs script sites.txt website list proxies.txt proxy list config\ VPN configs
D:\proxy_check\ site_access.mjs script sites.txt website list proxies.txt proxy list config\ VPN configs
Step 6. Run the check
Open Octo Browser and run the script from its folder:
cd D:\proxy_check node site_access.mjs
cd D:\proxy_check node site_access.mjs
For the first run, use one proxy and three or four websites. You'll be able to see the websites opening in the profile window. Once you've confirmed that everything works, add the rest.
When the script starts, it checks everything that could prevent it from running: the token, files, VPN configurations, and whether Octo is open. If it finds an error, it displays a message describing the issue and exits without creating profiles. The check then begins, and the result for each website is displayed as soon as it's available.

The square brackets show the connection number, its profile name, and the website counter. When several connections are checked in parallel, their output lines may be interleaved. Use the label to see which connection each line belongs to. No proxy password is shown in the output, and only the last few characters of the username are displayed. To stop the check, press Ctrl+C. The script will stop the profiles it has already launched.
How to read the results
At the end, the script prints a table and a summary for each connection:

AVAILABLE means the website opened successfully and displayed content. UNAVAILABLE means it didn't open. The reasons in parentheses after the final result are listed in descending order of frequency. DEAD in a column name means the connection itself isn't working, not that all the websites being checked are unavailable.
The ERROR label means the profile failed to launch for a reason unrelated to the connection. The Octo error message appears on that connection's line in the console and in the report.
The output files are saved in the folder. The timestamps in their names use local time:
site_access_<time>.xlsx— an Excel report. The top section contains a summary showing the total number of websites and, for each connection, how many websites are accessible, how many are inaccessible, and the reasons. Below that is the detailed check, with one row per result: profile, connection, website, result, reason, and IP. Rows for accessible websites are green; inaccessible ones are red. Gray rows indicate a non-working connection and websites that weren't checked because the proxy stopped working.screens_<time>— screenshots of failure pages, with a separate folder for each connection and screenshots numbered in the order of the website list. If the website didn't respond or the proxy itself couldn't establish a connection, there's nothing to capture, so no screenshot is saved.
The profiles remain in Octo Browser and are named by country and IP.
Let's look at some possible issues:
What you see in the report | What it means | What to do |
|---|---|---|
The connection is marked | The connection itself isn't working. | Check the proxy username, password, and type, or the VPN configuration details. |
The connection is marked | The profile failed to launch, but the problem isn't the connection. | Read the error in the report or console, fix the cause, and run the check again. |
Several | The proxy stopped working during the check: its traffic ran out or its session expired. | Check the proxy and run the check again. |
One connection has many | The proxy provider has blocked those websites. | Ask your provider which website categories are blocked on your plan. |
One connection gets | The website doesn't trust this IP address or its subnet. | Change the IP or use a different type of proxy. |
| The website isn't available in the exit country. | Use a proxy from another country. |
| The website itself isn't responding. | Try the check again later. |
| The connection is slow or keeps dropping. | Replace the connection. |
| Too many requests are coming from the same IP. | Wait and lower |
What the reasons mean
The server response code isn't reliable in this case. A denial doesn't always come with an error: Akamai may return “Access Denied” with a 200 status code, an AWS WAF check may return 202, and a DataDome block may return 401. That's why the script reads the page itself. Large websites rarely create denial pages from scratch: one of the known security systems displays the block page, and each has its own signature in the headers and text.
Reason in the report | What happened | How it's identified |
|---|---|---|
| The proxy couldn't establish a connection to this website. | A tunnel or SOCKS error in the browser. This is what a website blocked by the proxy provider looks like. |
| The proxy itself isn't working. | The proxy doesn't respond or didn't accept the username and password; status code 407. |
| The website denied access to this IP. | Cloudflare 1005–1008, 1010, 1012, 1020, and “Sorry, you have been blocked”; Akamai “Access Denied”; Imperva, Sucuri, F5, Wordfence, AWS WAF, DataDome; status codes 401, 403, and 406; or a message saying the website has detected a proxy or VPN. |
| The website requires an “Are you human?” check. | Cloudflare “Just a moment” and Turnstile; PerimeterX “Press & Hold”; CAPTCHA pages from DataDome, Akamai, AWS WAF, Kasada, Radware, DDoS-Guard, and Vercel; Google's “unusual traffic” message; Amazon CAPTCHA; reCAPTCHA; hCaptcha. |
| The website is unavailable in the connection's country. | Cloudflare 1009, status code 451, a country-based CloudFront denial, phrases such as “not available in your country,” or a redirect to an address such as |
| Too many requests came from this IP. | Status code 429 or Cloudflare 1015. |
| The website didn't respond in time. | No response arrived within the allotted time, or the website started responding and then froze. |
| The connection was interrupted or rejected. | The connection was interrupted, empty response, or connection refusal before the page loaded. |
| The website address couldn't be found. | A DNS error. |
| A secure connection couldn't be established. | A certificate or TLS error: the certificate was issued for a different address, has expired, or was replaced along the way. |
| The website sent the browser to an unrelated address. | The final address belongs to another website, which displays a short page or a denial. |
| The website keeps redirecting in a loop. | The browser stopped the redirect chain. |
| The page remained blank. | Nothing appeared on it within 10 seconds. |
| The page stopped responding. | The page opened, but the browser couldn't read it for 30 seconds because a script on it had frozen. |
| The website returned an error. | A 4xx status code, such as 404. |
| The website itself is broken; the connection isn't the problem. | A 5xx status code with no signs of security protection. |
| Another network error occurred. | The browser error code is included in the reason. |
The reasons fall into three groups. proxy_refused and proxy_error mean the connection failed: the request never reached the website. blocked, challenge, geo_blocked, and rate_limited mean the proxy let the request through, but the website denied access. timeout, connection_reset, dns_error, and ssl_error mean no response came back at all: the cause could be the proxy, the website, or the network between them.
How the script avoids false results
Mistakes can happen in either direction: a temporary failure can be mistaken for a block, or a blank page can be mistaken for a successfully opened website. Here's how the script handles ambiguous cases:
Situation | What the script does |
|---|---|
The connection drops, times out, or the proxy refuses the request. | It retries and waits up to 20 seconds for a response. |
The website displays the “Just a moment” check. | It waits up to 15 seconds: this check often clears automatically for an ordinary visitor. If it clears, the result is |
The page takes time to render its scripts. | It waits up to 10 seconds for content to appear. |
The website starts responding and then freezes. | It records a separate |
The website opens an | It dismisses the dialog by canceling it; otherwise, the page can't continue. The script then resumes the check. |
A script on the page freezes. | After 30 seconds, it assigns the |
The website redirects to its local country version, such as | It's the same website: the result is |
The website redirects to another domain, where a regular page loads. | The result is |
The website redirects to an unrelated short page or a denial page. | The result is |
The page contains an anti-bot script, but the website opens. | The presence of protection isn't treated as a denial. Only the denial page itself counts. |
The words “access denied” appear in the text of a regular article. | Denial phrases are checked in the page title and on short pages, but not in the middle of long text. |
Conclusion
The script automates website availability checks through proxies and VPNs. It shows which websites open through each connection and helps identify why the others are unavailable. Create your website list once, then run the check whenever you buy new proxies, switch providers, or run into website access issues. This way, you won't have to test each connection manually.
Frequently asked questions
How many connections can be checked at once?
Each profile is a separate browser, so the limit depends on your memory and CPU. On an average device, three to five is a reasonable number; set this with the PARALLEL setting. If all your proxies use the same provider gateway, don't set the number too high: your provider account may limit simultaneous connections.
How long does a check take?
A website that opens takes a few seconds. Websites that don't respond take the longest: the script waits 45 seconds and then retries for another 20. Connections are checked in parallel, so checking five proxies takes about as long as checking one.
Why are all websites for a connection marked DEAD?
Octo couldn't launch a profile with that proxy or VPN: the connection isn't working. Check the proxy username and password, the protocol, and the VPN config details. If the label is ERROR instead of DEAD, the profile failed to launch for another reason unrelated to the connection. That reason is shown on the connection's line.
A website is marked challenge, but it opens manually. Why?
The “Are you human?” check didn't clear automatically within 15 seconds. You can complete it manually with a click, but the script doesn't click anything. The wait time is controlled by the CHECK_WAIT setting.
Why do the results differ between runs?
Most often, the proxy has changed its IP address. Rotating proxies use different IPs between connections, and the website may treat the new address differently. With some providers, the list of blocked websites also depends on the exit node: a bank may open through one IP, while the provider blocks it through another. Another reason may be the website's own rate limits: after too many requests, it starts returning status code 429 or displaying a check.
The profile won't launch even though Octo is open. What should I do?
Check the local API port: open the browser settings, go to the Additional tab, and look at Local HTTP Server. If the port isn't 58888, enter the correct value in the LOCAL_PORT setting.
The script can't find my VPN configuration file. Why?
The configuration file must be in the config folder next to the script and contain the [Interface] and [Peer] sections. The script skips files without these sections and lists them at the beginning of its output.
What happens if a proxy stops working during the check?
This can happen when a proxy session expires or runs out of traffic: the proxy stops responding or accepting the login. After three consecutive errors from the proxy itself, the script stops checking websites through that connection so it doesn't waste time on the remaining sites. They're marked gray and SKIPPED in the report, and the summary shows after which website the proxy stopped working. The other connections continue to be checked as usual. Provider denials for individual websites (proxy_refused) don't count: the proxy is still working in that case.
What remains in Octo after the check?
Profiles named by country and IP, and any new proxies in the proxy list. To leave nothing behind, set KEEP_PROFILES = false and SAVE_PROXIES = false: the profiles will be moved to the trash, and the proxies won't be added to the list.
Does the script send my data anywhere other than Octo?
The script sends the token only to the Octo API address. It makes one request to a third-party service: if Octo doesn't report the exit country, the script looks it up by IP using GeoJS. Only the proxy's exit IP is sent to GeoJS.
Maintain your online anonymity with Octo Browser. Your real digital fingerprint cannot be tracked.
Would you like to try Octo Browser at а discount?
Use the promo code OCTOBLOG to get 30% off any subscription. This offer is valid only for new users.
What the script can do
You give the script three lists: websites, proxies, and VPN configs. For each proxy and each VPN, it creates a separate profile in Octo Browser, launches it, opens the websites one by one, and records the results. At the end, you get a table with one row per website and one column per connection, followed by a summary with the reasons for any failures.
Site GB_203.0.113.9 DE_198.51.100.7 google.com AVAILABLE AVAILABLE wikipedia.org AVAILABLE AVAILABLE amazon.com UNAVAILABLE AVAILABLE ebay.com AVAILABLE AVAILABLE GB_203.0.113.9: 3 AVAILABLE, 1 UNAVAILABLE (1 challenge) DE_198.51.100.7: 4 AVAILABLE, 0 UNAVAILABLE
For example, the script can:
Check proxies and VPNs in a single run. It reads proxies from the
proxies.txtfile and VPNs from WireGuard configuration files in theconfigfolder. It supports the same protocols and line formats as bulk proxy import in Octo Browser, including IPv6 addresses.Identify the reason. If a website doesn't load, the script tells you why: the proxy itself couldn't establish a connection, the website blocked the IP address, required a “Are you human?” check, is unavailable in the connection country, or simply didn't respond.
Tell a block from a random failure. If the connection drops or the website doesn't respond, the script checks again. If the website displays a “Are you human?” check, the script waits for it to clear on its own. If the page loads normally, the mere presence of anti-bot protection isn't treated as a failure.
Run checks in parallel. It checks up to ten connections at once, and the result for each website appears as soon as it's ready.
Name profiles by country and IP. A profile gets a name such as
DE_198.51.100.7. A non-working connection is markedDEAD, while a profile that fails to launch for another reason is markedERROR.Save a report. It creates an Excel file with a summary for each connection. Accessible websites are highlighted in green and inaccessible ones in red. The script also saves a screenshot of each failure page so you can see exactly what the website displayed.
Protect access credentials. Proxy passwords, VPN keys, and the token are not included in the console output or report. Profiles are also stopped properly, even if you interrupt the check.
The script only observes. It doesn't solve CAPTCHAs, click buttons, or enter anything. Keep the following in mind:
A
challengeresult does not mean you've been banned. The website is asking you to confirm that you're human, and you can usually open it manually in the profile.The script checks only the exact URL you provide. A homepage loading successfully doesn't mean that account login or checkout will work. Add the URL of a specific section to the list if that's what you need to test.
The result is accurate at the time of the check. A rotating proxy may use a different IP a minute later, so the results may change.
Each connection gets a new profile, and new proxies are added to the Octo proxy list. Both use up your subscription limits. Step 3 explains how to avoid leaving them behind after the check.
Why not use curl?
You can check a website through a proxy with a single curl command, but it answers a different question, namely, did the request reach the server? It can't tell you whether the website will open in a browser profile.
curlisn't a browser, and websites can tell. Security systems identify it by its TLS fingerprint and set of headers, and may deny thecurlclient itself rather than your proxy.curldoesn't run JavaScript. A browser can pass the “Just a moment” check automatically in a couple of seconds, whilecurlgets stuck on it.curlsees the response code, not the page. A geo-restriction page, CAPTCHA, or denial with a 200 status code all look like a successfully opened website to it.curlcan't check VPNs. It can connect through HTTP and SOCKS proxies, but you can't pass a WireGuard config to it.
curl still has its uses: it's a quick way to find out whether a proxy is working and what its IP address is. Only the browser in the profile can tell you whether a website will open in that profile.
What you'll need
Octo Browser with a Base subscription or higher, which gives you access to the API.
Node.js version 22.12 or later.
A list of proxies or WireGuard VPN configuration files.
Step 1. Install Node.js
Download Node.js from nodejs.org and install it using the default settings. Then open PowerShell: press Win+R, type PowerShell, and press Enter. Check the installation:
node --version
The command should display version 22.12 or later. This is required by Puppeteer 25, which was used to test the script. If PowerShell says the command can't be found, close PowerShell, reopen it, and try again.
Step 2. Prepare a folder
Choose a folder for the script, for example D:\proxy_check, create it, and navigate to it in PowerShell. Create a config folder inside it for your VPN configurations:
cd D:\ mkdir proxy_check cd proxy_check mkdir config
Install Puppeteer. The version is specified explicitly because this is the version the script was tested with:
npm install puppeteer-core@25
Step 3. The site_access.mjs script
In PowerShell, with proxy_check as the current folder, run notepad site_access.mjs. When asked whether you want to create a new file, click Yes, paste the entire code, and save it by pressing Ctrl+S. Creating the file from the command line helps avoid a file-extension issue: if you create it through the Notepad menu, it may be saved as site_access.mjs.txt, and the script won't run. Create the other files in the following steps in the same way.
The settings are listed at the beginning of the code, each with a comment explaining it. One setting is required: paste your API token into API_TOKEN. You can find it in Octo Browser, under the API tokens tab in your master account settings.
const API_TOKEN = "your_token";
You can leave the other settings at their default values. However, pay attention to these two parameters:
KEEP_PROFILES = false sends profiles to the trash after the check.
SAVE_PROXIES = false prevents the tested proxies from being added to the Octo proxy list. With these settings, the profiles and proxies created for testing won't clutter your working lists in the browser. This is useful if your profile limit is low.
Here's a detailed description of the settings:
Setting | What it controls |
|---|---|
| Octo Browser API token |
| Octo client's local API port, 58888 by default. You can find it in the settings under the Additional tab. |
| Profile operating system: |
|
|
| Number of connections checked simultaneously, from 1 to 10. |
| Proxies specified directly in the code, in addition to those in the file. |
| File containing proxies; |
| Type used for proxy lines that don't specify one. |
|
|
| Folder containing VPN configurations; |
| Protocol used by the configuration files and the mode used to identify them in the Octo API. The defaults are |
| File containing the website list; |
|
|
| Whether to save screenshots of failure pages. |
| How many seconds to wait for a website to respond, for the “Are you human?” check to clear, and for page content to appear. |
Here's the code:
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import { crc32 } from "node:zlib"; const API_TOKEN = ""; // paste your Octo API token between the quotes const LOCAL_PORT = 58888; // port of the local API of the Octo client: Octo client, Settings, Additional const OS = "win"; // OS of the profiles: win, mac or android const HEADLESS = false; // true: profiles run without a window; false: with a window const PARALLEL = 5; // connections checked at the same time, from 1 to 10 const PROXIES = [ // one proxy per line, for example "socks5://login:password@proxy.example.com:10000", ]; const PROXY_FILE = "proxies.txt"; // a file next to the script with one proxy per line, read together with PROXIES const DEFAULT_TYPE = "socks5"; // type for proxy lines without one: http, https, socks5 or ssh const SAVE_PROXIES = true; // true: new proxies are saved to Octo's proxy list; false: a proxy lives only in its profile const VPN_FOLDER = "config"; // folder with WireGuard configs: one VPN profile per file const VPN_PROTOCOL = "wireguard"; // protocol of the configs, as the Octo API names it const VPN_SYN_MODE = "profile_based"; // syn_mode of the VPN, as the Octo API names it const SITES_FILE = "sites.txt"; // sites to check: one per line, # starts a comment const KEEP_PROFILES = true; // false: every profile goes to the trash after its check const SCREENSHOTS = true; // true: save a screenshot of every page that did not open const PAGE_TIMEOUT = 45; // seconds a site gets to answer const CHECK_WAIT = 15; // seconds a "checking your browser" page gets to clear by itself const EMPTY_WAIT = 10; // seconds a blank page gets to show something const HERE = dirname(fileURLToPath(import.meta.url)); const CLOUD = "https://app.octobrowser.net/api/v2/automation"; const LOCAL = `http://localhost:${LOCAL_PORT}/api`; const OS_NAMES = { win: "Windows", mac: "macOS", android: "Android" }; const PROXY_TYPES = ["http", "https", "socks5", "ssh"]; const SHORT_PAGE = 2500; const PAGE_LIMITS = { text: 200000, html: 400000, title: 2000 }; const RETRY_TIMEOUT = 20; const PROXY_FAILURES = 3; const BROWSER_TIMEOUT = 30; const RETRY = new Set(["timeout", "connection_reset", "dns_error", "proxy_refused", "unreachable"]); const sleep = (ms) => new Promise((done) => setTimeout(done, ms)); const anyOf = (phrases) => new RegExp(phrases.join("|")); const secrets = new Set(); const hide = (value) => String(value || "").length >= 4 && secrets.add(String(value)); const printable = (text) => String(text).replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]+/g, " "); const redact = (text) => [...secrets] .sort((a, b) => b.length - a.length) .reduce((clean, secret) => clean.split(secret).join("***"), printable(text)) .replace(/\/\/[^\s/@]+@/g, "//***@"); const firstLine = (text) => redact(String(text).split("\n")[0]).slice(0, 200); const fileName = (text) => String(text).replace(/[^\w.-]+/g, "_"); const localStamp = () => new Date(Date.now() - new Date().getTimezoneOffset() * 60000).toISOString().slice(0, 19).replace(/[:T]/g, "-"); const readText = (file) => readFileSync(file, "utf8").replace(/^\uFEFF/, ""); const fail = (message) => { console.error(message); process.exit(1); }; const GEO = anyOf([ "(not|isn.t|aren.t) (currently |yet )?(available|accessible|offered|permitted|allowed|supported) (in|from|for) your (country|region|location|area|territory|jurisdiction)", "(unavailable|blocked|restricted|prohibited|banned|not supported) (in|from|for) your (country|region|location|area|territory|jurisdiction)", "not available in this (country|region)", "access from your (country|region|location) (is|has been) (blocked|restricted|denied|disabled)", "(from|in) a restricted (country|territory|jurisdiction|region|location)", "your (country|region|location|territory) is (restricted|not supported|blocked|not allowed)", "(do|does) not accept (players|customers|users|visitors|residents) from", "(accessing|visiting|located|you are|you.re|you appear)[^.]{0,60}outside (of )?(the )?(uk|u[.]k[.]?|united kingdom|us|u[.]s[.]?|usa|united states|eu)([ .,!]|$)", "country (that |where )?you are (located in|in|accessing from|visiting from)[^.]{0,30}not (supported|allowed|available)", "(do not|don.t|cannot|can.t) allow access (in|from) your (current )?(country|region|location)", "(unavailable|not available|cannot be accessed|can.t be accessed)[^.]{0,120}european (economic area|union)", "unavailable (due to|for) legal reasons", "configured to block access from your country", "недоступ[а-яё]* (в|на территории|для) ваш[а-яё]* (стран|регион)", "nicht in (deinem|ihrem) land", "pas disponible dans votre (pays|région)", "no está disponible en (tu|su) (país|región)", "não está disponível (no|em) seu país", ]); const PROXY_SEEN = anyOf([ "(vpn|proxy|proxies|anonymizer|unblocker)[^.]{0,60}(detected|not (allowed|permitted|supported))", "(appear|seem)s? to be using (a |an )?(vpn|proxy|unblocker|anonymizer)", "(detected|blocked) (a |an |your )?(vpn|proxy|anonymous proxy)", "(disable|turn off|switch off) (your |the |any )?(vpn|proxy)", ]); const CHECKS = anyOf([ "checking (your browser|if the site connection is secure)", "verif(y|ying) (that )?you are (a )?human", "verify (that )?you are not a (robot|bot)", "(prove|confirm) (that )?you are (a )?human", "are you (a )?(human|robot)", "(complete|pass|performing) (a |the )?(security check|captcha)", "security checkpoint", "enable javascript and cookies to continue", "press (&|and) hold", "unusual (traffic|activity)", "suspicious (activity|traffic)", "automated (access|requests|queries|traffic)", "подтвердите, что вы не робот", "проверка браузера", ]); const REFUSALS = anyOf([ "access (to (this|the) (site|page|website|resource|service) )?(is |has been |was )?(denied|forbidden|blocked|restricted)", "you (have been|are|were) (blocked|banned)", "your (ip|ip address|request|access|connection) (has been|was|is) (temporarily )?(blocked|banned|denied|blacklisted|rejected|limited)", "request (blocked|rejected|denied)", "blocked (by|due to) [^.]{0,40}(security|firewall|policy|administrator|rules)", "403 forbidden", "error 403", "you (don.t|do not) have permission to (access|view)", "not authori[sz]ed to (access|view)", "доступ (к (сайту|ресурсу|странице) )?(запрещ|ограничен|заблокирован|закрыт)", "ваш ip[^.]{0,30}(заблокирован|забанен)", ]); const CLOUDFLARE_ERRORS = { 1005: "the network of this IP is banned", 1006: "this IP is banned", 1007: "this IP is banned", 1008: "this IP is banned", 1010: "the browser signature is banned", 1012: "access denied", 1020: "access denied by a firewall rule", }; function guardOf(header, html) { const server = header("server"); if (server.includes("cloudflare") || header("cf-ray")) return "Cloudflare "; if (server.includes("akamai")) return "Akamai "; if (server.includes("ddos-guard") || html.includes("ddos-guard")) return "DDoS-Guard "; return ""; } function cloudflareError(guard, html, short, words) { const onCloudflare = guard === "Cloudflare " || html.includes("cloudflare"); if (!short || !onCloudflare) return ""; return (words.match(/error(?: code)?:? ?(1\d{3})(?!\d)/) || [])[1] || ""; } function view(look) { const text = String(look.text || ""); const title = String(look.title || "").toLowerCase(); const heading = String(look.heading || "").toLowerCase(); const html = String(look.html || "").toLowerCase(); const header = (name) => String(look.headers?.[name] ?? "").toLowerCase(); const short = text.trim().length < SHORT_PAGE; const words = `${title} | ${heading} | ${text.toLowerCase()}`; const guard = guardOf(header, html); return { status: Number(look.status) || 0, url: String(look.url || "").toLowerCase(), html, title, top: `${title} | ${heading}`, words, short, empty: !text.trim(), refusal: short || Number(look.status) >= 400, header, guard, cloudflare: cloudflareError(guard, html, short, words), }; } const said = (page, phrases) => (page.top.match(phrases) || (page.short && page.words.match(phrases)) || [""])[0]; const quoted = (phrase) => (phrase ? `, the page says: "${phrase}"` : ""); const RULES = [ { verdict: "challenge", detail: "Cloudflare challenge", when: (page) => page.header("cf-mitigated").includes("challenge"), }, { verdict: "blocked", detail: (page, state) => `Cloudflare refused (cf-mitigated: ${state})`, when: (page) => page.header("cf-mitigated"), }, { verdict: "blocked", detail: "AWS WAF refused", when: (page) => page.header("x-amzn-waf-action") === "block", }, { verdict: "challenge", detail: (page, action) => `AWS WAF ${action}`, when: (page) => page.header("x-amzn-waf-action"), }, { verdict: "blocked", detail: "Sucuri firewall refused", when: (page) => page.header("x-sucuri-block") || (page.refusal && page.words.includes("sucuri website firewall")), }, { verdict: "challenge", detail: "Kasada check", when: (page) => (page.status >= 400 && (page.header("x-kpsdk-ct") || page.header("x-kpsdk-cd"))) || (page.short && page.html.includes("kpsdk")), }, { verdict: "geo_blocked", detail: "Cloudflare 1009: the site bans the country of this IP", when: (page) => page.cloudflare === "1009" || (page.refusal && page.words.includes("banned the country or region")), }, { verdict: "geo_blocked", detail: "HTTP 451: unavailable for legal reasons in this country", when: (page) => page.status === 451, }, { verdict: "geo_blocked", detail: (page, phrase) => `the page says: "${phrase}"`, when: (page) => said(page, GEO), }, { verdict: "rate_limited", detail: "Cloudflare 1015: too many requests from this IP", when: (page) => page.cloudflare === "1015", }, { verdict: "blocked", detail: (page, meaning) => `Cloudflare ${page.cloudflare}: ${meaning}`, when: (page) => CLOUDFLARE_ERRORS[page.cloudflare], }, { verdict: "blocked", detail: "Cloudflare: 'you have been blocked'", when: (page) => page.short && /sorry, you have been blocked|attention required! \| cloudflare/.test(page.words), }, { verdict: "challenge", detail: "Cloudflare 'Just a moment' check", when: (page) => page.refusal && (page.title.includes("just a moment") || page.html.includes("cf_chl_opt")), }, { verdict: "challenge", detail: "Cloudflare Turnstile check", when: (page) => page.short && page.html.includes("cf-turnstile"), }, { verdict: "blocked", detail: "Akamai: Access Denied", when: (page) => page.refusal && (page.html.includes("errors.edgesuite.net") || page.html.includes("reference #") || /reference #\d+\.[0-9a-f]{6,}/.test(page.words)), }, { verdict: "challenge", detail: "Akamai check", when: (page) => page.short && (page.html.includes("_sec/cp_challenge") || page.html.includes("sec-if-cpt")), }, { verdict: "blocked", detail: "DataDome refused", when: (page) => page.refusal && page.html.includes("captcha-delivery.com") && /temporarily restricted|you have been blocked|access (is |was )?(denied|blocked)/.test(page.words), }, { verdict: "challenge", detail: "DataDome captcha", when: (page) => page.refusal && page.html.includes("captcha-delivery.com"), }, { verdict: "challenge", detail: "PerimeterX (HUMAN) 'Press & Hold'", when: (page) => (page.refusal && page.html.includes("px-captcha")) || page.title.includes("access to this page has been denied") || (page.short && page.status >= 400 && /_pxappid|px-cloud\.net|px-cdn\.net/.test(page.html)), }, { verdict: "blocked", detail: "Imperva (Incapsula) refused", when: (page) => page.refusal && /incapsula incident id|request unsuccessful\. incapsula|this request was blocked by (our|the) security service/.test( page.words, ), }, { verdict: "challenge", detail: "Imperva check", when: (page) => (page.short && page.words.includes("pardon our interruption")) || (page.empty && page.html.includes("_incapsula_resource")), }, { verdict: "blocked", detail: "F5 BIG-IP refused", when: (page) => page.refusal && page.words.includes("the requested url was rejected"), }, { verdict: "blocked", detail: "AWS CloudFront refused", when: (page) => page.status === 403 && page.short && /request blocked|the request could not be satisfied/.test(page.words), }, { verdict: "challenge", detail: "AWS WAF check", when: (page) => page.short && /token\.awswaf\.com|awswafintegration/.test(page.html), }, { verdict: "challenge", detail: "Radware check", when: (page) => page.url.includes("perfdrive.com") || (page.short && page.html.includes("perfdrive.com")), }, { verdict: "challenge", detail: "Vercel security checkpoint", when: (page) => page.title.includes("vercel security checkpoint"), }, { verdict: "challenge", detail: "SiteGround captcha", when: (page) => page.url.includes("/.well-known/sgcaptcha"), }, { verdict: "blocked", detail: "Wordfence refused", when: (page) => page.short && /your access to this site has been limited|generated by wordfence/.test(page.words), }, { verdict: "blocked", detail: "the site blocked the request by its network policy", when: (page) => page.refusal && page.words.includes("blocked due to a network policy"), }, { verdict: "challenge", detail: "Google 'unusual traffic' check", when: (page) => (page.url.includes("google.") && page.url.includes("/sorry/")) || page.words.includes("our systems have detected unusual traffic"), }, { verdict: "challenge", detail: "Amazon captcha", when: (page) => page.refusal && /enter the characters you see below|to discuss automated access to amazon data/.test(page.words), }, { verdict: "challenge", detail: "captcha page", when: (page) => page.short && /recaptcha|hcaptcha|h-captcha|geetest|funcaptcha|arkoselabs/.test(page.html) && /captcha|robot|human|verify|security/.test(page.words), }, { verdict: "blocked", detail: (page, phrase) => `the site sees a proxy or VPN: "${phrase}"`, when: (page) => said(page, PROXY_SEEN), }, { verdict: "challenge", detail: (page, phrase) => `${page.guard}check page: "${phrase}"`, when: (page) => said(page, CHECKS), }, { verdict: "proxy_error", detail: "HTTP 407: the proxy wants another login or password", when: (page) => page.status === 407, }, { verdict: "rate_limited", detail: "HTTP 429: too many requests from this IP", when: (page) => page.status === 429, }, { verdict: "blocked", detail: (page) => `${page.guard}HTTP ${page.status}${quoted(said(page, REFUSALS))}`, when: (page) => [401, 403, 406].includes(page.status), }, { verdict: "blocked", detail: (page, phrase) => `the page says: "${phrase}"`, when: (page) => said(page, REFUSALS), }, { verdict: "server_error", detail: (page) => `HTTP ${page.status}: Cloudflare could not reach the site's own server`, when: (page) => page.status >= 520 && page.status <= 527, }, { verdict: "server_error", detail: (page) => `HTTP ${page.status}: the site itself fails`, when: (page) => page.status >= 500, }, { verdict: "http_error", detail: (page) => `HTTP ${page.status}`, when: (page) => page.status >= 400, }, ]; export function classify(look) { const page = view(look); for (const rule of RULES) { const match = rule.when(page); if (match) { return { verdict: rule.verdict, detail: typeof rule.detail === "function" ? rule.detail(page, match) : rule.detail, }; } } return { verdict: "ok", detail: `HTTP ${page.status || "?"}` }; } const NETWORK_ERRORS = [ { verdict: "proxy_error", codes: /ERR_SOCKS5_AUTH|ERR_SOCKS_AUTH|ERR_PROXY_AUTH_REQUESTED/, detail: "the proxy rejected its login or password: it may have expired or run out of traffic", }, { verdict: "proxy_error", codes: /ERR_PROXY_CONNECTION_FAILED|ERR_PROXY_AUTH|ERR_NO_SUPPORTED_PROXIES|ERR_PROXY_CERTIFICATE|ERR_MANDATORY_PROXY/, detail: "the proxy itself does not work", }, { verdict: "proxy_refused", codes: /ERR_TUNNEL_CONNECTION_FAILED|ERR_SOCKS_CONNECTION/, detail: "the proxy did not open a connection to this site, its provider may block the site", }, { verdict: "timeout", codes: /ERR_TIMED_OUT|ERR_CONNECTION_TIMED_OUT/, detail: "the site did not answer in time", }, { verdict: "connection_reset", codes: /ERR_CONNECTION_RESET|ERR_CONNECTION_CLOSED|ERR_CONNECTION_ABORTED|ERR_EMPTY_RESPONSE|ERR_SOCKET_NOT_CONNECTED/, detail: "the connection was cut before an answer came", }, { verdict: "connection_reset", codes: /ERR_HTTP2_PROTOCOL_ERROR|ERR_QUIC_PROTOCOL_ERROR/, detail: "the site cut the connection, the way some protection services refuse a visitor", }, { verdict: "connection_refused", codes: /ERR_CONNECTION_REFUSED/, detail: "the site refused the connection", }, { verdict: "dns_error", codes: /ERR_NAME_NOT_RESOLVED|ERR_NAME_RESOLUTION_FAILED|ERR_DNS/, detail: "the address of the site was not found", }, { verdict: "ssl_error", codes: /ERR_CERT_COMMON_NAME_INVALID/, detail: "the site's certificate is issued for another address", }, { verdict: "ssl_error", codes: /ERR_CERT_DATE_INVALID/, detail: "the site's certificate has expired or is not valid yet", }, { verdict: "ssl_error", codes: /ERR_SSL|ERR_CERT|ERR_BAD_SSL|ERR_TLS/, detail: "the secure connection failed, something on the way may replace the site's certificate", }, { verdict: "redirect_loop", codes: /ERR_TOO_MANY_REDIRECTS/, detail: "the site redirects in a circle", }, { verdict: "blocked", codes: /ERR_BLOCKED_BY/, detail: "the request was blocked", }, ]; export function networkError(message, timeout = PAGE_TIMEOUT) { const code = (String(message).match(/(?:net::)?\b(ERR_[A-Z0-9_]+)/) || [])[1]; if (!code) { return /timeout/i.test(message) ? { verdict: "timeout", detail: `no answer in ${timeout} s` } : { verdict: "unreachable", detail: firstLine(message) }; } const known = NETWORK_ERRORS.find((entry) => entry.codes.test(code)); return known ? { verdict: known.verdict, detail: `${code}: ${known.detail}` } : { verdict: "unreachable", detail: code }; } let token = ""; let spent = 0; let limits = null; const running = new Set(); const answerOf = async (response) => ({ status: response.status, ok: response.ok, data: await response.json().catch(() => ({})), }); async function cloud(method, path, body) { for (let attempt = 0; ; attempt++) { spent += 1; const response = await fetch(CLOUD + path, { method, headers: { "X-Octo-Api-Token": token, "Content-Type": "application/json" }, body: body ? JSON.stringify(body) : undefined, signal: AbortSignal.timeout(120000), }); if (response.status === 429 && attempt < 5) { const wait = Number(response.headers.get("retry-after")) || 5; if (wait > 60) throw new Error(`Octo's rate limit is used up for ${wait} s, run the script again later`); await sleep(wait * 1000); continue; } const minute = response.headers.get("x-ratelimit-remaining"); const hour = response.headers.get("x-ratelimit-remaining-hour"); if (minute !== null && hour !== null) { limits = { minute, hour, minuteLimit: response.headers.get("x-ratelimit-limit"), hourLimit: response.headers.get("x-ratelimit-limit-hour"), }; if (Number(minute) < 5) await sleep(5000); } return answerOf(response); } } async function local(path, body) { spent += path === "/profiles/active" ? 0 : 1; const response = await fetch(LOCAL + path, { method: body ? "POST" : "GET", headers: { "Content-Type": "application/json" }, body: body ? JSON.stringify(body) : undefined, signal: AbortSignal.timeout(180000), }); return answerOf(response); } async function stopProfile(uuid) { await local("/profiles/stop", { uuid }).catch(() => {}); running.delete(uuid); } process.on("SIGINT", async () => { console.log(`\nStopping ${running.size} running profile(s)...`); await Promise.all([...running].map(stopProfile)); process.exit(130); }); const splitOutsideBrackets = (text) => text.split(/:(?![^[]*\])/); const isPort = (text) => /^\d{1,5}$/.test(text || "") && Number(text) >= 1 && Number(text) <= 65535; const isAddress = (text) => /^\[.+\]$/.test(text) || text.includes(".") || text === "localhost"; export function parseProxy(line, defaultType = DEFAULT_TYPE) { const scheme = line.match(/^([a-z0-9]+):\/\//i); const type = scheme ? scheme[1].toLowerCase() : defaultType; const rest = scheme ? line.slice(scheme[0].length) : line; let host, port, login, secret; if (rest.includes("@")) { const at = rest.lastIndexOf("@"); [login, ...secret] = rest.slice(0, at).split(":"); [host, port] = splitOutsideBrackets(rest.slice(at + 1)); } else { const parts = splitOutsideBrackets(rest); const addressFirst = parts.length <= 2 || (isPort(parts[1]) && (isAddress(parts[0]) || !isPort(parts.at(-1)))); if (addressFirst) { [host, port, login, ...secret] = parts; } else { [login, ...secret] = parts.slice(0, -2); [host, port] = parts.slice(-2); } } const password = secret.join(":"); if (!PROXY_TYPES.includes(type) || !host || !isPort(port)) return null; const address = host.replace(/^\[(.+)\]$/, "$1"); return { type, host: address, port: Number(port), ...(login ? { login } : {}), ...(password ? { password } : {}) }; } function proxyLabel(proxy) { const host = proxy.host.includes(":") ? `[${proxy.host}]` : proxy.host; return `${proxy.type}://${proxy.login ? `…${proxy.login.slice(-10)}@` : ""}${host}:${proxy.port}`; } async function proxyUuid(job, saved) { const { proxy } = job; const same = (other) => proxy.type === String(other.type).toLowerCase() && proxy.host === other.host && String(proxy.port) === String(other.port) && (proxy.login || "") === (other.login || "") && (proxy.password || "") === (other.password || ""); const known = saved.find(same); if (known) return known.uuid; const added = await cloud("POST", "/proxies", { ...proxy, title: `proxy ${proxy.host}:${proxy.port} #${job.number}`, }); if (!added.data?.data?.uuid) { throw new Error(`could not add the proxy to Octo (HTTP ${added.status} ${added.data?.code || ""})`); } return added.data.data.uuid; } export function checkVpnConfig(text) { const keys = { interface: new Set(), peer: new Set() }; let section = ""; let endpoint = ""; for (const line of text.split("\n")) { const head = line.match(/^\s*\[(\w+)\]/); const pair = line.match(/^\s*(\w+)\s*=\s*(\S+)/); if (head) section = head[1].toLowerCase(); if (!pair || !keys[section]) continue; keys[section].add(pair[1].toLowerCase()); if (section === "peer" && pair[1].toLowerCase() === "endpoint") endpoint = pair[2]; } const required = [ ["Interface", "PrivateKey"], ["Interface", "Address"], ["Peer", "PublicKey"], ["Peer", "Endpoint"], ]; const missing = required .filter(([part, key]) => !keys[part.toLowerCase()].has(key.toLowerCase())) .map(([part, key]) => `${key} in [${part}]`); if (missing.length) return `no ${missing.join(", ")}`; if (!/^(\[[0-9a-f:.]+\]|[a-z0-9.-]+):\d{1,5}$/i.test(endpoint)) { return `Endpoint must be address:port, without http://, not "${endpoint}"`; } return ""; } export function findVpns(folder) { const vpns = []; const skipped = []; if (!existsSync(folder) || !statSync(folder).isDirectory()) return { vpns, skipped }; const files = readdirSync(folder) .filter((file) => statSync(join(folder, file)).isFile()) .sort((a, b) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" })); for (const file of files) { const raw = readFileSync(join(folder, file)); const text = raw .toString("utf8") .replace(/^\uFEFF/, "") .replace(/\r\n/g, "\n"); if (!/^\s*\[Interface\]/im.test(text) || !/^\s*\[Peer\]/im.test(text)) { skipped.push(file); continue; } const problem = checkVpnConfig(text); if (problem) throw new Error(`${file}: ${problem}`); vpns.push({ file, conf: raw.toString("base64") }); } return { vpns, skipped }; } export function readSites(text) { const sites = []; for (const [index, raw] of text.split(/\r?\n/).entries()) { const line = raw.replace(/\s+#.*$/, "").trim(); if (!line || line.startsWith("#") || /^\[.*\]$/.test(line)) continue; let url; try { url = new URL(/^[a-z]+:\/\//i.test(line) ? line : `https://${line}`); } catch { url = null; } if (!url || !["http:", "https:"].includes(url.protocol) || !url.hostname.includes(".")) { throw new Error(`line ${index + 1}: "${line}" is not a site address`); } const site = url.href.replace(/\/$/, ""); if (!sites.includes(site)) sites.push(site); } return sites; } const REGION_NAMES = new Intl.DisplayNames(["en"], { type: "region" }); const COUNTRY_CODES = new Map(); for (let first = 65; first <= 90; first++) { for (let second = 65; second <= 90; second++) { const code = String.fromCharCode(first, second); try { const name = REGION_NAMES.of(code); if (new Intl.Locale(`und-${code}`).region === code && name && name !== code) { COUNTRY_CODES.set(name.toLowerCase(), code); } } catch { continue; } } } async function countryOf(exit) { const code = String(exit.countryCode || exit.country_code || ""); if (/^[A-Za-z]{2}$/.test(code)) return code.toUpperCase(); const byName = COUNTRY_CODES.get(String(exit.country || exit.countryName || "").toLowerCase()); if (byName) return byName; if (!exit.ip) return "XX"; try { const url = `https://get.geojs.io/v1/ip/country/${encodeURIComponent(exit.ip)}.json`; const found = (await (await fetch(url, { signal: AbortSignal.timeout(20000) })).json()).country; return /^[A-Z]{2}$/.test(found || "") ? found : "XX"; } catch { return "XX"; } } let androidModels = []; async function loadAndroidModels() { const answer = await cloud("GET", "/fingerprint/device_models?device_type=phone"); const models = Array.isArray(answer.data?.data) ? answer.data.data : []; androidModels = models.filter((model) => model?.value && model.os_versions?.length); if (!androidModels.length) fail(`Could not read the Android phone models: HTTP ${answer.status}. Nothing was done.`); } function fingerprint() { if (OS !== "android") return { os: OS }; const model = androidModels[Math.floor(Math.random() * androidModels.length)]; const version = model.os_versions[Math.floor(Math.random() * model.os_versions.length)]; return { os: "android", os_arch: "arm", device_type: "phone", device_model: model.value, os_version: String(version), }; } export function hostOf(url) { try { return new URL(url).hostname.replace(/^www\./, ""); } catch { return String(url); } } export function siteName(url) { try { const path = new URL(url).pathname.replace(/\/$/, ""); return hostOf(url) + path; } catch { return String(url); } } export function brandOf(url) { const parts = hostOf(url).split("."); const secondLevel = ["co", "com", "org", "net", "gov", "ac", "edu", "ltd", "plc"]; const deep = parts.length > 2 && secondLevel.includes(parts[parts.length - 2]); return parts[parts.length - (deep ? 3 : 2)] || parts[0]; } const shows = (look) => String(look.text || "").trim().length >= 20 || /<(img|canvas|svg|video)\b/i.test(String(look.html || "")); async function read(page, answer) { const nothing = { ...answer, title: "", heading: "", text: "", html: "" }; for (let attempt = 0; attempt < 3; attempt++) { try { const seen = await page.evaluate( (limits) => ({ text: (document.body?.innerText || "").slice(0, limits.text), heading: (document.querySelector("h1")?.innerText || "").slice(0, limits.title), title: document.title.slice(0, limits.title), html: (document.documentElement?.outerHTML || "").slice(0, limits.html), }), PAGE_LIMITS, ); if (seen.text.trim().length < SHORT_PAGE) { const frames = page.frames().slice(1, 6); const inside = (frame) => frame.evaluate(() => document.body?.innerText || "").catch(() => ""); const texts = await Promise.all( frames.map((frame) => Promise.race([inside(frame), sleep(3000).then(() => "")])), ); seen.text = [seen.text, ...texts].join("\n").slice(0, PAGE_LIMITS.text); } return { ...answer, ...seen, url: page.url() }; } catch (error) { if (/timed out/i.test(error.message)) return { ...nothing, url: page.url(), unresponsive: true }; await sleep(1000); } } return { ...nothing, url: page.url() }; } const RESTRICTION_PAGE = /(^|[./_-])(restricted|restriction|geo-?block(ed)?|geo-?restrict(ed|ion)?|not-?available|unavailable|access-?denied|blocked|forbidden|country-?(not-?)?(allowed|supported|restricted))([./?#_-]|$)/i; export function restrictionPage(asked, reached) { try { const from = new URL(asked); const to = new URL(reached); if (from.hostname === to.hostname && from.pathname === to.pathname) return ""; const where = `${to.hostname}${to.pathname}`; return RESTRICTION_PAGE.test(where) && !RESTRICTION_PAGE.test(`${from.hostname}${from.pathname}`) ? where : ""; } catch { return ""; } } function moved(asked, look, found) { const to = hostOf(look.url); if (!look.url || to === hostOf(asked)) return found; if (brandOf(look.url) === brandOf(asked)) return { ...found, detail: `${found.detail}, opened as ${to}` }; const page = view(look); const lead = `${page.top} | ${String(look.text || "") .toLowerCase() .slice(0, 1500)}`; const phrase = [GEO, PROXY_SEEN, REFUSALS, CHECKS].map((list) => (lead.match(list) || [""])[0]).find(Boolean); if (!page.short && !phrase) { return { ...found, detail: `${found.detail}, but opened another site: ${to} (check that it is the one you need)` }; } return { verdict: "redirected", detail: `sent to another site, ${to}` + (phrase ? `, which says: "${phrase}"` : "") }; } function watchAnswer(page) { const answer = { status: 0, headers: {} }; page.on("response", (response) => { try { if (response.request().isNavigationRequest() && response.frame() === page.mainFrame()) { Object.assign(answer, { status: response.status(), headers: response.headers() }); } } catch { return; } }); return answer; } async function waitFor(page, answer, look, seconds, pause, settled) { for (const until = Date.now() + seconds * 1000; !settled(look) && Date.now() < until;) { await sleep(pause); look = await read(page, answer); } return look; } async function judge(page, answer, url, slow, timeout) { const stuck = (seen) => seen.unresponsive && { verdict: "unresponsive", detail: `the page stopped responding (HTTP ${seen.status})` }; let look = await read(page, answer); if (look.url.startsWith("chrome-error://") && look.status < 400) return networkError(look.text, timeout); let found = classify(look); if (found.verdict === "challenge") { const check = found.detail; look = await waitFor(page, answer, look, CHECK_WAIT, 2500, (seen) => classify(seen).verdict !== "challenge"); found = classify(look); if (found.verdict === "ok") found.detail += `, passed a check by itself (${check})`; } if (found.verdict === "ok" && !shows(look) && !stuck(look)) { look = await waitFor(page, answer, look, EMPTY_WAIT, 2000, (seen) => shows(seen) || seen.unresponsive); found = classify(look); if (found.verdict === "ok" && !shows(look) && !stuck(look)) { return slow ? { verdict: "timeout", detail: `the site answered (HTTP ${look.status}) but the page did not load in ${timeout} s`, } : { verdict: "empty", detail: `the page stayed empty for ${EMPTY_WAIT} s` }; } } if (stuck(look)) return stuck(look); const restriction = found.verdict === "ok" && restrictionPage(url, look.url); if (restriction) return { verdict: "geo_blocked", detail: `sent to a restriction page, ${restriction.replace(/\/$/, "")}` }; if (found.verdict === "ok") found = moved(url, look, found); if (found.verdict === "ok" && slow) found.detail += ", loaded slowly"; return found; } async function inspect(browser, url, shot, timeout) { const page = await browser.newPage(); const answer = watchAnswer(page); page.on("dialog", (dialog) => dialog.dismiss().catch(() => {})); try { let slow = false; try { await page.goto(url, { waitUntil: "domcontentloaded", timeout: timeout * 1000 }); } catch (error) { const failed = /net::ERR_/.test(error.message) && !error.message.includes("ERR_ABORTED"); if (!answer.status || failed) return networkError(error.message, timeout); slow = /timeout/i.test(error.message); } await page.waitForNetworkIdle({ idleTime: 800, timeout: 8000 }).catch(() => {}); const found = await judge(page, answer, url, slow, timeout); if (found.verdict !== "ok" && found.verdict !== "unresponsive" && shot) { found.screenshot = await page.screenshot({ path: shot }).then( () => shot, () => "", ); } return found; } finally { await page.close().catch(() => {}); } } export async function checkSite(browser, url, shot = "") { let found = await inspect(browser, url, shot, PAGE_TIMEOUT); if (RETRY.has(found.verdict)) { const first = found.verdict; await sleep(3000); found = await inspect(browser, url, shot, Math.min(PAGE_TIMEOUT, RETRY_TIMEOUT)); found.detail += found.verdict === first ? " (on the second try too)" : ` (the first try: ${first})`; } return { result: found.verdict === "ok" ? "AVAILABLE" : "UNAVAILABLE", reason: `${found.verdict}: ${printable(found.detail)}`, screenshot: found.screenshot || "", }; } function checkSettings() { const seconds = [PAGE_TIMEOUT, CHECK_WAIT, EMPTY_WAIT]; const problems = [ [!OS_NAMES[OS], `OS is win, mac or android, not "${OS}".`], [typeof HEADLESS !== "boolean", "HEADLESS is true or false, without quotes."], [typeof KEEP_PROFILES !== "boolean", "KEEP_PROFILES is true or false, without quotes."], [typeof SCREENSHOTS !== "boolean", "SCREENSHOTS is true or false, without quotes."], [!Number.isInteger(PARALLEL) || PARALLEL < 1 || PARALLEL > 10, "PARALLEL is a whole number from 1 to 10."], [!PROXY_TYPES.includes(DEFAULT_TYPE), `DEFAULT_TYPE is one of ${PROXY_TYPES.join(", ")}.`], [seconds.some((value) => !(value > 0)), "PAGE_TIMEOUT, CHECK_WAIT and EMPTY_WAIT are seconds above zero."], [!Number.isInteger(LOCAL_PORT) || LOCAL_PORT < 1 || LOCAL_PORT > 65535, "LOCAL_PORT is a port number, 1 to 65535."], [typeof SAVE_PROXIES !== "boolean", "SAVE_PROXIES is true or false, without quotes."], ]; const problem = problems.find(([wrong]) => wrong); if (problem) fail(`${problem[1]} Nothing was done.`); } function readToken() { const found = String(API_TOKEN).trim(); if (!found) fail("No API token: paste it into API_TOKEN at the top of the script. Nothing was done."); return found; } function readProxies() { const file = join(HERE, PROXY_FILE); const fromFile = PROXY_FILE && existsSync(file) ? readText(file).split(/\r?\n/) : []; const lines = [...PROXIES, ...fromFile].map((line) => line.trim()).filter((line) => line && !line.startsWith("#")); const proxies = lines.map((line) => parseProxy(line)); const bad = proxies.flatMap((proxy, index) => (proxy ? [] : [index + 1])); if (bad.length) fail(`Proxy line(s) ${bad.join(", ")} not understood. Nothing was done.`); proxies.forEach((proxy) => hide(proxy.password)); return proxies; } function readVpns() { try { const { vpns, skipped } = findVpns(join(HERE, VPN_FOLDER)); if (skipped.length) console.log(`Not VPN configs, skipped in ${VPN_FOLDER}: ${skipped.join(", ")}`); if (vpns.length) console.log(`VPN configs found in ${VPN_FOLDER}: ${vpns.map((vpn) => vpn.file).join(", ")}`); if (vpns.length && !(String(VPN_PROTOCOL).trim() && String(VPN_SYN_MODE).trim())) { fail("VPN_PROTOCOL and VPN_SYN_MODE can't be empty. Nothing was done."); } for (const vpn of vpns) { hide(vpn.conf); const keys = Buffer.from(vpn.conf, "base64") .toString() .matchAll(/^\s*(?:PrivateKey|PresharedKey)\s*=\s*(\S+)/gim); for (const [, key] of keys) hide(key); } return vpns; } catch (error) { return fail(`VPN config ${error.message} (folder ${VPN_FOLDER}). Nothing was done.`); } } function readSitesFile() { const file = join(HERE, SITES_FILE); if (!existsSync(file)) fail(`${SITES_FILE} not found next to the script: put the sites there. Nothing was done.`); try { const sites = readSites(readText(file)); if (!sites.length) fail(`${SITES_FILE} has no sites. Nothing was done.`); return sites; } catch (error) { return fail(`${SITES_FILE}, ${error.message}. Nothing was done.`); } } async function connectionOf(job, saved) { if (job.vpn) return { type: "vpn", vpn_protocol: VPN_PROTOCOL, conf: job.vpn.conf, syn_mode: VPN_SYN_MODE }; return SAVE_PROXIES ? { uuid: await proxyUuid(job, saved) } : job.proxy; } async function createProfile(job, saved) { const connection = await connectionOf(job, saved); const profile = { title: `checking ${job.number}`, fingerprint: fingerprint(), proxy: connection }; const made = await cloud("POST", "/profiles", profile); if (made.data?.data?.uuid) return made.data.data.uuid; const errors = made.data?.errors ? JSON.stringify(made.data.errors).slice(0, 200) : ""; const why = [made.data?.code, made.data?.msg || made.data?.error, errors].filter(Boolean).join(" "); throw new Error(`could not create a profile (HTTP ${made.status} ${why})`); } async function startProfile(uuid) { const start = { uuid, headless: HEADLESS, debug_port: true, flags: ["--disable-backgrounding-occluded-windows"] }; const started = await local("/profiles/start", start).catch((error) => ({ ok: false, data: { error: error.message }, })); const works = Boolean(started.ok && started.data?.ws_endpoint); if (works) running.add(uuid); return { ...started, works }; } function progress(index, total, site, checked) { const count = `${String(index + 1).padStart(String(total).length)}/${total}`; const reason = /^ok: HTTP [\d?]+$/.test(checked.reason) ? "" : checked.reason; return `${count} ${checked.result.padEnd(11)} ${siteName(site).padEnd(30)} ${reason}`.trimEnd(); } async function visitSites(job, started, name, { sites, puppeteer, stamp }, say) { const entries = []; const ip = printable(started.data.connection_data?.ip || ""); const folder = join(HERE, `screens_${stamp}`, fileName(`${job.number}_${name}`)); if (SCREENSHOTS) mkdirSync(folder, { recursive: true }); let browser; let failures = 0; try { browser = await puppeteer.connect({ browserWSEndpoint: started.data.ws_endpoint, defaultViewport: null, protocolTimeout: BROWSER_TIMEOUT * 1000, }); for (const [index, site] of sites.entries()) { const number = String(index + 1).padStart(String(sites.length).length, "0"); const shot = SCREENSHOTS ? join(folder, `${number}_${fileName(siteName(site))}.png`) : ""; const checked = await checkSite(browser, site, shot); entries.push({ site, ...checked, ip }); say(progress(index, sites.length, site, checked)); failures = checked.reason.startsWith("proxy_error:") ? failures + 1 : 0; const rest = sites.slice(index + 1); if (failures === PROXY_FAILURES && rest.length) { const kind = job.vpn ? "VPN" : "proxy"; const reason = `not checked: the ${kind} stopped working after site ${index + 1}`; say(`the ${kind} stopped working: ${PROXY_FAILURES} proxy errors in a row, ${rest.length} site(s) not checked`); entries.push(...rest.map((left) => ({ site: left, result: "SKIPPED", reason, ip }))); break; } } } catch (error) { say(`stopped after ${entries.length} of ${sites.length} site(s): ${firstLine(error.message)}`); } finally { await browser?.disconnect().catch(() => {}); } return entries; } function startFailure(job, started, sites) { const reason = redact(started.data?.code || started.data?.error || `HTTP ${started.status}`); const dead = /proxy/i.test(reason) || [4, 5].includes(started.data?.error_code); const name = `${dead ? "DEAD" : "ERROR"}_${fileName(job.vpn ? job.vpn.file : job.proxy.host)}`; const problem = dead ? `the ${job.vpn ? "VPN" : "proxy"} does not work` : "could not start the profile"; return { name, message: `${job.label} -> ${name}: ${problem} (${reason})`, entries: sites.map((site) => ({ site, result: dead ? "DEAD" : "ERROR", reason })), }; } async function finishProfile(uuid, name, say) { const renamed = await cloud("PATCH", `/profiles/${uuid}`, { title: name }); if (!renamed.ok) say(`could not rename the profile (HTTP ${renamed.status})`); if (!KEEP_PROFILES) await cloud("DELETE", "/profiles", { uuids: [uuid], skip_trash_bin: false }); } async function checkConnection(job, context) { let tag = `#${job.number}`; const say = (text) => console.log(`[${tag}] ${text}`); const uuid = await createProfile(job, context.saved); say(`${job.label}: starting the profile...`); const started = await startProfile(uuid); let name, entries; if (started.works) { const exit = started.data.connection_data || {}; name = `${await countryOf(exit)}_${printable(exit.ip || "no-ip")}`; tag = `#${job.number} ${name}`; say(`${job.label}: started, ${context.sites.length} site(s) to check`); try { entries = await visitSites(job, started, name, context, say); } finally { await stopProfile(uuid); } } else { if (started.ok || started.status === undefined) await stopProfile(uuid); const failure = startFailure(job, started, context.sites); say(failure.message); ({ name, entries } = failure); } await finishProfile(uuid, name, say); const blank = { profile: name, proxy: `#${job.number} ${job.label}`, ip: "", screenshot: "" }; const rows = entries.map((entry) => ({ ...blank, ...entry })); if (rows.some((entry) => entry.result.endsWith("AVAILABLE"))) say(`done: ${summary(rows, context.sites.length)}`); return { name, rows }; } function reasonsOf(rows) { const reasons = new Map(); for (const entry of rows.filter((row) => row.result === "UNAVAILABLE")) { const reason = entry.reason.split(":")[0]; reasons.set(reason, (reasons.get(reason) || 0) + 1); } return [...reasons] .sort((a, b) => b[1] - a[1]) .map(([reason, times]) => `${times} ${reason}`) .join(", "); } function unchecked(rows, expected) { const skipped = rows.filter((entry) => entry.result === "SKIPPED"); const missed = expected - rows.length; return ( (skipped.length ? `, ${skipped.length} not checked: ${skipped[0].reason.replace(/^not checked: /, "")}` : "") + (missed ? `, ${missed} not checked` : "") ); } function summary(rows, expected) { const count = (result) => rows.filter((entry) => entry.result === result).length; if (count("DEAD")) return "does not work"; if (count("ERROR")) return `not checked: ${rows[0].reason}`; const why = reasonsOf(rows); return ( `${count("AVAILABLE")} AVAILABLE, ${count("UNAVAILABLE")} UNAVAILABLE` + (why ? ` (${why})` : "") + unchecked(rows, expected) ); } async function runAll(jobs, limit, work) { const results = new Array(jobs.length); let next = 0; const worker = async () => { while (next < jobs.length) { const index = next++; const job = jobs[index]; const done = await work(job).catch((error) => { console.log(`[#${job.number}] ${job.label}: ${firstLine(error.message)}`); return { name: "", rows: [] }; }); results[index] = { number: job.number, label: job.label, ...done }; } }; await Promise.all(Array.from({ length: limit }, worker)); return results; } function printTable(sites, results) { const columns = results.filter((column) => column.name); const repeated = (name) => columns.filter((column) => column.name === name).length > 1; const titles = columns.map((column) => (repeated(column.name) ? `${column.name} #${column.number}` : column.name)); const width = Math.max(11, ...titles.map((title) => title.length)) + 2; const siteWidth = Math.max(4, ...sites.map((site) => siteName(site).length)) + 2; console.log("Site".padEnd(siteWidth) + titles.map((title) => title.padEnd(width)).join("")); for (const site of sites) { const cells = columns.map((column) => column.rows.find((entry) => entry.site === site)?.result || "-"); console.log(siteName(site).padEnd(siteWidth) + cells.map((cell) => cell.padEnd(width)).join("")); } console.log(""); columns.forEach((column, index) => console.log(`${titles[index]}: ${summary(column.rows, sites.length)}`)); } const REPORT_COLUMNS = ["profile", "proxy", "site", "result", "reason", "ip"]; function zip(files) { const parts = []; const directory = []; let offset = 0; for (const [name, text] of files) { const title = Buffer.from(name); const data = Buffer.from(text); const local = Buffer.alloc(30); local.writeUInt32LE(0x04034b50, 0); local.writeUInt16LE(20, 4); local.writeUInt16LE(0x0800, 6); local.writeUInt16LE(0x21, 12); local.writeUInt32LE(crc32(data), 14); local.writeUInt32LE(data.length, 18); local.writeUInt32LE(data.length, 22); local.writeUInt16LE(title.length, 26); const central = Buffer.alloc(46); central.writeUInt32LE(0x02014b50, 0); central.writeUInt16LE(20, 4); central.writeUInt16LE(20, 6); local.copy(central, 8, 6, 30); central.writeUInt32LE(offset, 42); parts.push(local, title, data); directory.push(central, title); offset += local.length + title.length + data.length; } const index = Buffer.concat(directory); const end = Buffer.alloc(22); end.writeUInt32LE(0x06054b50, 0); end.writeUInt16LE(files.length, 8); end.writeUInt16LE(files.length, 10); end.writeUInt32LE(index.length, 12); end.writeUInt32LE(offset, 16); return Buffer.concat([...parts, index, end]); } const XLSX_ROW_STYLES = { AVAILABLE: 2, UNAVAILABLE: 3 }; const XLSX_OTHER_STYLE = 4; const XLSX_STYLES = '<fonts count="5"><font><sz val="11"/><name val="Calibri"/></font>' + '<font><b/><sz val="11"/><name val="Calibri"/></font>' + '<font><sz val="11"/><color rgb="FF006100"/><name val="Calibri"/></font>' + '<font><sz val="11"/><color rgb="FF9C0006"/><name val="Calibri"/></font>' + '<font><sz val="11"/><color rgb="FF595959"/><name val="Calibri"/></font></fonts>' + '<fills count="5"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill>' + '<fill><patternFill patternType="solid"><fgColor rgb="FFC6EFCE"/></patternFill></fill>' + '<fill><patternFill patternType="solid"><fgColor rgb="FFFFC7CE"/></patternFill></fill>' + '<fill><patternFill patternType="solid"><fgColor rgb="FFE7E6E6"/></patternFill></fill></fills>' + '<borders count="1"><border/></borders>' + '<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>' + '<cellXfs count="5"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>' + '<xf numFmtId="0" fontId="1" fillId="0" borderId="0" xfId="0" applyFont="1"/>' + '<xf numFmtId="0" fontId="2" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1"/>' + '<xf numFmtId="0" fontId="3" fillId="3" borderId="0" xfId="0" applyFont="1" applyFill="1"/>' + '<xf numFmtId="0" fontId="4" fillId="4" borderId="0" xfId="0" applyFont="1" applyFill="1"/></cellXfs>' + '<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>'; const SUMMARY_COLUMNS = ["profile", "proxy", "AVAILABLE", "UNAVAILABLE", "why unavailable", "ip"]; function summaryRows(results, siteCount) { return results.map((result) => { const count = (word) => result.rows.filter((entry) => entry.result === word).length; const dead = count("DEAD") || count("ERROR"); const note = dead ? summary(result.rows, siteCount) : `${reasonsOf(result.rows)}${unchecked(result.rows, siteCount)}`.replace(/^, /, ""); return { values: [ result.name || "not started", `#${result.number} ${result.label}`, dead || !result.rows.length ? "" : count("AVAILABLE"), dead || !result.rows.length ? "" : count("UNAVAILABLE"), !result.rows.length ? "the profile was not created" : note, result.rows[0]?.ip || "", ], dead: dead || !result.rows.length, }; }); } function xlsxSheet(results, siteCount) { const escapes = { "<": "<", ">": ">", "&": "&" }; const text = (value) => printable(value ?? "") .replace(/[\uFFFE\uFFFF]/g, "") .slice(0, 32000) .replace(/[<>&]/g, (sign) => escapes[sign]); const cell = (column, line, value, style) => { const where = `${String.fromCharCode(65 + column)}${line}`; if (typeof value === "number") return `<c r="${where}" s="${style}"><v>${value}</v></c>`; return `<c r="${where}" t="inlineStr" s="${style}"><is><t xml:space="preserve">${text(value)}</t></is></c>`; }; const line = (values, number, styles) => `<row r="${number}">${values .map((value, column) => cell(column, number, value, Array.isArray(styles) ? styles[column] : styles)) .join("")}</row>`; const rows = results.flatMap((result) => result.rows); const lines = []; const add = (values, styles) => lines.push(line(values, lines.length + 1, styles)); add(["TOTAL", `${siteCount} site(s) through ${results.length} connection(s)`], 1); add(SUMMARY_COLUMNS, 1); for (const { values, dead } of summaryRows(results, siteCount)) { add(values, dead ? XLSX_OTHER_STYLE : [0, 0, XLSX_ROW_STYLES.AVAILABLE, XLSX_ROW_STYLES.UNAVAILABLE, 0, 0]); } lines.push(`<row r="${lines.length + 1}"/>`); const header = lines.length + 1; add(REPORT_COLUMNS, 1); for (const entry of rows) { add( REPORT_COLUMNS.map((column) => entry[column]), XLSX_ROW_STYLES[entry.result] || XLSX_OTHER_STYLE, ); } const widths = REPORT_COLUMNS.map((column, i) => Math.min( 90, Math.max( column.length, SUMMARY_COLUMNS[i].length, ...rows.map((entry) => String(entry[column] ?? "").length), ...summaryRows(results, siteCount).map((row) => String(row.values[i] ?? "").length), ) + 2, ), ); const last = `${String.fromCharCode(64 + REPORT_COLUMNS.length)}${lines.length}`; return ( `<cols>${widths.map((width, i) => `<col min="${i + 1}" max="${i + 1}" width="${width}" customWidth="1"/>`).join("")}</cols>` + `<sheetData>${lines.join("")}</sheetData><autoFilter ref="A${header}:${last}"/>` ); } function writeXlsx(results, siteCount, stamp) { const head = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'; const main = "http://schemas.openxmlformats.org/spreadsheetml/2006/main"; const office = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"; const packageRels = "http://schemas.openxmlformats.org/package/2006/relationships"; const type = "application/vnd.openxmlformats-officedocument.spreadsheetml"; const file = join(HERE, `site_access_${stamp}.xlsx`); const files = [ [ "[Content_Types].xml", `${head}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">` + '<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>' + '<Default Extension="xml" ContentType="application/xml"/>' + `<Override PartName="/xl/workbook.xml" ContentType="${type}.sheet.main+xml"/>` + `<Override PartName="/xl/worksheets/sheet1.xml" ContentType="${type}.worksheet+xml"/>` + `<Override PartName="/xl/styles.xml" ContentType="${type}.styles+xml"/></Types>`, ], [ "_rels/.rels", `${head}<Relationships xmlns="${packageRels}">` + `<Relationship Id="rId1" Type="${office}/officeDocument" Target="xl/workbook.xml"/></Relationships>`, ], [ "xl/workbook.xml", `${head}<workbook xmlns="${main}" xmlns:r="${office}">` + '<sheets><sheet name="Report" sheetId="1" r:id="rId1"/></sheets></workbook>', ], [ "xl/_rels/workbook.xml.rels", `${head}<Relationships xmlns="${packageRels}">` + `<Relationship Id="rId1" Type="${office}/worksheet" Target="worksheets/sheet1.xml"/>` + `<Relationship Id="rId2" Type="${office}/styles" Target="styles.xml"/></Relationships>`, ], ["xl/styles.xml", `${head}<styleSheet xmlns="${main}">${XLSX_STYLES}</styleSheet>`], ["xl/worksheets/sheet1.xml", `${head}<worksheet xmlns="${main}">${xlsxSheet(results, siteCount)}</worksheet>`], ]; writeFileSync(file, zip(files)); return file; } async function main() { checkSettings(); token = readToken(); hide(token); const proxies = readProxies(); const vpns = readVpns(); if (!proxies.length && !vpns.length) { fail( `Nothing to check: put proxies into ${PROXY_FILE || "PROXIES"} or WireGuard configs into ${VPN_FOLDER}. Nothing was done.`, ); } const sites = readSitesFile(); const puppeteer = await import("puppeteer-core").then( (module) => module.default, () => fail("Puppeteer is not installed: run npm install puppeteer-core in this folder."), ); await local("/profiles/active").catch(() => fail(`The Octo client is not running, or its local port is not ${LOCAL_PORT}: set LOCAL_PORT. Nothing was done.`), ); if (OS === "android") await loadAndroidModels(); const list = SAVE_PROXIES && proxies.length ? await cloud("GET", "/proxies") : { ok: true }; if (!list.ok) fail(`Could not read the saved proxies: HTTP ${list.status}. Nothing was done.`); const saved = Array.isArray(list.data?.data) ? list.data.data : []; const jobs = [ ...proxies.map((proxy) => ({ proxy, label: proxyLabel(proxy) })), ...vpns.map((vpn) => ({ vpn, label: `VPN ${vpn.file}` })), ].map((job, index) => ({ ...job, number: index + 1 })); const workers = Math.min(PARALLEL, jobs.length); const stamp = localStamp(); console.log( `Checking ${sites.length} site(s) through ${proxies.length} proxy(ies) and ${vpns.length} VPN config(s), ` + `one ${OS_NAMES[OS]} profile each, ${HEADLESS ? "without a window" : "in a window"}, ${workers} at a time.\n`, ); const results = await runAll(jobs, workers, (job) => checkConnection(job, { sites, puppeteer, saved, stamp })); const rows = results.flatMap((result) => result.rows); console.log(""); printTable(sites, results); console.log(`\nReport: ${writeXlsx(results, sites.length, stamp)}`); if (rows.some((entry) => entry.screenshot)) console.log(`Screenshots: ${join(HERE, `screens_${stamp}`)}`); const left = limits ? ` Left: ${limits.minute}${limits.minuteLimit ? ` of ${limits.minuteLimit}` : ""} this minute, ` + `${limits.hour}${limits.hourLimit ? ` of ${limits.hourLimit}` : ""} this hour.` : ""; console.log(`${spent} request(s) counted by Octo's rate limits.${left}`); } main().catch((error) => fail(`Stopped: ${firstLine(error.message || error)}`));
Step 4. Create a list of websites
Create a file by running notepad sites.txt. Follow these rules:
Put each address on a new line.
You can include the
https://prefix or leave it out.Start comment lines with
#. Comments are useful for dividing the list into groups.
# Search and reference sites google.com wikipedia.org # Online stores amazon.com ebay.com
Step 5. Add proxies and VPNs
The script needs at least one connection to work: either a proxy or a VPN configuration. You can also configure both types of connection.
Proxies. Create a file by running notepad proxies.txt and add your proxies, one per line. The script accepts the same protocols and line formats as bulk proxy import in Octo Browser. Supported protocols: http, https, socks5, and ssh. Supported formats:
protocol://ip:port protocol://login:password:ip:port protocol://login:password@ip:port protocol://ip:port:login:password
IPv6 addresses must be enclosed in square brackets: socks5://[2001:db8::1]:1080:login:password. You can also omit the protocol from a line; in that case, the type specified in DEFAULT_TYPE is used. Lines starting with # are skipped.
VPNs. Put your WireGuard configuration files in the config folder. The filename can be anything: the script identifies a config by its contents, specifically the [Interface] and [Peer] sections. The config isn't added to the Octo proxy list; it exists only inside its own profile.
[Interface] PrivateKey = <client key> Address = 10.0.0.2/32 DNS = 1.1.1.1 [Peer] PublicKey = <server key>
Before running, the script checks each config for PrivateKey, Address, PublicKey, and Endpoint, and verifies that Endpoint is written as an address and port, without http://. If the script finds an error, it displays the filename and a description of the issue, then exits without creating any profiles.
Your folder structure should look like this:
D:\proxy_check\ site_access.mjs script sites.txt website list proxies.txt proxy list config\ VPN configs
Step 6. Run the check
Open Octo Browser and run the script from its folder:
cd D:\proxy_check node site_access.mjs
For the first run, use one proxy and three or four websites. You'll be able to see the websites opening in the profile window. Once you've confirmed that everything works, add the rest.
When the script starts, it checks everything that could prevent it from running: the token, files, VPN configurations, and whether Octo is open. If it finds an error, it displays a message describing the issue and exits without creating profiles. The check then begins, and the result for each website is displayed as soon as it's available.

The square brackets show the connection number, its profile name, and the website counter. When several connections are checked in parallel, their output lines may be interleaved. Use the label to see which connection each line belongs to. No proxy password is shown in the output, and only the last few characters of the username are displayed. To stop the check, press Ctrl+C. The script will stop the profiles it has already launched.
How to read the results
At the end, the script prints a table and a summary for each connection:

AVAILABLE means the website opened successfully and displayed content. UNAVAILABLE means it didn't open. The reasons in parentheses after the final result are listed in descending order of frequency. DEAD in a column name means the connection itself isn't working, not that all the websites being checked are unavailable.
The ERROR label means the profile failed to launch for a reason unrelated to the connection. The Octo error message appears on that connection's line in the console and in the report.
The output files are saved in the folder. The timestamps in their names use local time:
site_access_<time>.xlsx— an Excel report. The top section contains a summary showing the total number of websites and, for each connection, how many websites are accessible, how many are inaccessible, and the reasons. Below that is the detailed check, with one row per result: profile, connection, website, result, reason, and IP. Rows for accessible websites are green; inaccessible ones are red. Gray rows indicate a non-working connection and websites that weren't checked because the proxy stopped working.screens_<time>— screenshots of failure pages, with a separate folder for each connection and screenshots numbered in the order of the website list. If the website didn't respond or the proxy itself couldn't establish a connection, there's nothing to capture, so no screenshot is saved.
The profiles remain in Octo Browser and are named by country and IP.
Let's look at some possible issues:
What you see in the report | What it means | What to do |
|---|---|---|
The connection is marked | The connection itself isn't working. | Check the proxy username, password, and type, or the VPN configuration details. |
The connection is marked | The profile failed to launch, but the problem isn't the connection. | Read the error in the report or console, fix the cause, and run the check again. |
Several | The proxy stopped working during the check: its traffic ran out or its session expired. | Check the proxy and run the check again. |
One connection has many | The proxy provider has blocked those websites. | Ask your provider which website categories are blocked on your plan. |
One connection gets | The website doesn't trust this IP address or its subnet. | Change the IP or use a different type of proxy. |
| The website isn't available in the exit country. | Use a proxy from another country. |
| The website itself isn't responding. | Try the check again later. |
| The connection is slow or keeps dropping. | Replace the connection. |
| Too many requests are coming from the same IP. | Wait and lower |
What the reasons mean
The server response code isn't reliable in this case. A denial doesn't always come with an error: Akamai may return “Access Denied” with a 200 status code, an AWS WAF check may return 202, and a DataDome block may return 401. That's why the script reads the page itself. Large websites rarely create denial pages from scratch: one of the known security systems displays the block page, and each has its own signature in the headers and text.
Reason in the report | What happened | How it's identified |
|---|---|---|
| The proxy couldn't establish a connection to this website. | A tunnel or SOCKS error in the browser. This is what a website blocked by the proxy provider looks like. |
| The proxy itself isn't working. | The proxy doesn't respond or didn't accept the username and password; status code 407. |
| The website denied access to this IP. | Cloudflare 1005–1008, 1010, 1012, 1020, and “Sorry, you have been blocked”; Akamai “Access Denied”; Imperva, Sucuri, F5, Wordfence, AWS WAF, DataDome; status codes 401, 403, and 406; or a message saying the website has detected a proxy or VPN. |
| The website requires an “Are you human?” check. | Cloudflare “Just a moment” and Turnstile; PerimeterX “Press & Hold”; CAPTCHA pages from DataDome, Akamai, AWS WAF, Kasada, Radware, DDoS-Guard, and Vercel; Google's “unusual traffic” message; Amazon CAPTCHA; reCAPTCHA; hCaptcha. |
| The website is unavailable in the connection's country. | Cloudflare 1009, status code 451, a country-based CloudFront denial, phrases such as “not available in your country,” or a redirect to an address such as |
| Too many requests came from this IP. | Status code 429 or Cloudflare 1015. |
| The website didn't respond in time. | No response arrived within the allotted time, or the website started responding and then froze. |
| The connection was interrupted or rejected. | The connection was interrupted, empty response, or connection refusal before the page loaded. |
| The website address couldn't be found. | A DNS error. |
| A secure connection couldn't be established. | A certificate or TLS error: the certificate was issued for a different address, has expired, or was replaced along the way. |
| The website sent the browser to an unrelated address. | The final address belongs to another website, which displays a short page or a denial. |
| The website keeps redirecting in a loop. | The browser stopped the redirect chain. |
| The page remained blank. | Nothing appeared on it within 10 seconds. |
| The page stopped responding. | The page opened, but the browser couldn't read it for 30 seconds because a script on it had frozen. |
| The website returned an error. | A 4xx status code, such as 404. |
| The website itself is broken; the connection isn't the problem. | A 5xx status code with no signs of security protection. |
| Another network error occurred. | The browser error code is included in the reason. |
The reasons fall into three groups. proxy_refused and proxy_error mean the connection failed: the request never reached the website. blocked, challenge, geo_blocked, and rate_limited mean the proxy let the request through, but the website denied access. timeout, connection_reset, dns_error, and ssl_error mean no response came back at all: the cause could be the proxy, the website, or the network between them.
How the script avoids false results
Mistakes can happen in either direction: a temporary failure can be mistaken for a block, or a blank page can be mistaken for a successfully opened website. Here's how the script handles ambiguous cases:
Situation | What the script does |
|---|---|
The connection drops, times out, or the proxy refuses the request. | It retries and waits up to 20 seconds for a response. |
The website displays the “Just a moment” check. | It waits up to 15 seconds: this check often clears automatically for an ordinary visitor. If it clears, the result is |
The page takes time to render its scripts. | It waits up to 10 seconds for content to appear. |
The website starts responding and then freezes. | It records a separate |
The website opens an | It dismisses the dialog by canceling it; otherwise, the page can't continue. The script then resumes the check. |
A script on the page freezes. | After 30 seconds, it assigns the |
The website redirects to its local country version, such as | It's the same website: the result is |
The website redirects to another domain, where a regular page loads. | The result is |
The website redirects to an unrelated short page or a denial page. | The result is |
The page contains an anti-bot script, but the website opens. | The presence of protection isn't treated as a denial. Only the denial page itself counts. |
The words “access denied” appear in the text of a regular article. | Denial phrases are checked in the page title and on short pages, but not in the middle of long text. |
Conclusion
The script automates website availability checks through proxies and VPNs. It shows which websites open through each connection and helps identify why the others are unavailable. Create your website list once, then run the check whenever you buy new proxies, switch providers, or run into website access issues. This way, you won't have to test each connection manually.
Frequently asked questions
How many connections can be checked at once?
Each profile is a separate browser, so the limit depends on your memory and CPU. On an average device, three to five is a reasonable number; set this with the PARALLEL setting. If all your proxies use the same provider gateway, don't set the number too high: your provider account may limit simultaneous connections.
How long does a check take?
A website that opens takes a few seconds. Websites that don't respond take the longest: the script waits 45 seconds and then retries for another 20. Connections are checked in parallel, so checking five proxies takes about as long as checking one.
Why are all websites for a connection marked DEAD?
Octo couldn't launch a profile with that proxy or VPN: the connection isn't working. Check the proxy username and password, the protocol, and the VPN config details. If the label is ERROR instead of DEAD, the profile failed to launch for another reason unrelated to the connection. That reason is shown on the connection's line.
A website is marked challenge, but it opens manually. Why?
The “Are you human?” check didn't clear automatically within 15 seconds. You can complete it manually with a click, but the script doesn't click anything. The wait time is controlled by the CHECK_WAIT setting.
Why do the results differ between runs?
Most often, the proxy has changed its IP address. Rotating proxies use different IPs between connections, and the website may treat the new address differently. With some providers, the list of blocked websites also depends on the exit node: a bank may open through one IP, while the provider blocks it through another. Another reason may be the website's own rate limits: after too many requests, it starts returning status code 429 or displaying a check.
The profile won't launch even though Octo is open. What should I do?
Check the local API port: open the browser settings, go to the Additional tab, and look at Local HTTP Server. If the port isn't 58888, enter the correct value in the LOCAL_PORT setting.
The script can't find my VPN configuration file. Why?
The configuration file must be in the config folder next to the script and contain the [Interface] and [Peer] sections. The script skips files without these sections and lists them at the beginning of its output.
What happens if a proxy stops working during the check?
This can happen when a proxy session expires or runs out of traffic: the proxy stops responding or accepting the login. After three consecutive errors from the proxy itself, the script stops checking websites through that connection so it doesn't waste time on the remaining sites. They're marked gray and SKIPPED in the report, and the summary shows after which website the proxy stopped working. The other connections continue to be checked as usual. Provider denials for individual websites (proxy_refused) don't count: the proxy is still working in that case.
What remains in Octo after the check?
Profiles named by country and IP, and any new proxies in the proxy list. To leave nothing behind, set KEEP_PROFILES = false and SAVE_PROXIES = false: the profiles will be moved to the trash, and the proxies won't be added to the list.
Does the script send my data anywhere other than Octo?
The script sends the token only to the Octo API address. It makes one request to a third-party service: if Octo doesn't report the exit country, the script looks it up by IP using GeoJS. Only the proxy's exit IP is sent to GeoJS.
Stay up to date with the latest Octo Browser news
By clicking the button you agree to our Privacy Policy.
Stay up to date with the latest Octo Browser news
By clicking the button you agree to our Privacy Policy.
Stay up to date with the latest Octo Browser news
By clicking the button you agree to our Privacy Policy.

Join Octo Browser now
Or contact Customer Service at any time with any questions you might have.

Join Octo Browser now
Or contact Customer Service at any time with any questions you might have.
Join Octo Browser now
Or contact Customer Service at any time with any questions you might have.