mirror of
https://github.com/pezkuwichain/phishing.git
synced 2026-06-20 05:41:03 +00:00
Adjust checks for contents/errors
This commit is contained in:
+39
-8
@@ -176,18 +176,49 @@
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkUpCors (url, { contents, status: { content_length, error } }) {
|
||||||
|
// has an error from the CORS proxy
|
||||||
|
let isValid =
|
||||||
|
!error ||
|
||||||
|
(error.code !== 'UNABLE_TO_VERIFY_LEAF_SIGNATURE');
|
||||||
|
|
||||||
|
if (!isValid) {
|
||||||
|
console.log(`${url} has an retrieval error`)
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// has actual content or it has a refresh
|
||||||
|
isValid =
|
||||||
|
(content_length > 100) ||
|
||||||
|
contents.includes('<meta http-equiv="refresh"');
|
||||||
|
|
||||||
|
if (!isValid) {
|
||||||
|
console.log(`${url} has no content`);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// include in inactive list when the provider has suspended the account
|
||||||
|
isValid =
|
||||||
|
!contents.includes('This Account has been suspended') &&
|
||||||
|
!contents.includes('Хостинг сайта временно приостановлен');
|
||||||
|
|
||||||
|
if (!isValid) {
|
||||||
|
console.log(`${url} has been suspended`)
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
async function isUp (url) {
|
async function isUp (url) {
|
||||||
return fetchTimeout(url, { method: 'HEAD', mode: 'no-cors' })
|
return fetchTimeout(url, { method: 'HEAD', mode: 'no-cors' })
|
||||||
.then(() =>
|
.then(() =>
|
||||||
fetchTimeout(`https://api.allorigins.win/get?url=${encodeURIComponent(url)}`)
|
fetchTimeout(`https://api.allorigins.win/get?url=${encodeURIComponent(url)}`)
|
||||||
.then((response) => response.text())
|
.then((response) => response.json())
|
||||||
.then((body) =>
|
.then((json) => checkUpCors(url, json))
|
||||||
// this is from the allorigins proxy
|
|
||||||
!body.includes('UNABLE_TO_VERIFY_LEAF_SIGNATURE') &&
|
|
||||||
// include in inactive list when the provider has suspended the account
|
|
||||||
!body.includes('This Account has been suspended') &&
|
|
||||||
!body.includes('Хостинг сайта временно приостановлен')
|
|
||||||
)
|
|
||||||
.catch(() => true)
|
.catch(() => true)
|
||||||
)
|
)
|
||||||
.catch(() => false);
|
.catch(() => false);
|
||||||
|
|||||||
Reference in New Issue
Block a user