switch to advanced domain.json
This commit is contained in:
parent
1c848e6007
commit
a76b11b2b2
6 changed files with 280 additions and 161 deletions
|
@ -4,13 +4,13 @@ import (
|
|||
_ "embed"
|
||||
"encoding/json"
|
||||
"log"
|
||||
"sort"
|
||||
"slices"
|
||||
)
|
||||
|
||||
//go:embed domain.json
|
||||
var domainsFiles []byte
|
||||
|
||||
var Domains []string
|
||||
var Domains map[string][]string
|
||||
|
||||
func init() {
|
||||
err := json.Unmarshal(domainsFiles, &Domains)
|
||||
|
@ -19,22 +19,12 @@ func init() {
|
|||
}
|
||||
}
|
||||
|
||||
func AddDomain(domain string) {
|
||||
domains := append(Domains, domain)
|
||||
sort.SliceStable(domains, func(i, j int) bool {
|
||||
return domains[i] < domains[j]
|
||||
})
|
||||
Domains = removeDuplicate(domains)
|
||||
}
|
||||
|
||||
func removeDuplicate[T string](sliceList []T) []T {
|
||||
allKeys := make(map[T]bool)
|
||||
var list []T
|
||||
for _, item := range sliceList {
|
||||
if _, value := allKeys[item]; !value {
|
||||
allKeys[item] = true
|
||||
list = append(list, item)
|
||||
func AddDomain(domain, tld string) {
|
||||
if _, ok := Domains[domain]; ok {
|
||||
if !slices.Contains(Domains[domain], tld) {
|
||||
Domains[domain] = append(Domains[domain], tld)
|
||||
}
|
||||
} else {
|
||||
Domains[domain] = []string{tld}
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
|
|
@ -1,127 +1,251 @@
|
|||
[
|
||||
"1488.ch",
|
||||
"ascii.tools",
|
||||
"astonish.ch",
|
||||
"astonishing.ch",
|
||||
"attribution.ch",
|
||||
"baloise.ch",
|
||||
"baloise.com",
|
||||
"baloise.social",
|
||||
"blizan.ch",
|
||||
"buehnenbande.ch",
|
||||
"cdn.army",
|
||||
"cdn.exposed",
|
||||
"cdn.garden",
|
||||
"cdn.gmbh",
|
||||
"cloudscale.ch",
|
||||
"compass-security.com",
|
||||
"cori.us",
|
||||
"emh.ch",
|
||||
"ergon.ch",
|
||||
"example.com",
|
||||
"exoscale.com",
|
||||
"familie.st",
|
||||
"family.st",
|
||||
"felizian.ch",
|
||||
"felizian.st",
|
||||
"fst.ch",
|
||||
"fst.dev",
|
||||
"g8.co",
|
||||
"g8.com",
|
||||
"g8.io",
|
||||
"g8.is",
|
||||
"g8.lol",
|
||||
"g8.net",
|
||||
"g8.nz",
|
||||
"g8.re",
|
||||
"g8.si",
|
||||
"gr8.click",
|
||||
"gwydi.me",
|
||||
"heller.support",
|
||||
"home.cern",
|
||||
"incline.ch",
|
||||
"liip.ch",
|
||||
"linuxfabrik.ch",
|
||||
"mojang.studio",
|
||||
"nilu.ch",
|
||||
"nqa.ch",
|
||||
"open-systems.com",
|
||||
"oriented.net",
|
||||
"phynecs.com",
|
||||
"poisoned.app",
|
||||
"poisonedapple.ch",
|
||||
"puzzle.ch",
|
||||
"redhat.ch",
|
||||
"rievo.app",
|
||||
"rievo.cc",
|
||||
"rievo.ch",
|
||||
"rievo.co",
|
||||
"rievo.co.uk",
|
||||
"rievo.com",
|
||||
"rievo.cz",
|
||||
"rievo.de",
|
||||
"rievo.dev",
|
||||
"rievo.eu",
|
||||
"rievo.eu.org",
|
||||
"rievo.group",
|
||||
"rievo.host",
|
||||
"rievo.info",
|
||||
"rievo.io",
|
||||
"rievo.net",
|
||||
"rievo.org",
|
||||
"rievo.page",
|
||||
"rievo.swiss",
|
||||
"rievo.systems",
|
||||
"rievo.uk",
|
||||
"rievo.us",
|
||||
"rievo.xyz",
|
||||
"rv.gy",
|
||||
"rvo.co",
|
||||
"rvo.com",
|
||||
"rvo.net",
|
||||
"rvo.one",
|
||||
"rvo.re",
|
||||
"schuer.ch",
|
||||
"schuerch.ch",
|
||||
"schuerch.co",
|
||||
"schuerch.com",
|
||||
"schuerch.dev",
|
||||
"schuerch.id",
|
||||
"schuerch.net",
|
||||
"schuerch.xyz",
|
||||
"schur.ch",
|
||||
"schurch.ch",
|
||||
"schurch.com",
|
||||
"schurch.dev",
|
||||
"schurch.net",
|
||||
"schwabe.ch",
|
||||
"scrib.li",
|
||||
"seraphimstrub.com",
|
||||
"signage.ch",
|
||||
"sos-esport.com",
|
||||
"sos-esports.com",
|
||||
"sst.ch",
|
||||
"sst.dev",
|
||||
"sst.place",
|
||||
"strub.cc",
|
||||
"strub.ch",
|
||||
"strub.co",
|
||||
"strub.com",
|
||||
"strub.consulting",
|
||||
"strub.info",
|
||||
"strub.net",
|
||||
"strub.one",
|
||||
"strub.org",
|
||||
"strub.st",
|
||||
"strub.swiss",
|
||||
"strub.xyz",
|
||||
"switzer.land",
|
||||
"swizer.land",
|
||||
"thehat.ch",
|
||||
"threema.ch",
|
||||
"ti8m.com",
|
||||
"trashcitizen.com",
|
||||
"unlogis.ch",
|
||||
"vshn.ch",
|
||||
"xii.st"
|
||||
]
|
||||
{
|
||||
"1488": [
|
||||
"ch"
|
||||
],
|
||||
"ascii": [
|
||||
"tools"
|
||||
],
|
||||
"astonish": [
|
||||
"ch"
|
||||
],
|
||||
"astonishing": [
|
||||
"ch"
|
||||
],
|
||||
"attribution": [
|
||||
"ch"
|
||||
],
|
||||
"baloise": [
|
||||
"ch",
|
||||
"com",
|
||||
"social"
|
||||
],
|
||||
"blizan": [
|
||||
"ch"
|
||||
],
|
||||
"buehnenbande": [
|
||||
"ch"
|
||||
],
|
||||
"cdn": [
|
||||
"army",
|
||||
"exposed",
|
||||
"garden",
|
||||
"gmbh"
|
||||
],
|
||||
"cloudscale": [
|
||||
"ch"
|
||||
],
|
||||
"compass-security": [
|
||||
"com"
|
||||
],
|
||||
"cori": [
|
||||
"us"
|
||||
],
|
||||
"emh": [
|
||||
"ch"
|
||||
],
|
||||
"ergon": [
|
||||
"ch"
|
||||
],
|
||||
"example": [
|
||||
"com"
|
||||
],
|
||||
"exoscale": [
|
||||
"com"
|
||||
],
|
||||
"familie": [
|
||||
"st"
|
||||
],
|
||||
"family": [
|
||||
"st"
|
||||
],
|
||||
"felizian": [
|
||||
"ch",
|
||||
"st"
|
||||
],
|
||||
"fst": [
|
||||
"ch",
|
||||
"dev"
|
||||
],
|
||||
"g8": [
|
||||
"co",
|
||||
"com",
|
||||
"io",
|
||||
"is",
|
||||
"lol",
|
||||
"net",
|
||||
"nz",
|
||||
"re",
|
||||
"si"
|
||||
],
|
||||
"gr8": [
|
||||
"click"
|
||||
],
|
||||
"gwydi": [
|
||||
"me"
|
||||
],
|
||||
"heller": [
|
||||
"support"
|
||||
],
|
||||
"home": [
|
||||
"cern"
|
||||
],
|
||||
"incline": [
|
||||
"ch"
|
||||
],
|
||||
"liip": [
|
||||
"ch"
|
||||
],
|
||||
"linuxfabrik": [
|
||||
"ch"
|
||||
],
|
||||
"mojang": [
|
||||
"studio"
|
||||
],
|
||||
"nilu": [
|
||||
"ch"
|
||||
],
|
||||
"nqa": [
|
||||
"ch"
|
||||
],
|
||||
"open-systems": [
|
||||
"com"
|
||||
],
|
||||
"oriented": [
|
||||
"net"
|
||||
],
|
||||
"phynecs": [
|
||||
"com"
|
||||
],
|
||||
"poisoned": [
|
||||
"app"
|
||||
],
|
||||
"poisonedapple": [
|
||||
"ch"
|
||||
],
|
||||
"puzzle": [
|
||||
"ch"
|
||||
],
|
||||
"redhat": [
|
||||
"ch"
|
||||
],
|
||||
"rievo": [
|
||||
"app",
|
||||
"cc",
|
||||
"ch",
|
||||
"co",
|
||||
"co.uk",
|
||||
"com",
|
||||
"cz",
|
||||
"de",
|
||||
"dev",
|
||||
"eu",
|
||||
"eu.org",
|
||||
"group",
|
||||
"host",
|
||||
"io",
|
||||
"net",
|
||||
"org",
|
||||
"page",
|
||||
"swiss",
|
||||
"systems",
|
||||
"uk",
|
||||
"us",
|
||||
"xyz"
|
||||
],
|
||||
"rv": [
|
||||
"gy"
|
||||
],
|
||||
"rvo": [
|
||||
"co",
|
||||
"com",
|
||||
"net",
|
||||
"one",
|
||||
"re"
|
||||
],
|
||||
"schuer": [
|
||||
"ch"
|
||||
],
|
||||
"schuerch": [
|
||||
"ch",
|
||||
"co",
|
||||
"com",
|
||||
"dev",
|
||||
"id",
|
||||
"net",
|
||||
"xyz"
|
||||
],
|
||||
"schur": [
|
||||
"ch"
|
||||
],
|
||||
"schurch": [
|
||||
"ch",
|
||||
"com",
|
||||
"dev",
|
||||
"net"
|
||||
],
|
||||
"schwabe": [
|
||||
"ch"
|
||||
],
|
||||
"scrib": [
|
||||
"li"
|
||||
],
|
||||
"seraphimstrub": [
|
||||
"com"
|
||||
],
|
||||
"signage": [
|
||||
"ch"
|
||||
],
|
||||
"sos-esport": [
|
||||
"com"
|
||||
],
|
||||
"sos-esports": [
|
||||
"com"
|
||||
],
|
||||
"sst": [
|
||||
"ch",
|
||||
"dev",
|
||||
"place"
|
||||
],
|
||||
"strub": [
|
||||
"cc",
|
||||
"ch",
|
||||
"co",
|
||||
"com",
|
||||
"consulting",
|
||||
"info",
|
||||
"net",
|
||||
"one",
|
||||
"org",
|
||||
"st",
|
||||
"swiss",
|
||||
"xyz"
|
||||
],
|
||||
"switzer": [
|
||||
"land"
|
||||
],
|
||||
"swizer": [
|
||||
"land"
|
||||
],
|
||||
"thehat": [
|
||||
"ch"
|
||||
],
|
||||
"threema": [
|
||||
"ch"
|
||||
],
|
||||
"ti8m": [
|
||||
"com"
|
||||
],
|
||||
"trashcitizen": [
|
||||
"com"
|
||||
],
|
||||
"unlogis": [
|
||||
"ch"
|
||||
],
|
||||
"vshn": [
|
||||
"ch",
|
||||
"net"
|
||||
],
|
||||
"xii": [
|
||||
"st"
|
||||
]
|
||||
}
|
|
@ -65,8 +65,10 @@ func main() {
|
|||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
for _, d := range config.Domains {
|
||||
go checkDomain(0, d, query, client)
|
||||
for d, tlds := range config.Domains {
|
||||
for _, tld := range tlds {
|
||||
go checkDomain(0, fmt.Sprintf("%v.%v", d, tld), query, client)
|
||||
}
|
||||
}
|
||||
|
||||
case <-quit:
|
||||
|
@ -94,7 +96,7 @@ func checkDomain(counter int, d string, query *db.Queries, client webhook.Client
|
|||
logger.Debug("domain did not change", slog.String("domain", d))
|
||||
return
|
||||
}
|
||||
logger.Info("domain changed changed", slog.String("domain", d))
|
||||
logger.Info("domain changed", slog.String("domain", d))
|
||||
counter += 1
|
||||
if counter >= 2 {
|
||||
go sendWebhook(client, domain, retrievedDomain)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue