starbreaker
Sr. Member ⚓︎
![*](https://forum.melonland.net/Themes/pimp-my-classic/images/star.gif) ![*](https://forum.melonland.net/Themes/pimp-my-classic/images/star.gif) ![*](https://forum.melonland.net/Themes/pimp-my-classic/images/star.gif) ![*](https://forum.melonland.net/Themes/pimp-my-classic/images/star.gif)
![](https://forum.melonland.net/index.php?PHPSESSID=9757e8abvqkqh02p88van8kfql&action=dlattach;attach=3161;type=avatar)
What good is Heaven if we dare not storm it?
⛺︎ My Room
SpaceHey: Friend Me!
![WWW](https://forum.melonland.net/Themes/pimp-my-classic/images/www_sm.gif)
![First 1000 Members! given by Melooon First 1000 Members!](https://forum.melonland.net/awards/072a3ce6884f3b8cb5acbdf880dbbb3b_star-0813.gif) ![G4 Club Member! given by Melooon G4 Club Member!](https://forum.melonland.net/awards/7838e91e1dded2c96be21dc9edfd635c_G4 Cube-2.png)
|
![](https://forum.melonland.net/Themes/pimp-my-classic/images/post/resources.gif) |
« on: October 17, 2023 @873.53 » |
|
I recently wrote a bit of JavaScript that checks referrer and user agent and redirects visitors to an arbitrary destination. It can also, at the operator's discretion, display a message in a pop-up after redirecting. It isn't a substitute for using robots.txt or rejecting bad referrers in .htaccess or httpd.conf, but if you're on Neocities you probably don't have access to the web server's configuation. Likewise, if a site doesn't provide a referrer header or the visitor's browser doesn't implement JavaScript, this won't work. If your user has a JS-capable browser but isn't using modern JS, this script might not work either. It's probably little more than a bit of trolling that might catch some people who aren't as tech-savvy as they think they are. Nevertheless, you're welcome to it if you want it. /*
DDOS-as-a-service rejection, with assistance from 💕 Devastatia 💕
no license; do what thou wilt shall be the whole of the law
*/
window.addEventListener("load", testReferrerAndUserAgent);
function testReferrerAndUserAgent() {
var rejectDestination = "about:blank";
var rejectMessage = "You will find scant welcome on MY website.";
var showRejectMessage = true;
var referrers = [
"facebook.com",
"twitter.com",
"news.ycombinator.com",
"threads.net",
"[auto redacted].org",
"reddit.com"
];
var userAgents = [
"360spider",
"80legs",
"80legs.com",
"abonti",
"aboundex",
"acoonbot",
"acunetix",
"adbeat_bot",
"addthis.com",
"adidxbot",
"admantx",
"ahrefs",
"ahrefsbot",
"aibot",
"aiohttp",
"alexibot",
"alligator",
"allsubmitter",
"angloinfo",
"antelope",
"apexoo",
"asterias",
"attach",
"backdoorbot",
"backstreet",
"backweb",
"badass",
"baid",
"baiduspider",
"bandit",
"batchftp",
"bbbike",
"beetlebot",
"bigfoot",
"billigerbot",
"binlar",
"bitlybot",
"black.hole",
"blackwidow",
"blow",
"blowfish",
"blp_bbot",
"boardreader",
"bolt 0",
"bot for jce",
"bot mailto:craftbot@yahoo.com",
"botalot",
"buddy",
"builtbottough",
"bullseye",
"bunnyslippers",
"bytespider",
"casper",
"cazoodlebot",
"ccbot",
"cegbfeieh",
"checkprivacy",
"cheesebot",
"cherrypicker",
"chinaclaw",
"chromeframe",
"clerkbot",
"cliqzbot",
"clshttp",
"cogentbot",
"cognitiveseo",
"collector",
"commoncrawler",
"comodo",
"copier",
"copyrightcheck",
"cosmos",
"cpp-httplib",
"cpython",
"crawler4j",
"crawlera",
"crazywebcrawler",
"crescent",
"cshttp",
"curious",
"curl",
"custo",
"cws_proxy",
"dataforseobot",
"dataprovider.com",
"default browser 0",
"demon",
"devil",
"diavol",
"digext",
"digincore",
"diibot",
"disco",
"discobot",
"dittospyder",
"docomo",
"dotbot",
"download demon",
"download.demon",
"download.devil",
"download.wonder",
"dragonfly",
"drip",
"dts.agent",
"easouspider",
"easydl",
"ebingbong",
"ecatch",
"ecxi",
"eirgrabber",
"elmer",
"emailcollector",
"emailsiphon",
"emailwolf",
"erocrawler",
"exabot",
"exaleadcloudview",
"expertsearch",
"expertsearchspider",
"express",
"express webpictures",
"extract",
"extractor",
"extractorpro",
"eyenetie",
"ezooms",
"f2s",
"facebookexternalhit",
"fastseek",
"feedfinder",
"feedlybot",
"fhscan",
"finbot",
"flamingo_searchengine",
"flappybot",
"flashget",
"flicky",
"flipboard",
"flunky",
"foobot",
"frontpage",
"g00g1e",
"galaxybot",
"genieo",
"getright",
"getweb!",
"gigablastopensource",
"go!zilla",
"go-ahead-got-it",
"go-http-client",
"got",
"gotit",
"gozaikbot",
"grab",
"grabber",
"grabnet",
"grafula",
"grapeshotcrawler",
"gt::www",
"gtb5",
"guzzle",
"harvest",
"headlesschrome",
"headmasterseo",
"heritrix",
"hloader",
"hmview",
"homepagebot",
"htmlparser",
"http::lite",
"httrack",
"hubspot",
"humanlinks",
"icarus6",
"id-search",
"idbot",
"ilsebot",
"image stripper",
"image sucker",
"image.stripper",
"image.sucker",
"imagefetch",
"indigonet",
"indy library",
"infonavirobot",
"infotekies",
"integromedb",
"intelliseek",
"interget",
"internet ninja",
"internetseer.com",
"ioncrawl",
"iria",
"irlbot",
"isc systems irc search 2.1",
"jakarta",
"java",
"jennybot",
"jetcar",
"jikespider",
"jobdiggerspider",
"joc",
"joc web spider",
"jooblebot",
"justview",
"jyxobot",
"kanagawa",
"kenjin.spider",
"keyword.density",
"kingspider",
"kmccrew",
"larbin",
"leechftp",
"leechget",
"lexibot",
"lftp",
"libcurl",
"libweb",
"libwww",
"libwww-perl",
"likse",
"lingewoud",
"linkchecker",
"linkdexbot",
"linkextractorpro",
"linkscan",
"linkscrawler",
"linksmanager.com_bot",
"linkwalker",
"linqiarssbot",
"livelapbot",
"lnspiderguy",
"ltx71",
"lubbersbot",
"lwp-trivial",
"mag-net",
"magnet",
"mail.ru_bot",
"majestic12",
"markwatch",
"mass downloader",
"mass.downloader",
"masscan",
"mastodon",
"mata.hari",
"maverick",
"maxthon$",
"mediatoolkitbot",
"megaindex",
"memo",
"mfc_tear_sample",
"microsoft url control",
"microsoft.url",
"midown tool",
"miixpc",
"miner",
"missigua locator",
"misskey",
"mister pix",
"mj12bot",
"mozilla.*indy",
"mozilla.*newt",
"msfrontpage",
"msiecrawler",
"msnbot",
"nameprotect",
"navroad",
"nearsite",
"net vampire",
"netants",
"netcraft",
"netestate",
"netmechanic",
"netspider",
"netzip",
"nextgensearchbot",
"nicerspro",
"niki-bot",
"nimblecrawler",
"nimbostratus-bot",
"ninja",
"nmap",
"npbot",
"nutch",
"octopus",
"offline explorer",
"offline navigator",
"offline.explorer",
"offline.navigator",
"okhttp",
"openfind",
"openindexspider",
"openlinkprofiler",
"openwebspider",
"orangebot",
"outfoxbot",
"owlin",
"pagegrabber",
"pagesinventory",
"panopta",
"panscient.com",
"papa foto",
"pavuk",
"pcbrowser",
"pecl::http",
"peoplepal",
"photon",
"phpcrawl",
"pixray",
"planetwork",
"pleasecrawl",
"pnamain.exe",
"pockey",
"podcastpartybot",
"prijsbest",
"probethenet",
"propowerbot",
"prowebwalker",
"proximic",
"psbot",
"pump",
"purebot",
"pycurl",
"python",
"python-requests",
"queryn.metasearch",
"queryseekerspider",
"r6_commentreader",
"r6_feedfetcher",
"realdownload",
"reaper",
"recorder",
"reget",
"repomonkey",
"riddler",
"ripper",
"rippers 0",
"rma",
"rogerbot",
"rssingbot",
"ruby",
"rv:1.9.1",
"ryzecrawler",
"safesearch",
"sbider",
"scanbot",
"scrapy",
"screaming",
"seamonkey$",
"search.goo.ne.jp",
"search_robot",
"searchmetricsbot",
"semalt",
"semrush",
"semrushbot",
"sentibot",
"seokicks",
"seokicks-robot",
"seoscanners",
"seznambot",
"showyoubot",
"sightupbot",
"siphon",
"sistrix",
"sitecheck.internetseer.com",
"siteexplorer.info",
"siteimprove",
"sitesnagger",
"sitesucker",
"skygrid",
"slackbot",
"slurp",
"slysearch",
"smartdownload",
"snake",
"snapbot",
"snoopy",
"sogou",
"sosospider",
"spacebison",
"spankbot",
"spanner",
"spaumbot",
"spbot",
"spinn4r",
"sqworm",
"steeler",
"stripper",
"sucker",
"summalybot",
"superbot",
"superfeedr",
"superhttp",
"surdotlybot",
"surfbot",
"suzuran",
"szukacz",
"t3versions",
"takeout",
"teleport",
"teleport pro",
"telesoft",
"the.intraformant",
"thenomad",
"tighttwatbot",
"tineye",
"tineye-bot",
"titan",
"toata dragostea mea pentru diavola",
"toplistbot",
"trendiction.de",
"trendictionbot",
"trovitbot",
"true_robot",
"turingos",
"turnit",
"turnitinbot",
"twenga",
"twengabot",
"twitterbot",
"uri::fetch",
"urllib",
"urly.warning",
"vacuum",
"vagabondo",
"vci",
"vidiblescraper",
"vikspider",
"voideye",
"voilabot",
"wallpapershd",
"wbsearchbot",
"web image collector",
"web sucker",
"web.image.collector",
"webalta",
"webauto",
"webbandit",
"webcollage",
"webcopier",
"webenhancer",
"webfetch",
"webfuck",
"webgo is",
"webleacher",
"webmasterworldforumbot",
"webpix",
"webreaper",
"websauger",
"webshag",
"website extractor",
"website quester",
"website.extractor",
"webster",
"webstripper",
"websucker",
"webwhacker",
"webzip",
"wells search ii",
"wep search",
"wesee",
"wget",
"whack",
"whacker",
"widow",
"winhttrack",
"wininet",
"wisenutbot",
"woobot",
"woopingbot",
"worldwebheritage.org",
"wotbox",
"wpscan",
"www-collector-e",
"www-mechanize",
"wwwoffle",
"xaldon",
"xaldon webspider",
"xenu",
"xovibot",
"yacybot",
"yandex",
"yisouspider",
"zade",
"zermelo",
"zeus",
"zh-cn",
"zmeu",
"zumbot",
"zyborg"
];
console.log(`visitor's referrer: ${document.referrer}`);
console.log(`visitor's user agent: ${window.navigator.userAgent}`);
if (shouldRejectReferrer(referrers) || shouldRejectUserAgent(userAgents)) {
window.location.href = rejectDestination;
if (showRejectMessage) {
window.alert(rejectMessage);
}
}
}
function shouldRejectReferrer(referrers) {
var shouldReject = referrers.some((referrer) => testReferrer(referrer));
return shouldReject;
}
function shouldRejectUserAgent(userAgents) {
var shouldReject = userAgents.some((userAgent) => testUserAgent(userAgent));
return shouldReject;
}
function testReferrer(referrer) {
var isBadReferrer = (document.referrer.indexOf(referrer) > -1);
return isBadReferrer;
}
function testUserAgent(userAgent) {
var isBot = (window.navigator.userAgent.indexOf(userAgent) > -1);
return isBot;
}
As long as I continue to use this, you should be able to find a current version on my website. You should probably use it instead of copying from the code block above, because of the forum's auto-redaction.
|