-
Notifications
You must be signed in to change notification settings - Fork 0
/
link.js
48 lines (45 loc) · 2.02 KB
/
link.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
(async function(){
var isshort = function(url){
console.log(url)
// http://www.surbl.org/tld
var host = checksite.gethostorurl(url)
if(url.includes("google.com/url") === true || url.includes("adguardteam.github.io/AnonymousRedirect/redirect.html") === true){return "yes"}
var shortdomains = ["bit.ly","bit.do","ow.ly","goo.gl","x.co","rebrand.ly","tinyurl.com","t.co","is.gd","ht.ly"]
if(shortdomains.includes(host)){
return "yes"
}
else{
return "no"
}
}
var url = (new URL(location).searchParams.get("url")||"")
console.log(url)
document.getElementById('host').textContent = "Report for " + checksite.gethostorurl(url)
document.getElementById('host').title = url
document.title = "Report for link"
checksite.urlhaus(checksite.gethostorurl(url)).then(function(result){
document.getElementById("urlhaus").textContent = (result===true)?"Detected":"Not detected"
})
checksite.dandelioncheck(checksite.gethostorurl(url)).then(function(result){
document.getElementById("dand").textContent = (result === true)?"Detected":"Not detected"
})
document.getElementById('short').textContent = isshort(url)
document.querySelectorAll(".reportlink").forEach(function(l){
l.href = l.getAttribute("data-href").replace("$URL",encodeURIComponent(url)).replace("$HOST",encodeURIComponent(checksite.gethostorurl(url)))
})
if(new URL(location).searchParams.has('siterep')){
document.title = "Report for site"
document.getElementById('titlereplink').textContent = "Reports for this website"
}
hostslists.lists.forEach(async function(item,name){
console.log(item,name)
hostslists.loadHOSTS(checksite.gethostorurl(url),item).then(function(result){
var p = document.createElement("span")
p.textContent = name + ": "
p.textContent += (result === true)?"Detected":"Not detected"
console.log(p.textContent,result)
document.getElementById('add').appendChild(p)
document.getElementById('add').appendChild(document.createElement('br'))
})
})
})().catch(console.error)