From 31fc38e702cc56d0731a8145c5b70fa361236139 Mon Sep 17 00:00:00 2001 From: HF Date: Thu, 22 Sep 2022 02:46:00 +0200 Subject: [PATCH] specifically deny rwhois referral small fix for Opera Mobile --- src/routes/api/banme.js | 9 +++++++++ src/utils/whois.js | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/routes/api/banme.js b/src/routes/api/banme.js index f335152..78e4286 100644 --- a/src/routes/api/banme.js +++ b/src/routes/api/banme.js @@ -12,6 +12,15 @@ async function banme(req, res) { if (code === '1') { reason = 'Userscript Bot'; } else if (code === '2') { + const ua = req.headers['user-agent']; + if (ua && ua.includes('OPR/') + && (ua.includes('Android') || ua.includes('iPhone')) + ) { + res.json({ + status: 'nope', + }); + return; + } reason = 'Captcha Solving Script'; } const ip = getIPFromRequest(req); diff --git a/src/utils/whois.js b/src/utils/whois.js index 37ef260..46844c0 100644 --- a/src/utils/whois.js +++ b/src/utils/whois.js @@ -151,6 +151,9 @@ function singleWhoisQuery( query, host, ) { + if (host.endsWith(':4321')) { + throw new Error('no rwhois support'); + } return new Promise((resolve, reject) => { let data = ''; const socket = net.createConnection({