Universal-Bypass/background.js

811 lines
20 KiB
JavaScript
Raw Normal View History

2019-04-25 18:30:47 +02:00
const brws=(typeof browser=="undefined"?chrome:browser),
2019-04-28 19:06:13 +02:00
platform=brws.runtime.getURL("").split("-")[0],
getRedirectUrl=(url,tracker)=>(instantNavigation||(tracker&&instantNavigationTrackers)?url:brws.runtime.getURL("html/before-navigate.html")+"?target="+encodeURIComponent(url)),
getRedirect=(url,tracker)=>({redirectUrl:getRedirectUrl(url,tracker)}),
2019-03-09 12:47:57 +01:00
encodedRedirect=url=>({redirectUrl:(instantNavigation?decodeURIComponent(url):brws.runtime.getURL("html/before-navigate.html")+"?target="+url)}),
isGoodLink=link=>{
2019-03-10 18:48:59 +01:00
if(!link||link.split("#")[0]==location.href.split("#")[0]||link.substr(0,6)=="about:"||link.substr(0,11)=="javascript:")
2019-03-09 12:47:57 +01:00
{
return false
}
try
{
new URL(link)
}
catch(e)
{
return false
}
return true
}
2019-04-28 19:06:13 +02:00
//Install & Uninstall Actions
brws.runtime.onInstalled.addListener(details=>{
if(details.reason=="install")
{
if(platform=="moz")
{
brws.windows.create({url:"https://universal-bypass.org/firstrun"})
}
else
{
window.open("https://universal-bypass.org/firstrun")
}
}
})
//Keeping track of options
var enabled=true,trackerBypassEnabled=true,instantNavigationTrackers=false,blockIPLoggers=true,crowdEnabled=true,userscript=""
brws.storage.sync.get(["disable","no_tracker_bypass","instant_navigation","no_instant_navigation_trackers","allow_ip_loggers","crowd_bypass_opt_out"],res=>{
2019-01-11 19:28:26 +01:00
if(res)
{
enabled=(!res.disable||res.disable!=="true")
2019-05-05 08:57:03 +02:00
if(!enabled)
{
brws.browserAction.setIcon({path: {
"40": "icon_disabled/40.png",
"48": "icon_disabled/48.png",
"128": "icon_disabled/128.png",
"150": "icon_disabled/150.png",
"176": "icon_disabled/176.png",
"512": "icon_disabled/512.png"
}})
}
2019-01-11 19:28:26 +01:00
trackerBypassEnabled=(!res.no_tracker_bypass||res.no_tracker_bypass!=="true")
2019-04-28 19:06:13 +02:00
instantNavigation=(res.instant_navigation&&res.instant_navigation==="true")
instantNavigationTrackers=(!res.no_instant_navigation_trackers||res.no_instant_navigation_trackers!=="true")
2019-01-11 19:28:26 +01:00
blockIPLoggers=(!res.allow_ip_loggers||res.allow_ip_loggers!=="true")
crowdEnabled=(!res.crowd_bypass_opt_out||res.crowd_bypass_opt_out!=="true")
}
})
brws.storage.local.get(["userscript"],res=>{
if(res&&res.userscript)
{
userscript=res.userscript
}
})
brws.storage.onChanged.addListener(changes=>{
if(changes.disable)
{
enabled=(changes.disable.newValue!=="true")
2019-05-05 08:57:03 +02:00
if(enabled)
{
brws.browserAction.setIcon({path: {
"40": "icon/40.png",
"48": "icon/48.png",
"128": "icon/128.png",
"150": "icon/150.png",
"176": "icon/176.png",
"512": "icon/512.png"
}})
}
else
{
brws.browserAction.setIcon({path: {
"40": "icon_disabled/40.png",
"48": "icon_disabled/48.png",
"128": "icon_disabled/128.png",
"150": "icon_disabled/150.png",
"176": "icon_disabled/176.png",
"512": "icon_disabled/512.png"
}})
}
2019-01-11 19:28:26 +01:00
}
2019-04-28 19:06:13 +02:00
if(changes.no_tracker_bypass)
{
trackerBypassEnabled=(changes.no_tracker_bypass.newValue!=="true")
}
2019-01-11 19:28:26 +01:00
if(changes.instant_navigation)
{
instantNavigation=(changes.instant_navigation.newValue==="true")
}
2019-04-28 19:06:13 +02:00
if(changes.no_instant_navigation_trackers)
2019-01-11 19:28:26 +01:00
{
2019-04-28 19:06:13 +02:00
instantNavigationTrackers=(changes.no_instant_navigation_trackers.newValue!=="true")
2019-01-11 19:28:26 +01:00
}
if(changes.allow_ip_loggers)
{
blockIPLoggers=(changes.allow_ip_loggers.newValue!=="true")
}
if(changes.crowd_bypass_opt_out)
{
crowdEnabled=(changes.crowd_bypass_opt_out.newValue!=="true")
}
if(changes.userscript)
{
userscript=changes.userscript.newValue
}
})
2019-04-13 09:11:13 +02:00
2019-04-28 19:06:13 +02:00
//Messaging
2019-04-02 12:13:14 +02:00
brws.runtime.onMessage.addListener((req, sender, respond) => {
switch(req.type)
{
case "can-run":
respond({
enabled: enabled,
crowdEnabled: crowdEnabled,
userscript: userscript
})
2019-05-12 07:47:26 +02:00
break
2019-04-02 12:13:14 +02:00
2019-04-13 09:11:13 +02:00
case "crowd-contribute":
if(crowdEnabled)
{
2019-04-10 19:47:18 +02:00
let xhr=new XMLHttpRequest()
xhr.open("POST","https://universal-bypass.org/crowd/contribute_v1",true)
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
xhr.send(req.data)
}
2019-05-12 07:47:26 +02:00
else
{
console.warn("Unexpected message:", req)
}
break
2019-04-10 19:47:18 +02:00
2019-04-13 09:11:13 +02:00
default:
console.warn("Invalid message:", req)
}
})
brws.runtime.onConnect.addListener(port => {
console.assert(port.name == "adlinkfly-info")
port.onMessage.addListener(msg => {
let xhr=new XMLHttpRequest(),t="",iu=msg
xhr.onload=()=>{
let i=new DOMParser().parseFromString(xhr.responseText,"text/html").querySelector("img[src^='//api.miniature.io']")
if(i)
{
let url=new URL(i.src)
if(url.search&&url.search.indexOf("url="))
2019-04-02 12:13:14 +02:00
{
2019-04-13 09:11:13 +02:00
t=decodeURIComponent(url.search.split("url=")[1].split("&")[0])
2019-04-02 12:13:14 +02:00
}
}
2019-04-13 09:11:13 +02:00
port.postMessage(t)
2019-04-02 12:13:14 +02:00
}
2019-04-13 09:11:13 +02:00
xhr.onerror=()=>port.postMessage(t)
if(iu.substr(iu.length - 1) != "/")
{
iu += "/"
}
xhr.open("GET", iu+"info", true)
xhr.send()
})
2019-01-17 16:04:45 +01:00
})
2019-01-11 19:28:26 +01:00
2019-01-11 23:23:44 +01:00
//Internal redirects to extension URLs to bypass content script limitations
brws.webRequest.onBeforeRequest.addListener(details=>{
2019-01-17 02:58:06 +01:00
if(details.url.substr(38)=="1")
2019-01-11 23:23:44 +01:00
{
2019-01-17 02:58:06 +01:00
return {redirectUrl:brws.runtime.getURL("html/firstrun.html")}
2019-01-11 23:23:44 +01:00
}
2019-01-17 02:58:06 +01:00
else
{
return {redirectUrl:brws.runtime.getURL("html/firstrun-noscript.html")}
}
},{types:["main_frame"],urls:["https://universal-bypass.org/firstrun?*"]},["blocking"])
2019-01-11 23:23:44 +01:00
brws.webRequest.onBeforeRequest.addListener(details=>{
2019-01-17 02:58:06 +01:00
return encodedRedirect(details.url.substr(52))
},{types:["main_frame"],urls:["https://universal-bypass.org/before-navigate?target=*"]},["blocking"])
2019-01-11 23:23:44 +01:00
brws.webRequest.onBeforeRequest.addListener(details=>{
2019-01-17 02:58:06 +01:00
return {redirectUrl:brws.runtime.getURL("html/crowd-bypassed.html")+details.url.substr(43)}
},{types:["main_frame"],urls:["https://universal-bypass.org/crowd-bypassed?*"]},["blocking"])
brws.webRequest.onBeforeRequest.addListener(details=>{
return {redirectUrl:brws.runtime.getURL("html/options.html")+details.url.substr(36)}
},{types:["main_frame"],urls:["https://universal-bypass.org/options"]},["blocking"])
2019-01-11 23:23:44 +01:00
2019-02-01 04:39:53 +01:00
//Preflight Bypasses
2019-01-11 19:28:26 +01:00
brws.webRequest.onBeforeRequest.addListener(details=>{
2019-01-17 02:58:06 +01:00
if(enabled)
{
2019-01-30 20:21:00 +01:00
return getRedirect(details.url.substr(details.url.indexOf("url=")+4))
2019-01-17 02:58:06 +01:00
}
2019-06-17 19:41:11 +02:00
},{types:["main_frame"],urls:[
"*://*/st?api=*&url=*",
"*://*.zxro.com/u/*?url=*",
"*://*.leechall.com/redirect.php?url=*"
]},["blocking"])
2019-02-03 20:04:53 +01:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
let url=new URL(details.url)
if(url.searchParams.has("url"))
{
return getRedirect(url.searchParams.get("url"))
}
}
2019-05-18 15:10:46 +02:00
},{types:["main_frame"],urls:[
"*://*.news-gg.com/l/?*",
"*://*.mobile01.com/redirect.php?*",
"*://*.nurhamka.com/*?url=*",
"*://*.linepc.site/*?url=*",
2019-05-18 15:10:46 +02:00
]},["blocking"])
2019-05-08 04:05:02 +02:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
let url=new URL(details.url)
if(url.search)
{
2019-05-28 21:08:24 +02:00
return getRedirect(url.search.substr(1)+url.hash)
2019-05-08 04:05:02 +02:00
}
}
2019-07-20 11:14:49 +02:00
},{types:["main_frame"],urls:[
"*://*.anonym.to/?*",
"*://*.anonymz.com/?*",
]},["blocking"])
2019-01-11 19:28:26 +01:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
return getRedirect(atob(details.url.substr(details.url.indexOf("?rel=")+5)))
}
},{types:["main_frame"],urls:["*://*.kharismanews.com/?rel=*"]},["blocking"])
2019-01-11 19:28:26 +01:00
brws.webRequest.onBeforeRequest.addListener(details=>{
2019-01-17 02:58:06 +01:00
if(enabled)
{
2019-01-11 19:28:26 +01:00
return encodedRedirect(details.url.substr(details.url.indexOf("link=")+5))
2019-01-17 02:58:06 +01:00
}
},{types:["main_frame"],urls:["*://*.spaste.com/r/*link=*",]},["blocking"])
2019-01-11 19:28:26 +01:00
brws.webRequest.onBeforeRequest.addListener(details=>{
2019-01-17 02:58:06 +01:00
if(enabled)
{
2019-01-11 19:28:26 +01:00
return getRedirect(atob(details.url.substr(details.url.indexOf("?link=")+6)))
2019-01-17 02:58:06 +01:00
}
},{types:["main_frame"],urls:["*://*.leechpremium.link/cheat/?link=*"]},["blocking"])
2019-01-11 19:28:26 +01:00
2019-05-27 19:50:17 +02:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
return getRedirect(atob(details.url.substr(details.url.indexOf("?kesehatan=")+11)))
}
},{types:["main_frame"],urls:["*://*.infosia.xyz/?kesehatan=*"]},["blocking"])
2019-05-02 00:27:15 +02:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
2019-05-13 22:10:10 +02:00
return getRedirect(atob(new URL(details.url).searchParams.values().next().value))
2019-05-02 00:27:15 +02:00
}
},{types:["main_frame"],urls:[
"*://*.pafpaf.info/?*=*",
"*://*.binerfile.info/?*=*",
2019-05-13 22:10:10 +02:00
"*://kurosafety.menantisenja.com/?*=*"
2019-05-02 00:27:15 +02:00
]},["blocking"])
2019-05-04 20:54:17 +02:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
return getRedirect(atob(details.url.substr(details.url.indexOf("?r=")+3)))
}
2019-06-06 07:07:23 +02:00
},{types:["main_frame"],urls:[
"*://*.yumechan.club/?r=*",
"*://*.celeclub.org/?r=*",
2019-07-28 04:39:50 +02:00
"*://*.duniaislamku.com/?r=*",
2019-07-28 09:09:09 +02:00
"*://*.situsbaru.me/?r=*",
"*://*.polrec.site/?r=*",
2019-08-14 11:56:57 +02:00
"*://*.space.tribuntekno.com/?r=*",
"*://*.jossbingit.xyz/?r=*",
2019-08-19 17:51:05 +02:00
"*://*.starzone.cc/?r=*",
"*://*.gomentod.com/?r=*",
2019-08-21 14:33:19 +02:00
"*://*.lifeasurance.com/?r=*",
"*://*.ceklinku.xyz/?r=*",
2019-08-29 05:15:57 +02:00
"*://*.xneet.id/?r=*",
"*://*.uxglow.com/?r=*",
2019-08-29 05:23:44 +02:00
"*://*.infokesehatan.club/?r=*",
2019-09-01 13:27:14 +02:00
"*://*.wanhealth.me/?r=*",
"*://*.otoponsel.com/?r=*"
2019-06-06 07:07:23 +02:00
]},["blocking"])
2019-05-04 20:54:17 +02:00
2019-09-02 12:50:34 +02:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
return getRedirect(atob(details.url.substr(details.url.indexOf("?a=")+3)))
}
},{types:["main_frame"],urls:[
"*://*.adsafelink.net/generate?a=*"
]},["blocking"])
2019-08-29 05:20:40 +02:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
return getRedirect(atob(details.url.substr(details.url.indexOf("?url=")+5)))
}
},{types:["main_frame"],urls:[
2019-09-01 12:41:57 +02:00
"*://*.mispuani.xyz/*?url=*",
"*://*.zonangopi.ml/p/generate.html?url=*"
2019-08-29 05:20:40 +02:00
]},["blocking"])
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
2019-08-19 17:53:37 +02:00
return getRedirect(atob(details.url.substr(details.url.indexOf("?site=")+6).split("&")[0]))
}
},{types:["main_frame"],urls:[
2019-08-19 17:53:37 +02:00
"*://*.hightech.web.id/*?site=*",
"*://*.masreyhan.com/*?site=*"
]},["blocking"])
2019-08-19 17:54:37 +02:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
return getRedirect(atob(details.url.substr(details.url.indexOf("?reff=")+6)))
}
},{types:["main_frame"],urls:[
"*://*.remiyu.me/?reff=*"
]},["blocking"])
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
return getRedirect(atob(details.url.substr(details.url.indexOf("?kareeI=")+8)).split("||")[0])
}
},{types:["main_frame"],urls:[
"*://*.idalponse.blogspot.com/?kareeI=*"
]},["blocking"])
2019-01-11 19:28:26 +01:00
brws.webRequest.onBeforeRequest.addListener(details=>{
2019-01-17 02:58:06 +01:00
if(enabled)
{
2019-01-11 19:28:26 +01:00
return encodedRedirect(details.url.substr(details.url.indexOf("?s=")+3))
2019-01-17 02:58:06 +01:00
}
2019-05-04 20:37:56 +02:00
},{types:["main_frame"],urls:[
"*://*.ouo.io/s/*?s=*",
"*://*.ouo.io/qs/*?s=*",
"*://*.cpmlink.net/s/*?s=*"
]},["blocking"])
2019-01-11 19:28:26 +01:00
brws.webRequest.onBeforeRequest.addListener(details=>{
2019-01-17 02:58:06 +01:00
if(enabled)
{
2019-01-11 19:28:26 +01:00
return encodedRedirect(details.url.substr(details.url.indexOf("/12/1/")+6))
2019-01-17 02:58:06 +01:00
}
},{types:["main_frame"],urls:["*://*.sh.st/r/*/12/1/*"]},["blocking"])
2019-01-11 19:28:26 +01:00
brws.webRequest.onBeforeRequest.addListener(details=>{
2019-01-17 02:58:06 +01:00
if(enabled)
{
2019-01-11 19:28:26 +01:00
return encodedRedirect(details.url.substr(details.url.indexOf("/s/")+3))
2019-01-17 02:58:06 +01:00
}
},{types:["main_frame"],urls:["*://*.gslink.co/e/*/s/*"]},["blocking"])
2019-01-11 19:28:26 +01:00
2019-05-12 07:47:46 +02:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
let url=details.url
do
{
let arr=url.substr(19).split("/")
if(arr.length!=2)
{
return
}
url=atob(arr[1])
}
while(url.length>=19&&url.substr(0,19)=="http://gslink.co/a/");
if(url!=details.url&&isGoodLink(url))
{
return getRedirect(url)
}
}
},{types:["main_frame"],urls:["http://gslink.co/a/*"]},["blocking"])
2019-01-22 19:39:15 +01:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
2019-01-28 15:00:24 +01:00
let url=new URL(details.url)
if(url.searchParams.has("u"))
2019-01-26 17:40:40 +01:00
{
2019-01-28 15:00:24 +01:00
return getRedirect(atob(url.searchParams.get("u"))+url.hash)
2019-01-26 17:40:40 +01:00
}
2019-01-22 19:39:15 +01:00
}
2019-01-26 17:40:40 +01:00
},{types:["main_frame"],urls:["*://*.noriskdomain.com/*/analyze?*"]},["blocking"])
2019-01-22 19:39:15 +01:00
2019-03-08 08:51:36 +01:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
return getRedirect(atob(details.url.substr(details.url.indexOf("/dl/")+4)))
}
},{types:["main_frame"],urls:["*://*.k2nblog.com/dl/*"]},["blocking"])
2019-04-19 06:57:57 +02:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
let url=new URL(details.url)
if(url.searchParams.has("id"))
{
return getRedirect(atob(url.searchParams.get("id").split("").reverse().join("")))
}
}
},{types:["main_frame"],urls:["*://*.masterads.info/instagram/campanha.php?*"]},["blocking"])
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
let url=new URL(details.url)
if(url.searchParams.has("token"))
{
return getRedirect(atob(url.searchParams.get("token")))
}
}
},{types:["main_frame"],urls:["*://*.mundodocinema.ga/redirecionamento_final?*"]},["blocking"])
2019-05-14 19:52:59 +02:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
let url=new URL(details.url)
if(url.searchParams.has("go"))
{
return getRedirect("https://clickar.net/"+url.searchParams.get("go"))
}
}
},{types:["main_frame"],urls:["*://*.surfsees.com/?*"]},["blocking"])
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
let url=new URL(details.url)
if(url.searchParams.has("href"))
{
return getRedirect(url.searchParams.get("href"))
}
}
},{types:["main_frame"],urls:["*://*.maranhesduve.club/?*"]},["blocking"])
2019-08-29 05:09:23 +02:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
let url=new URL(details.url)
if(url.searchParams.has("short"))
{
return getRedirect(url.searchParams.get("short"))
}
}
},{types:["main_frame"],urls:["*://*.duit.cc/*?*"]},["blocking"])
2019-05-15 11:02:19 +02:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
let url=new URL(details.url)
if(url.searchParams.has("id"))
{
return getRedirect(atob(url.searchParams.get("id")).split("!").join("a").split(")").join("e").split("_").join("i").split("(").join("o").split("*").join("u"))
}
}
},{types:["main_frame"],urls:[
"*://*.safelinkconverter.com/*?*",
"*://*.safelinkreview.com/*?*",
"*://*.safelinkreviewx.com/*?*",
"*://*.safelinkreview.co/*?*",
"*://*.awsubsco.ml/*?*",
"*://*.awsubsco.cf/*?*"
]},["blocking"])
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
let url=new URL(details.url)
return getRedirect(atob(url.search.replace("?","")))
}
},{types:["main_frame"],urls:[
"*://*.hikarinoakariost.info/out/?*",
]},["blocking"])
2019-09-01 12:41:03 +02:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
let url=new URL(details.url)
if(url.hash)
{
return getRedirect(atob(url.hash.replace("#","")))
}
}
},{types:["main_frame"],urls:[
"*://*.acorme.com/*",
]},["blocking"])
2019-06-11 21:11:08 +02:00
brws.webRequest.onBeforeRequest.addListener(details=>{
if(enabled)
{
let url=new URL(details.url)
if(url.searchParams.has("dest"))
{
return getRedirect(url.searchParams.get("dest"))
}
}
},{types:["main_frame"],urls:["*://*.ecleneue.com/pushredirect/?*"]},["blocking"])
2019-04-19 06:57:57 +02:00
//Ouo.io/press Crowd Bypass
2019-03-09 12:47:57 +01:00
brws.webRequest.onHeadersReceived.addListener(details=>{
if(enabled)
{
let url = new URL(details.url), target
for(let i in details.responseHeaders)
{
let header = details.responseHeaders[i]
2019-04-02 12:13:14 +02:00
if(header.name.toLowerCase() == "location" && isGoodLink(header.value))
2019-03-09 12:47:57 +01:00
{
details.responseHeaders[i].value = getRedirectUrl(target = header.value)
break
}
}
if(target)
{
let xhr=new XMLHttpRequest()
2019-04-10 19:47:18 +02:00
xhr.open("POST","https://universal-bypass.org/crowd/contribute_v1",true)
2019-03-09 12:47:57 +01:00
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
2019-03-09 13:04:57 +01:00
xhr.send("domain=ouo.io&path="+encodeURIComponent(url.pathname.split("/")[2])+"&target="+encodeURIComponent(target))
2019-03-09 12:47:57 +01:00
return{responseHeaders:details.responseHeaders}
}
}
},{types:["main_frame"],urls:[
"*://*.ouo.io/*/*",
"*://*.ouo.press/*/*"
2019-03-09 12:47:57 +01:00
]},["blocking","responseHeaders"])
//SafelinkU Crowd Bypass
brws.webRequest.onHeadersReceived.addListener(details=>{
if(enabled)
{
let url = new URL(details.url)
for(let i in details.responseHeaders)
{
let header = details.responseHeaders[i]
if(header.name.toLowerCase() == "location")
{
details.responseHeaders[i].value += "#" + url.pathname.substr(1)
break
}
}
return{responseHeaders:details.responseHeaders}
}
},{types:["main_frame"],urls:[
"*://*.bercara.com/*"
]},["blocking","responseHeaders"])
2019-03-09 12:47:57 +01:00
2018-11-09 15:00:05 +01:00
//Fixing Content-Security-Policy on Firefox because apparently extensions have no special privileges in Firefox
2019-04-25 18:30:47 +02:00
if(platform=="moz")
2019-01-11 19:28:26 +01:00
{
2018-12-05 09:04:17 +01:00
brws.webRequest.onHeadersReceived.addListener(details=>{
2019-01-17 02:58:06 +01:00
if(enabled)
2018-11-09 15:00:05 +01:00
{
2019-01-17 02:58:06 +01:00
let csp = false
2018-11-09 15:00:05 +01:00
for(let i in details.responseHeaders)
{
if("value"in details.responseHeaders[i]&&["content-security-policy","x-content-security-policy"].indexOf(details.responseHeaders[i].name.toLowerCase())>-1)
{
2019-01-17 02:58:06 +01:00
csp = true
let _policies = details.responseHeaders[i].value.replace(";,",";").split(";"),
policies = {}
2018-11-09 15:00:05 +01:00
for(let j in _policies)
{
2019-01-17 02:58:06 +01:00
let policy = _policies[j].trim(),name=policy.split(" ")[0]
policies[name] = policy.substr(name.length).trim().split(" ")
2018-11-09 15:00:05 +01:00
}
2018-11-10 10:25:19 +01:00
if(!("script-src"in policies)&&"default-src"in policies)
2018-11-09 15:00:05 +01:00
{
2019-01-17 02:58:06 +01:00
policies["script-src"] = policies["default-src"]
let ni = policies["script-src"].indexOf("'none'")
if(ni > -1)
{
2018-11-10 10:25:19 +01:00
policies["script-src"].splice(ni, 1)
2019-01-17 02:58:06 +01:00
}
2018-11-10 14:09:09 +01:00
}
if("script-src"in policies)
{
2018-11-09 15:00:05 +01:00
if(policies["script-src"].indexOf("'unsafe-inline'")==-1)
2019-01-17 02:58:06 +01:00
{
2018-11-09 15:00:05 +01:00
policies["script-src"].push("'unsafe-inline'")
2019-01-17 02:58:06 +01:00
}
2018-11-09 15:00:05 +01:00
if(policies["script-src"].indexOf("'unsafe-eval'")==-1)
2019-01-17 02:58:06 +01:00
{
2018-11-09 15:00:05 +01:00
policies["script-src"].push("'unsafe-eval'")
2019-01-17 02:58:06 +01:00
}
2018-11-09 15:00:05 +01:00
}
else
2019-01-04 21:17:38 +01:00
{
2018-11-10 14:09:09 +01:00
policies["script-src"]=["*","blob:","data:","'unsafe-inline'","'unsafe-eval'"]
2019-01-04 21:17:38 +01:00
}
2018-11-09 15:00:05 +01:00
let value=""
for(let name in policies)
{
2019-05-12 07:47:26 +02:00
value+=name
2018-11-09 15:00:05 +01:00
for(let j in policies[name])
{
value+=" "+policies[name][j]
}
value+="; "
}
2018-11-10 10:25:19 +01:00
details.responseHeaders[i].value=value.substr(0,value.length-2)
2018-11-09 15:00:05 +01:00
}
}
2018-11-10 14:09:09 +01:00
if(csp)
2019-01-01 18:43:20 +01:00
{
2018-11-10 14:09:09 +01:00
return{responseHeaders:details.responseHeaders}
2019-01-01 18:43:20 +01:00
}
2018-11-09 15:00:05 +01:00
}
2019-01-17 02:58:06 +01:00
},{types:["main_frame"],urls:["<all_urls>"]},["blocking","responseHeaders"])
2019-01-11 19:28:26 +01:00
}
2018-10-02 19:31:00 +02:00
2019-04-28 13:10:49 +02:00
//Tracker Bypass using Apimon.de
2018-12-30 12:25:26 +01:00
function resolveRedirect(url)
{
2018-08-22 19:09:23 +02:00
let xhr=new XMLHttpRequest(),destination
2019-04-13 09:11:13 +02:00
xhr.onload=()=>{
let json=JSON.parse(xhr.responseText)
if(json&&json.destination)
destination=json.destination
2018-07-03 10:18:59 +02:00
}
2018-12-01 01:34:17 +01:00
xhr.open("GET","https://apimon.de/redirect/"+encodeURIComponent(url),false)
2018-07-03 23:52:38 +02:00
xhr.send()
2018-08-22 19:09:23 +02:00
return destination
}
2018-12-05 09:04:17 +01:00
brws.webRequest.onBeforeRequest.addListener(details=>{
2019-04-28 13:10:49 +02:00
if(trackerBypassEnabled&&new URL(details.url).pathname!="/")
2019-01-11 19:28:26 +01:00
{
2019-04-28 13:10:49 +02:00
let destination=resolveRedirect(details.url)
if(destination&&destination!=details.url)
2019-01-17 02:58:06 +01:00
{
2019-04-28 19:06:13 +02:00
return getRedirect(destination,true)
2019-01-17 02:58:06 +01:00
}
2019-01-11 19:28:26 +01:00
}
2018-08-22 19:09:23 +02:00
},{
2019-01-17 02:58:06 +01:00
types:["main_frame"],
2018-08-22 19:09:23 +02:00
urls:[
2018-07-11 11:59:08 +02:00
"*://*.great.social/*",
"*://*.send.digital/*",
"*://*.snipli.com/*",
"*://*.shortcm.li/*",
"*://*.page.link/*",
2018-07-13 20:22:59 +02:00
"*://*.go2l.ink/*",
2018-07-11 11:59:08 +02:00
"*://*.buff.ly/*",
"*://*.snip.li/*",
"*://*.hive.am/*",
"*://*.cutt.ly/*",
"*://*.tiny.ie/*",
2018-07-03 23:52:38 +02:00
"*://*.bit.ly/*",
2018-07-04 02:30:44 +02:00
"*://*.goo.gl/*",
2018-07-11 11:59:08 +02:00
"*://*.bit.do/*",
"*://*.t2m.io/*",
"*://*.dis.gd/*",
"*://*.zii.bz/*",
"*://*.plu.sh/*",
"*://*.b.link/*",
"*://*.po.st/*",
"*://*.ow.ly/*",
"*://*.is.gd/*",
"*://*.1b.yt/*",
"*://*.1w.tf/*",
"*://*.t.co/*",
2018-08-22 19:09:23 +02:00
"*://*.x.co/*"
]
},["blocking"])
2018-12-05 09:04:17 +01:00
brws.webRequest.onBeforeRequest.addListener(details=>{
2019-04-28 13:10:49 +02:00
if(new URL(details.url).pathname!="/")
2018-08-22 19:09:23 +02:00
{
2019-01-11 19:28:26 +01:00
if(trackerBypassEnabled)
{
2019-04-28 13:10:49 +02:00
let destination=resolveRedirect(details.url)
if(destination&&destination!=details.url)
2019-01-11 19:28:26 +01:00
{
2019-04-28 19:06:13 +02:00
return getRedirect(destination,true)
2019-01-11 19:28:26 +01:00
}
}
if(blockIPLoggers)
{
2019-04-28 13:10:49 +02:00
return {redirectUrl:brws.runtime.getURL("html/blocked.html")}
2019-01-11 19:28:26 +01:00
}
2018-08-22 19:09:23 +02:00
}
2019-01-17 02:58:06 +01:00
},{types:["main_frame"],urls:getIPLoggerPatterns()},["blocking"])
2018-08-22 19:09:23 +02:00
function getIPLoggerPatterns()
{
let patterns=[],
2018-07-03 23:52:38 +02:00
//https://github.com/timmyrs/Evil-Domains/blob/master/lists/IP%20Loggers.txt
ipLoggers=`viral.over-blog.com
gyazo.in
ps3cfw.com
urlz.fr
webpanel.space
steamcommumity.com
i.imgur.com.de
www.fuglekos.com
# Grabify
grabify.link
bmwforum.co
leancoding.co
quickmessage.io
spottyfly.com
spötify.com
stopify.co
yoütu.be
yoütübe.co
yoütübe.com
xda-developers.io
starbucksiswrong.com
starbucksisbadforyou.com
bucks.as
discörd.com
minecräft.com
cyberh1.xyz
discördapp.com
freegiftcards.co
disçordapp.com
rëddït.com
2018-08-22 19:09:23 +02:00
# Cyberhub (formerly SkypeGrab)
2018-07-03 23:52:38 +02:00
2018-08-22 19:09:23 +02:00
ġooģle.com
drive.ġooģle.com
maps.ġooģle.com
disċordapp.com
ìṃgur.com
transferfiles.cloud
tvshare.co
publicwiki.me
hbotv.co
gameskeys.shop
videoblog.tech
twitch-stats.stream
anonfiles.download
bbcbloggers.co.uk
2018-07-03 23:52:38 +02:00
# Yip
yip.su
iplogger.com
iplogger.org
iplogger.ru
2no.co
02ip.ru
iplis.ru
iplo.ru
ezstat.ru
# What's their IP
www.whatstheirip.com
www.hondachat.com
www.bvog.com
www.youramonkey.com
# Pronosparadise
pronosparadise.com
freebooter.pro
# Blasze
blasze.com
blasze.tk
# IPGrab
ipgrab.org
i.gyazos.com`,
lines=ipLoggers.split("\n")
for(let i in lines)
2018-07-03 10:18:59 +02:00
{
2019-05-12 07:47:26 +02:00
let line=lines[i].trim()
2018-07-03 23:52:38 +02:00
if(line&&line.substr(0,1)!="#")
{
if(line.substr(0,4)=="www.")
line=line.substr(4)
2018-08-22 19:09:23 +02:00
else if(line.substr(0,2)=="i.")
line=line.substr(2)
else if(line.substr(0,6)=="drive.")
line=line.substr(6)
else if(line.substr(0,5)=="maps.")
line=line.substr(5)
if(patterns.indexOf(line)==-1)
patterns.push("*://*."+line+"/*")
2018-07-03 23:52:38 +02:00
}
2018-07-03 10:18:59 +02:00
}
2018-08-22 19:09:23 +02:00
return patterns
2018-07-03 23:52:38 +02:00
}