Skip to content

Instantly share code, notes, and snippets.

@lukanz
Last active May 27, 2023 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lukanz/87548c4e8bcc9b3451553bd01c3fd2bc to your computer and use it in GitHub Desktop.
Save lukanz/87548c4e8bcc9b3451553bd01c3fd2bc to your computer and use it in GitHub Desktop.
/*
// ANZ Mobile (WIFI) AD-Blocker
// https://gist.github.com/lukanz
// 30 May 2023
*/
/* Match URL */
function regExpMatch(url, pattern) {
try { return new RegExp(pattern).test(url); } catch(ex) { return false; }
}
function FindProxyForURL(url, host) {
/* Normalize the URL for pattern matching */
url = url.toLowerCase();
host = host.toLowerCase();
/* Random PROXY for shExpMatch */
//var rand0m = ["PROXY 1.1.1.1:8989","PROXY 5.5.5.5:8989","PROXY 3.3.3.3:8989"];
//var pr0xy = rand0m[Math.floor(Math.random() * rand0m.length)];
var pr0xy = "PROXY 1.1.1.1:8989";
//////////////////////////////////////////////////////////////////////////
///----------------------------- Google ------------------------------///
////////////////////////////////////////////////////////////////////////
if (shExpMatch(url, "*pagead*")) {return pr0xy;}
if (shExpMatch(url, "*fundingchoicesmessages*")) {return pr0xy;}
if (shExpMatch(url, "*ad(form|host|sense|service|unit)*")) {return pr0xy;}
////// Google II
if (shExpMatch(url, "*.doubleclick.*")) {return pr0xy;}
if (shExpMatch(url, "*.google-analytics.*")) {return pr0xy;}
if (shExpMatch(url, "*.googleadservices.*")) {return pr0xy;}
if (shExpMatch(url, "*.googlesyndication.*")) {return pr0xy;}
if (shExpMatch(url, "*.googletagservices.*")) {return pr0xy;}
//////////////////////////////////////////////////////////////////////////
///------------------------------ Mixed ------------------------------///
////////////////////////////////////////////////////////////////////////
if (shExpMatch(url, "*.2mdn.*")) {return pr0xy;}
if (shExpMatch(url, "*.aaxads.com*")) {return pr0xy;}
if (shExpMatch(url, "*.adition.*")) {return pr0xy;}
if (shExpMatch(url, "*.adsnative.com*")) {return pr0xy;}
if (shExpMatch(url, "*.adjust.com*")) {return pr0xy;}
if (shExpMatch(url, "*.adskeeper.*")) {return pr0xy;}
if (shExpMatch(url, "*.adsmoloco.com*")) {return pr0xy;}
if (shExpMatch(url, "*.adnxs.com*")) {return pr0xy;}
if (shExpMatch(url, "*.adsafeprotected.com*")) {return pr0xy;}
if (shExpMatch(url, "*.amazon-adsystem.com*")) {return pr0xy;}
if (shExpMatch(url, "*.amplitude.com*")) {return pr0xy;}
if (shExpMatch(url, "*.atdmt.com*")) {return pr0xy;}
if (shExpMatch(url, "*.appboy.com*")) {return pr0xy;}
if (shExpMatch(url, "*.applovin.com*")) {return pr0xy;}
if (shExpMatch(url, "*.appsflyer.com*")) {return pr0xy;}
if (shExpMatch(url, "*.branch.io*")) {return pr0xy;}
if (shExpMatch(url, "*.cointraffic.io*")) {return pr0xy;}
if (shExpMatch(url, "*.criteo.*")) {return pr0xy;}
if (shExpMatch(url, "*.crashlytics.com*")) {return pr0xy;}
if (shExpMatch(url, "*.czilladx.com*")) {return pr0xy;}
if (shExpMatch(url, "*.deloton.com*")) {return pr0xy;}
if (shExpMatch(url, "*.display.io*")) {return pr0xy;}
if (shExpMatch(url, "*.flurry.com*")) {return pr0xy;}
if (shExpMatch(url, "*.fwmrm.net*")) {return pr0xy;}
if (shExpMatch(url, "*.gemini.yahoo.com*")) {return pr0xy;}
if (shExpMatch(url, "*.inmobi.com*")) {return pr0xy;}
if (shExpMatch(url, "*.innovid.com*")) {return pr0xy;}
if (shExpMatch(url, "*.leadzutw.com*")) {return pr0xy;}
if (shExpMatch(url, "*.mixpanel.com*")) {return pr0xy;}
if (shExpMatch(url, "*.moatads.com*")) {return pr0xy;}
if (shExpMatch(url, "*.mob.com*")) {return pr0xy;}
if (shExpMatch(url, "*.mobusi.com*")) {return pr0xy;}
if (shExpMatch(url, "*.moatads.com*")) {return pr0xy;}
if (shExpMatch(url, "*.mopub.com*")) {return pr0xy;}
if (shExpMatch(url, "*.movad.net*")) {return pr0xy;}
if (shExpMatch(url, "*.outbrain.com*")) {return pr0xy;}
if (shExpMatch(url, "*.smaato.net*")) {return pr0xy;}
if (shExpMatch(url, "*.startappservice.com*")) {return pr0xy;}
if (shExpMatch(url, "*.serving-sys.com*")) {return pr0xy;}
if (shExpMatch(url, "*.taboola.com*")) {return pr0xy;}
if (shExpMatch(url, "*.scorecardresearch.com*")) {return pr0xy;}
if (shExpMatch(url, "*.vungle.com*")) {return pr0xy;}
////// Facebook
if (shExpMatch(url, "*.api.facebook.com*")) {return pr0xy;}
if (shExpMatch(url, "*.graph.facebook.com*")) {return pr0xy;}
if (shExpMatch(url, "*.connect.facebook.net*")) {return pr0xy;}
if (shExpMatch(url, "*.static.whatsapp.net*")) {return pr0xy;}
////// IOS
if (shExpMatch(url, "*.mesu.apple.com*")) {return pr0xy;}
if (shExpMatch(url, "*.iadsdk.apple.com*")) {return pr0xy;}
if (shExpMatch(url, "*.p20-buy.itunes.apple.com")) {return pr0xy;}
////// Xiaomi
if (shExpMatch(url, "*.sec.miui.com*")) {return pr0xy;}
if (shExpMatch(url, "*.intl.miui.com*")) {return pr0xy;}
if (shExpMatch(url, "*.tracking.miui.com*")) {return pr0xy;}
if (shExpMatch(url, "*.ad.xiaomi.com*")) {return pr0xy;}
if (shExpMatch(url, "*.ad.xiaomi.srv*")) {return pr0xy;}
if (shExpMatch(url, "*.admob.xiaomi.com*")) {return pr0xy;}
if (shExpMatch(url, "*.mistat.xiaomi.com*")) {return pr0xy;}
if (shExpMatch(url, "*.stat.xiaomi.com*")) {return pr0xy;}
if (shExpMatch(url, "*.policy.app.xiaomi.com*")) {return pr0xy;}
if (shExpMatch(url, "*.tracking.intl.miui.com*")) {return pr0xy;}
if (shExpMatch(url, "*.firebaseinstallations.googleapis.com*")) {return pr0xy;}
if (shExpMatch(url, "*.firebaselogging-pa.googleapis.com*")) {return pr0xy;}
////// Host's
if (dnsDomainIs(host, "ads.viber.com")) {return pr0xy;}
if (dnsDomainIs(host, "adservice.google.com")) {return pr0xy;}
if (dnsDomainIs(host, "alb.reddit.com")) {return pr0xy;}
if (dnsDomainIs(host, "app-measurement.com")) {return pr0xy;}
if (dnsDomainIs(host, "s.youtube.com")) {return pr0xy;}
if (dnsDomainIs(host, "doubleclick.net")) {return pr0xy;}
if (dnsDomainIs(host, "googleadservices.com")) {return pr0xy;}
////// Z-Test
if (shExpMatch(url, "*.71i.de*")) {return pr0xy;}
if (shExpMatch(url, "*.adsafeprotected.com*")) {return pr0xy;}
if (shExpMatch(url, "*.ipify.org*")) {return pr0xy;}
if (shExpMatch(url, "*.sensic.net*")) {return pr0xy;}
if (dnsDomainIs(host, "danbo.org")) {return pr0xy;}
if (dnsDomainIs(host, "dreamdevsoftware.com")) {return pr0xy;}
return "DIRECT";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment