מה הבודק יודע לעשות
proxy-probe.mjs לוקח רשימה מקישור או מקובץ ודרך כל שורה מבקש עמוד judge, כלומר אתר שמחזיר את הכותרות של הבקשה שקיבל. התשובה נותנת שלוש עובדות על הפרוקסי: אם הוא עובד, כמה זמן נמשכה הבקשה ואיזה IP האתר ראה.
- פורמטים של שורות:
ip:port,host:port:login:passwordו-login:password@host:port. הקידומתhttp://אוsocks5://קובעת את הפרוטוקול של שורה בודדת. - סיסמה עם נקודתיים או @ מפוענחת נכון. הסקריפט מסיר כפילויות ומדלג על שורות ריקות ושורות שלא בפורמט.
- הסקריפט בודק 150 פרוקסי בו זמנית ומחכה לכל אחד 8 שניות לכל היותר, כך שאלף שורות נכנסות בדקה. שני המספרים משתנים בפרמטרים.
- כל פרוקסי שעובד מקבל ציון אנונימיות: high, medium או none.
- פרוקסי שענה אבל דחה את שם המשתמש או הסיסמה נכנס למונה נפרד ולא למתים.
- השורות שעובדות נשמרות ב-
alive.txtבצורתן המקורית, מהמהירה לאיטית, והקובץ מתאים מיד לתוכנה. הפרמטר--csvמוסיף דוח עם זמן תגובה, כתובת יציאה ואנונימיות.
צריך Node.js 18 או חדש יותר. אין חבילות חיצוניות, רק מודולים מובנים, וכל הקוד בקובץ אחד. הרשימה לא יוצאת לשום מקום: הסקריפט מתחבר רק לפרוקסי מהרשימה ולעמוד judge.
הורדה והרצה בפקודה אחת
קישור ישיר לקובץ:
הורדה proxy-probe.mjshttps://proxymix.net/res/files/proxy-probe.mjs
Linux ו-macOS: הפקודה מורידה את הקובץ לתיקייה הנוכחית ומיד מתחילה את הבדיקה.
wget -qO proxy-probe.mjs https://proxymix.net/res/files/proxy-probe.mjs && node proxy-probe.mjs list.txtאותו דבר דרך curl, אם בשרת אין wget:
curl -fsSLo proxy-probe.mjs https://proxymix.net/res/files/proxy-probe.mjs && node proxy-probe.mjs list.txtבלי לשמור קובץ: curl מעביר את הסקריפט ישירות ל-Node, והארגומנטים באים אחרי המקף.
curl -fsSL https://proxymix.net/res/files/proxy-probe.mjs | node --input-type=module - list.txtבמקום list.txt שימו את הקובץ שלכם או קישור לרשימה.
דרכי הרצה
חבילה ללא הגבלה: קישור לרשימת ip:port מלוח הבקרה, בלי .csv בסוף, כי הבודק לא קורא את הטבלה. שמרו את --parallel מתחת למספר התהליכונים של החבילה, אחרת חיבורים עודפים יידחו ושורות טובות ייחשבו מתות.
node proxy-probe.mjs "https://YOUR_LIST_LINK" --parallel 100מסלולים לפי GB: קובץ עם שורות host:port:login:password. שורות SOCKS5 בדקו עם --kind socks5.
node proxy-probe.mjs http-lines.txt
node proxy-probe.mjs socks-lines.txt --kind socks5פרוקסי חינם: ברשימה ארוכה יש הרבה שורות מתות. העלו את ההקבלה, קצרו את ההמתנה והשאירו מהדוח רק את הציון high.
node proxy-probe.mjs free.txt --parallel 400 --wait 4 --csv report.csv
grep ',high$' report.csv | cut -d, -f1 > high.txtדוח לגיליון: CSV נפתח ב-Excel וב-Google Sheets, עם העמודות proxy, ms, exit_ip, anonymity.
node proxy-probe.mjs list.txt --output ok.txt --csv report.csvעמוד judge משלכם, אם httpbin.org עונה לאט או סגור ברשת שלכם. מתאימה כל כתובת http רגילה שמדפיסה את כותרות הבקשה.
node proxy-probe.mjs list.txt --judge http://YOUR_SERVER/headersמה הסקריפט מדפיס
התקדמות הבדיקה עוברת ל-stderr בשורה אחת שמתעדכנת. ב-stdout הסקריפט מדפיס את 15 הפרוקסי המהירים עם זמן תגובה, כתובת יציאה וציון, ובשורה האחרונה את מספר אלה שעובדים. כך נראית בדיקה של 38 פרוקסי SOCKS5 בחינם, כשהכתובות הוחלפו בדוגמאות:
$ node proxy-probe.mjs socks.txt --kind socks5 --csv report.csv
checking 38 proxies, 150 at a time, via httpbin.org
38/38 checked, 25 alive
198.51.100.17:1088 3497 ms 203.0.113.40 high
192.0.2.63:10461 3667 ms 198.51.100.86 high
203.0.113.109:13391 3844 ms 192.0.2.132 high
198.51.100.155:38182 3954 ms 198.51.100.155 high
203.0.113.178:80 4170 ms 203.0.113.178 high
192.0.2.201:16209 4240 ms 198.51.100.224 high
203.0.113.247:1080 4327 ms 203.0.113.247 high
192.0.2.20:1080 4340 ms 198.51.100.43 high
203.0.113.66:1026 4494 ms 192.0.2.89 high
203.0.113.66:1059 4572 ms 192.0.2.89 high
203.0.113.66:1045 4654 ms 192.0.2.89 high
203.0.113.66:1087 4666 ms 198.51.100.112 high
203.0.113.66:1099 4752 ms 198.51.100.112 high
203.0.113.135:10800 4786 ms 203.0.113.135 high
192.0.2.158:1080 4917 ms 192.0.2.158 high
25 of 38 alive, saved to alive.txtב-alive.txt השורות נשארות בצורה שבה הגיעו ברשימה. דוח ה-CSV מוסיף להן את המדידות:
$ head -3 alive.txt
198.51.100.17:1088
192.0.2.63:10461
203.0.113.109:13391
$ head -4 report.csv
proxy,ms,exit_ip,anonymity
198.51.100.17:1088,3497,203.0.113.40,high
192.0.2.63:10461,3667,198.51.100.86,high
203.0.113.109:13391,3844,192.0.2.132,highהתקנת Node.js בשרת נקי
קודם בדקו את הגרסה בפקודה node -v: מתאימה v18 ומעלה. אם אין Node או שהוא ישן, התקינו אותו למערכת שלכם. הפקודות למטה רצות כ-root, ומשתמש רגיל צריך sudo לפני apt, dnf ו-bash.
Debian 12 ו-Ubuntu 24.04: מתאים Node מהמאגר הרגיל.
apt update && apt install -y nodejs
node -vUbuntu 20.04 ו-22.04, Debian 11 ומערכות שבמאגר שלהן Node ישן מ-18: ה-LTS העדכני ממאגר NodeSource.
apt update && apt install -y curl
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt install -y nodejs
node -vAlmaLinux, Rocky Linux ו-CentOS Stream:
curl -fsSL https://rpm.nodesource.com/setup_22.x | bash -
dnf install -y nodejs
node -vהרצה ב-Windows
התקינו Node.js LTS דרך winget, שמובנה ב-Windows 10 ו-11. אחרי ההתקנה פתחו חלון טרמינל חדש כדי ש-PATH יתעדכן.
winget install OpenJS.NodeJS.LTSהורדת הסקריפט והפעלת הבדיקה ב-PowerShell:
iwr https://proxymix.net/res/files/proxy-probe.mjs -OutFile proxy-probe.mjs -UseBasicParsing; node proxy-probe.mjs list.txtבשורת הפקודה cmd עובד ה-curl המובנה:
curl -fsSLo proxy-probe.mjs https://proxymix.net/res/files/proxy-probe.mjs && node proxy-probe.mjs list.txtשימו את הרשימה באותה תיקייה או ציינו נתיב מלא במירכאות: node proxy-probe.mjs "C:\proxy\list.txt". הקובץ alive.txt יופיע בתיקייה שממנה הרצתם את הפקודה.
בדיקה לפי לוח זמנים
כדי שהתוכנה תיקח תמיד פרוקסי חיים, הריצו את הבודק בטיימר ושמרו את התוצאה בקובץ קבוע אחד. הסקריפט כותב את הרשימה החדשה ל-fresh.txt זמני, ואז פקודה אחת מחליפה בו את alive.txt, כך שהתוכנה לא תיתקל בקובץ באמצע כתיבה. אם אף פרוקסי לא נשאר, הסקריפט יסתיים בקוד 1 וב-alive.txt תישאר הרשימה הקודמת.
Linux: שימו את הסקריפט בתיקייה נפרדת ופתחו את המתזמן cron.
mkdir -p /opt/probe && cd /opt/probe
wget -qO proxy-probe.mjs https://proxymix.net/res/files/proxy-probe.mjs
crontab -eהוסיפו את השורה: בדיקה כל 20 דקות, flock לא יפעיל עותק שני כל עוד הראשון רץ, והיומן נכתב ל-probe.log.
*/20 * * * * cd /opt/probe && flock -n probe.lock node proxy-probe.mjs "https://YOUR_LIST_LINK" --output fresh.txt >> probe.log 2>&1 && mv fresh.txt alive.txtWindows: צרו את התיקייה C:\probe ושימו בה את הסקריפט וקובץ run.cmd עם שתי שורות:
cd /d C:\probe
node proxy-probe.mjs "https://YOUR_LIST_LINK" --output fresh.txt >> probe.log 2>&1 && move /y fresh.txt alive.txtפקודה אחת יוצרת משימה כל 20 דקות:
schtasks /create /tn "proxy-probe" /tr "C:\probe\run.cmd" /sc minute /mo 20משימה כזו פועלת כל עוד אתם מחוברים. כדי שתרוץ גם בלי כניסה, הריצו את הפקודה כמנהל עם המפתח /ru SYSTEM. הסימן % בקישור לרשימה בתוך run.cmd נכתב פעמיים: %%.
בתוכנה ציינו את alive.txt כקובץ פרוקסי: /opt/probe/alive.txt ב-Linux, C:\probe\alive.txt ב-Windows. אם התוכנה יודעת לקרוא מחדש את הקובץ בטיימר, הפעילו את זה, ושורות חדשות ייכנסו בלי הפעלה מחדש.
איך מחושבת האנונימיות
לפני הבדיקה הסקריפט פונה ל-judge ישירות וזוכר את הכתובת שלכם. אחר כך הוא משווה אליה כל תשובה:
- high: ה-judge לא ראה לא את הכתובת שלכם ולא כותרות פרוקסי כמו Via או X-Forwarded-For;
- medium: הכתובת שלכם מוסתרת, אבל הפרוקסי הסגיר את עצמו בכותרות;
- none: הכתובת האמיתית שלכם הגיעה ל-judge, והפרוקסי רק מעביר תעבורה.
רשימות ProxyMix
שורות של מסלולים לפי GB נראות כך: host:port:login:password. שם המשתמש כבר בשורה, והבודק יעביר אותו לפרוקסי בעצמו. בדקו כל שורה של המסלולים האלה בפרוטוקול שעבורו היא נוצרה.
לבודק קחו את קישור החבילה בלי .csv בסוף: לא צריך שם משתמש, והבודק לא קורא את הטבלה. הגישה פתוחה ל-IP שהוספתם בלוח הבקרה, לכן הריצו את הבודק מהשרת הזה. פורט אחד מקבל HTTP, HTTPS, SOCKS4 ו-SOCKS5: בדקו בפרוטוקול שהתוכנה שלכם משתמשת בו.
שורות שנבדקו מ-alive.txt נטענות ישירות ל-ScrapeBox, ל-Key Collector או לקוד ב-Python.
קודי יציאה והודעות
- קוד 0: לפחות פרוקסי אחד עובד. קוד 1: אף אחד לא עובד, או שברשימה אין שורות פרוקסי.
- קוד 2: פרמטר שגוי, הסקריפט מדפיס עזרה.
- "judge did not answer directly": עמוד ה-judge לא זמין או חסום למכונה שלכם. בחרו אחר, אחרת פרוקסי שקופים יעברו בלי שיורגשו.
- "N of M lines with credentials were rejected": הפרוקסי האלה ענו אבל דחו את שם המשתמש או הסיסמה. הם לא נחשבים מתים. בדקו את פרטי הגישה בלוח של הספק.
קוד הסקריפט
הקוד פתוח כולו, קראו אותו לפני שמריצים בשרת שלכם.
הצגת הקוד של proxy-probe.mjs
import net from 'node:net';
import { readFile, writeFile } from 'node:fs/promises';
const settings = {
parallel: 150,
kind: 'http',
wait: 8,
judge: 'http://httpbin.org/get',
output: 'alive.txt',
csv: '',
};
const help = `usage: node proxy-probe.mjs <list-url-or-file> [options]
list lines ip:port, host:port:login:password or login:password@host:port;
start a line with socks5:// or http:// to set its protocol,
colons and @ signs inside a password are fine
--parallel N proxies checked at the same time (150)
--kind K http or socks5 (http)
--wait S seconds per proxy (8)
--judge URL plain http page that echoes request headers (http://httpbin.org/get)
--output FILE working proxies, fastest first (alive.txt)
--csv FILE extra report: proxy, ms, exit ip, anonymity`;
const args = process.argv.slice(2);
const source = args.find((a, i) => !a.startsWith('--') && !(args[i - 1] || '').startsWith('--'));
for (let i = 0; i < args.length; i++) {
const name = args[i].startsWith('--') ? args[i].slice(2) : '';
if (name === 'help') {
console.log(help);
process.exit(0);
}
if (name in settings) settings[name] = typeof settings[name] === 'number' ? Number(args[++i]) : args[++i];
}
if (!source || !['http', 'socks5'].includes(settings.kind) || !(settings.parallel > 0) || !(settings.wait > 0)) {
console.error(help);
process.exit(2);
}
const judge = new URL(settings.judge);
const judgePort = Number(judge.port || 80);
const leakHeaders = /\b(via|x-forwarded-for|forwarded|x-real-ip|client-ip|x-proxy-id)\b/i;
const ipv4 = /\b(?:\d{1,3}\.){3}\d{1,3}\b/g;
const scrub = (text) => text.split(judge.hostname).join('');
const protoPrefix = /^(http|socks5h?):\/\/(.+)$/i;
const plausible = (host) => host === 'localhost' || /^[\w-]+(\.[\w-]+)+$/.test(host);
const validPort = (port) => /^\d{1,5}$/.test(port) && Number(port) > 0 && Number(port) < 65536;
const keyed = (item) => item.login !== undefined;
const label = (item) => (keyed(item) ? `${item.login}@${item.host}:${item.port}` : item.text);
const cell = (value) => (/[",\r\n]/.test(value) ? `"${value.replace(/"/g, '""')}"` : value);
const rejected = () => Object.assign(new Error('credentials rejected'), { rejected: true });
function decode(raw) {
const text = raw.trim();
const tagged = text.match(protoPrefix);
const body = tagged ? tagged[2].replace(/\/+$/, '') : text;
const kind = tagged ? (tagged[1].toLowerCase() === 'http' ? 'http' : 'socks5') : '';
const guesses = [];
const colonForm = body.match(/^([^:@]+):(\d+):([^:]*):(.*)$/);
if (colonForm) guesses.push({ host: colonForm[1], port: colonForm[2], login: colonForm[3], password: colonForm[4] });
const atForm = body.match(/^([^:]*)(?::(.*))?@([^:@]+):(\d+)$/);
if (atForm) guesses.push({ host: atForm[3], port: atForm[4], login: atForm[1], password: atForm[2] ?? '' });
const usable = guesses.filter((g) => validPort(g.port));
const best = usable.find((g) => plausible(g.host)) || usable[0];
if (best) return { text, kind, ...best, port: Number(best.port) };
if (tagged) {
const bare = body.match(/^([^:@/]+):(\d+)$/);
return bare && validPort(bare[2]) ? { text, kind, host: bare[1], port: Number(bare[2]) } : null;
}
const [host, port] = text.split(':');
return host && /^\d+$/.test(port || '') ? { text: `${host}:${port}`, kind, host, port: Number(port) } : null;
}
async function loadLines(from) {
const text = /^https?:\/\//.test(from) ? await (await fetch(from)).text() : await readFile(from, 'utf8');
const seen = new Map();
for (const raw of text.split(/\r?\n/)) {
const item = decode(raw);
if (item && !seen.has(item.text)) seen.set(item.text, item);
}
return [...seen.values()];
}
function talk(host, port) {
const sock = net.connect({ host, port: Number(port) });
let buffered = Buffer.alloc(0);
let waiter = null;
let ended = false;
const wake = () => waiter && waiter();
sock.on('data', (chunk) => { buffered = Buffer.concat([buffered, chunk]); wake(); });
sock.on('end', () => { ended = true; wake(); });
sock.on('error', () => { ended = true; wake(); });
sock.on('close', () => { ended = true; wake(); });
const take = (count) => new Promise((resolve, reject) => {
const check = () => {
if (buffered.length >= count) {
const part = buffered.subarray(0, count);
buffered = buffered.subarray(count);
waiter = null;
resolve(part);
} else if (ended) {
waiter = null;
reject(new Error('closed'));
}
};
waiter = check;
check();
});
const rest = () => new Promise((resolve) => {
const check = () => { if (ended) resolve(buffered.toString('latin1')); };
waiter = check;
check();
});
const ready = new Promise((resolve, reject) => {
sock.once('connect', resolve);
sock.once('error', reject);
sock.once('close', () => reject(new Error('closed')));
});
return { sock, take, rest, ready };
}
async function socksOpen(link, item) {
const withLogin = keyed(item);
link.sock.write(Buffer.from([5, 1, withLogin ? 2 : 0]));
const hello = await link.take(2);
if (hello[0] !== 5) throw new Error('socks reply');
if (withLogin && hello[1] === 255) throw rejected();
if (withLogin && hello[1] === 2) {
const user = Buffer.from(item.login);
const secret = Buffer.from(item.password);
if (!user.length || user.length > 255 || secret.length > 255) throw rejected();
link.sock.write(Buffer.concat([Buffer.from([1, user.length]), user, Buffer.from([secret.length]), secret]));
const ack = await link.take(2);
if (ack[1] !== 0) throw rejected();
} else if (hello[1] !== 0) {
throw new Error('socks auth');
}
const name = Buffer.from(judge.hostname);
link.sock.write(Buffer.concat([Buffer.from([5, 1, 0, 3, name.length]), name, Buffer.from([judgePort >> 8, judgePort & 255])]));
const head = await link.take(4);
if (head[1] !== 0) throw new Error('socks refused');
const tail = head[3] === 1 ? 6 : head[3] === 4 ? 18 : (await link.take(1))[0] + 2;
await link.take(tail);
}
async function probe(item) {
const kind = item.kind || settings.kind;
const started = performance.now();
const link = talk(item.host, item.port);
const timer = setTimeout(() => link.sock.destroy(), settings.wait * 1000);
try {
await link.ready;
if (kind === 'socks5') await socksOpen(link, item);
const target = kind === 'socks5' ? judge.pathname + judge.search : judge.href;
const pass = kind === 'http' && keyed(item)
? `Proxy-Authorization: Basic ${Buffer.from(`${item.login}:${item.password}`).toString('base64')}\r\n`
: '';
link.sock.write(`GET ${target} HTTP/1.1\r\nHost: ${judge.host}\r\nUser-Agent: proxy-probe\r\nAccept: */*\r\n${pass}Connection: close\r\n\r\n`);
const answer = await link.rest();
const [head, ...bodyParts] = answer.split('\r\n\r\n');
if (pass && /^HTTP\/1\.[01] 407/.test(head)) return { item, rejected: true };
if (!/^HTTP\/1\.[01] 200/.test(head)) return null;
const body = bodyParts.join('\r\n\r\n');
return { item, ms: Math.round(performance.now() - started), body };
} catch (err) {
return err.rejected ? { item, rejected: true } : null;
} finally {
clearTimeout(timer);
link.sock.destroy();
}
}
function grade(body, myIp) {
const text = scrub(body);
if (myIp && text.includes(myIp)) return 'none';
return leakHeaders.test(text) ? 'medium' : 'high';
}
let myIp = '';
try {
myIp = (scrub(await (await fetch(judge.href, { signal: AbortSignal.timeout(10000) })).text()).match(ipv4) || [''])[0];
} catch {
console.error('judge did not answer directly, anonymity will not detect transparent proxies');
}
const entries = await loadLines(source);
if (!entries.length) {
console.error('no proxy lines found in', source);
process.exit(1);
}
const withCredentials = entries.filter(keyed).length;
console.error(`checking ${entries.length} proxies${withCredentials ? ` (${withCredentials} with credentials)` : ''}, ${settings.parallel} at a time, via ${judge.host}`);
const alive = [];
const turnedAway = [];
let cursor = 0;
let done = 0;
let lastShown = 0;
const lane = async () => {
while (cursor < entries.length) {
const hit = await probe(entries[cursor++]);
done++;
if (hit && hit.rejected) {
turnedAway.push(hit.item);
} else if (hit) {
const found = scrub(hit.body).match(ipv4) || [];
const exit = found.find((ip) => ip !== myIp) || found[0] || '';
alive.push({ entry: hit.item.text, shown: label(hit.item), ms: hit.ms, exit, level: grade(hit.body, myIp) });
}
if (done - lastShown >= Math.max(1, Math.ceil(entries.length / 20)) || done === entries.length) {
lastShown = done;
const denied = turnedAway.length ? `, ${turnedAway.length} rejected credentials` : '';
process.stderr.write(`\r${done}/${entries.length} checked, ${alive.length} alive${denied} `);
}
}
};
await Promise.all(Array.from({ length: Math.min(settings.parallel, entries.length) }, lane));
process.stderr.write('\n');
alive.sort((a, b) => a.ms - b.ms);
await writeFile(settings.output, alive.map((p) => p.entry).join('\n') + (alive.length ? '\n' : ''));
if (settings.csv) {
const rows = ['proxy,ms,exit_ip,anonymity', ...alive.map((p) => `${cell(p.entry)},${p.ms},${p.exit},${p.level}`)];
await writeFile(settings.csv, rows.join('\n') + '\n');
}
const top = alive.slice(0, 15);
const width = Math.max(22, ...top.map((p) => p.shown.length));
for (const p of top) console.log(`${p.shown.padEnd(width)} ${String(p.ms).padStart(5)} ms ${p.exit.padEnd(15)} ${p.level}`);
if (turnedAway.length) {
console.log(`${turnedAway.length} of ${withCredentials} lines with credentials were rejected, first ${label(turnedAway[0])}: check the login and password`);
}
console.log(`${alive.length} of ${entries.length} alive, saved to ${settings.output}`);
process.exit(alive.length ? 0 : 1);מה הלאה
צריכים אלפי שורות שלא מתות: הרכיבו הזמנה מהסוג והמדינה הרצויים. כתובות חינם לפי מדינה נמצאות בעמוד פרוקסי חינם, ומדריכי ההגדרה מראים איך לטעון את הקובץ שנבדק לתוכנות.