Compare commits

..

No commits in common. "0752a7e443c6501a70e7654c313016d121df74bf" and "740e0a387b583c37ffdc3362c5e39a8f95f3f114" have entirely different histories.

9 changed files with 179 additions and 232 deletions

View File

@ -40,7 +40,7 @@ func ZabovCreateKDB(conf string) {
if err != nil { if err != nil {
fmt.Println("Cannot create Killfile db: ", err.Error()) fmt.Println("Cannot create Killfile db: ", err.Error())
} else { } else {
fmt.Println("Killfile DB created:", dbname) fmt.Println("Killfile DB created")
} }
MyZabovKDBs[conf] = KDB MyZabovKDBs[conf] = KDB

View File

@ -88,14 +88,12 @@ func init() {
//******************* //*******************
// IP aliases section // IP aliases section
//******************* //*******************
if MyConf["ipaliases"] != nil {
IPAliasesRaw := MyConf["ipaliases"].(map[string]interface{}) IPAliasesRaw := MyConf["ipaliases"].(map[string]interface{})
for alias, ip := range IPAliasesRaw { for alias, ip := range IPAliasesRaw {
fmt.Println("IP Alias:", alias, ip) fmt.Println("IP Alias:", alias, ip)
ZabovIPAliases[alias] = ip.(string) ZabovIPAliases[alias] = ip.(string)
} }
}
//**************** //****************
// configs section // configs section
@ -121,7 +119,6 @@ func init() {
//******************* //*******************
// timetables section // timetables section
//******************* //*******************
if MyConf["timetables"] != nil {
timetables := MyConf["timetables"].(map[string]interface{}) timetables := MyConf["timetables"].(map[string]interface{})
for name, v := range timetables { for name, v := range timetables {
@ -189,12 +186,10 @@ func init() {
} }
ZabovTimetables[name] = &timetable ZabovTimetables[name] = &timetable
} }
}
//****************** //******************
// IP groups section // IP groups section
//****************** //******************
if MyConf["ipgroups"] != nil {
IPGroups := MyConf["ipgroups"].([]interface{}) IPGroups := MyConf["ipgroups"].([]interface{})
fmt.Println("evaluating IP Groups: ", len(IPGroups)) fmt.Println("evaluating IP Groups: ", len(IPGroups))
@ -236,7 +231,6 @@ func init() {
} }
ZabovIPGroups = append(ZabovIPGroups, groupStruct) ZabovIPGroups = append(ZabovIPGroups, groupStruct)
} }
}
if zabov["timetable"] != nil { if zabov["timetable"] != nil {
ZabovDefaultTimetable = zabov["timetable"].(string) ZabovDefaultTimetable = zabov["timetable"].(string)
@ -250,7 +244,6 @@ func init() {
//************************ //************************
// Local responser section // Local responser section
//************************ //************************
if MyConf["localresponder"] != nil {
localresponder := MyConf["localresponder"].(map[string]interface{}) localresponder := MyConf["localresponder"].(map[string]interface{})
if localresponder != nil { if localresponder != nil {
@ -266,9 +259,9 @@ func init() {
ZabovLocalDomain = localresponder["localdomain"].(string) ZabovLocalDomain = localresponder["localdomain"].(string)
} }
} }
}
//****************************************** //******************************************
// clearing unused configs to save resources // clearing unused config to save resources
//****************************************** //******************************************
for name, conf := range ZabovConfigs { for name, conf := range ZabovConfigs {
if conf.references == 0 { if conf.references == 0 {

View File

@ -1,4 +1,4 @@
FROM arm64v8/golang:1.15.6 AS builder FROM golang:1.14.1 AS builder
RUN apt install git -y RUN apt install git -y
RUN mkdir -p /go/src/zabov RUN mkdir -p /go/src/zabov
RUN git clone https://git.keinpfusch.net/loweel/zabov /go/src/zabov RUN git clone https://git.keinpfusch.net/loweel/zabov /go/src/zabov
@ -17,3 +17,4 @@ COPY --from=builder /go/src/zabov /opt/zabov
EXPOSE 53/udp EXPOSE 53/udp
ENV TZ Europe/Rome ENV TZ Europe/Rome
ENTRYPOINT ["/opt/zabov/zabov"] ENTRYPOINT ["/opt/zabov/zabov"]

View File

@ -1,4 +1,4 @@
FROM arm64v8/golang:1.15.6 AS builder FROM arm32v7/golang:1.14.1 AS builder
RUN apt install git -y RUN apt install git -y
RUN mkdir -p /go/src/zabov RUN mkdir -p /go/src/zabov
RUN git clone https://git.keinpfusch.net/loweel/zabov /go/src/zabov RUN git clone https://git.keinpfusch.net/loweel/zabov /go/src/zabov

View File

@ -1,4 +1,4 @@
FROM arm64v8/golang:1.15.6 AS builder FROM arm64v8/golang:1.14.1 AS builder
RUN apt install git -y RUN apt install git -y
RUN mkdir -p /go/src/zabov RUN mkdir -p /go/src/zabov
RUN git clone https://git.keinpfusch.net/loweel/zabov /go/src/zabov RUN git clone https://git.keinpfusch.net/loweel/zabov /go/src/zabov

View File

@ -6,6 +6,28 @@
"cachettl": 1, "cachettl": 1,
"killfilettl": 12 "killfilettl": 12
}, },
"localresponder":{
"responder":"192.168.178.1:53",
"localdomain":"fritz.box"
},
"ipaliases":{
"pc8":"192.168.178.29",
"localhost":"127.0.0.1"
},
"ipgroups":[
{
"ips":["localhost", "::1", "192.168.178.30", "192.168.178.31", "pc8"],
"cfg":"",
"timetable":"tt_children"
}
],
"timetables":{
"tt_children":{
"tables":[{"times":"00:00-05:00;8:30-12:30;18:30-22:59", "days":"Mo;Tu;We;Th;Fr;Sa;Su"}],
"cfgin":"children_restricted",
"cfgout":"children"
}
},
"configs":{ "configs":{
"default":{ "default":{
"upstream":"./dns-upstream.txt", "upstream":"./dns-upstream.txt",
@ -13,6 +35,21 @@
"doublefilters":"./urls-hosts.txt", "doublefilters":"./urls-hosts.txt",
"blackholeip":"127.0.0.1", "blackholeip":"127.0.0.1",
"hostsfile":"./urls-local.txt" "hostsfile":"./urls-local.txt"
},
"children":{
"upstream":"./dns-upstream.txt",
"singlefilters":"./urls-domains.txt",
"doublefilters":"./urls-hosts.txt",
"blackholeip":"127.0.0.1",
"hostsfile":"./urls-local.txt"
},
"children_restricted":{
"upstream":"./dns-upstream.txt",
"singlefilters":"./urls-domains.txt",
"doublefilters":"./urls-hosts.txt",
"blackholeip":"127.0.0.1",
"hostsfile":"./urls-local.txt"
} }
} }
} }

View File

@ -1,57 +0,0 @@
{
"zabov":{
"port":"53",
"proto":"udp",
"ipaddr":"0.0.0.0",
"cachettl": 1,
"killfilettl": 12,
"debug":"true",
"debugdbpath":"./logs",
"timetable":""
},
"localresponder":{
"responder":"192.168.1.1:53",
"localdomain":".local"
},
"ipaliases":{
"pc8":"192.168.1.2",
},
"ipgroups":[
{
"ips":["pc8"],
"cfg":"",
"timetable":"tt_children"
}
],
"timetables":{
"tt_children":{
"tables":[{"times":"9:30-11:30", "days":"Mo;Tu;We;Th;Fr;Sa"}],
"cfgin":"children_restricted",
"cfgout":"children"
}
},
"configs":{
"default":{
"upstream":"./dns-upstream.txt",
"singlefilters":"./urls-domains-updated.txt",
"doublefilters":"./urls-hosts-normal.txt",
"blackholeip":"127.0.0.1",
"hostsfile":"./urls-local-normal.txt"
},
"children":{
"upstream":"./dns-familyscreen.txt",
"singlefilters":"./urls-domains-updated.txt",
"doublefilters":"./urls-hosts-nofb.txt",
"blackholeip":"127.0.0.1",
"hostsfile":"./urls-local-normal.txt"
},
"children_restricted":{
"upstream":"./dns-familyscreen.txt",
"singlefilters":"./urls-domains-updated.txt",
"doublefilters":"./urls-hosts-nofb.txt",
"blackholeip":"127.0.0.1",
"hostsfile":"./urls-local-restricted.txt"
}
}
}

View File

@ -16,20 +16,7 @@ var reqTypes map[uint16]string
var weekdays []string var weekdays []string
type logItem struct {
clientIP string
name string
reqType uint16
config string
timetable string
killed string
}
// logChannel used by logging thread
var logChannel chan logItem
func init() { func init() {
weekdays = []string{"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"} weekdays = []string{"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"}
if len(ZabovDebugDBPath) > 0 { if len(ZabovDebugDBPath) > 0 {
@ -120,18 +107,13 @@ func init() {
dns.TypeReserved: "TypeReserved"} dns.TypeReserved: "TypeReserved"}
fmt.Println("Local Time:", getLocalTime().Format(time.ANSIC)) fmt.Println("Local Time:", getLocalTime().Format(time.ANSIC))
if len(ZabovDebugDBPath) > 0 {
logChannel = make(chan logItem, 1024)
go logWriteThread()
}
} }
func logWriteThread() { func logQuery(clientIP string, name string, reqType uint16, config string, timetable string, killed string) {
for item := range logChannel { if len(ZabovDebugDBPath) > 0 {
var header string var header string
d := time.Now().Format("2006-01-02") d := time.Now().Format("2006-01-02")
logpath := path.Join(ZabovDebugDBPath, strings.Replace(item.clientIP, ":", "_", -1)+"-"+d+".log") logpath := path.Join(ZabovDebugDBPath, strings.Replace(clientIP, ":", "_", -1)+"-"+d+".log")
_, err1 := os.Stat(logpath) _, err1 := os.Stat(logpath)
if os.IsNotExist(err1) { if os.IsNotExist(err1) {
@ -139,12 +121,12 @@ func logWriteThread() {
} }
f, err := os.OpenFile(logpath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) f, err := os.OpenFile(logpath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err == nil { if err == nil {
reqTypeName, err := reqTypes[item.reqType] reqTypeName, err := reqTypes[reqType]
if !err { if !err {
reqTypeName = fmt.Sprintf("%d", item.reqType) reqTypeName = fmt.Sprintf("%d", reqType)
} }
ct := time.Now().Format(time.RFC3339) ct := time.Now().Format(time.RFC3339)
log := strings.Join([]string{ct, item.clientIP, strings.TrimRight(item.name, "."), reqTypeName, item.config, item.timetable, item.killed}, "\t") log := strings.Join([]string{ct, clientIP, strings.TrimRight(name, "."), reqTypeName, config, timetable, killed}, "\t")
if len(header) > 0 { if len(header) > 0 {
f.Write([]byte(header)) f.Write([]byte(header))
f.Write([]byte("\n")) f.Write([]byte("\n"))
@ -156,15 +138,6 @@ func logWriteThread() {
} }
} }
func logQuery(clientIP string, name string, reqType uint16, config string, timetable string, killed string) {
if len(ZabovDebugDBPath) > 0 {
k := logItem{clientIP: clientIP, name: name, reqType: reqType, config: config, timetable: timetable, killed: killed}
logChannel <- k
}
}
func getLocalTime() time.Time { func getLocalTime() time.Time {
return time.Now().Local() return time.Now().Local()
} }

View File

@ -1,8 +1,12 @@
https://mirror1.malwaredomains.com/files/justdomains
https://raw.githubusercontent.com/hectorm/hmirror/master/data/adaway.org/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/adaway.org/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/adblock-nocoin-list/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/adblock-nocoin-list/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/adguard-simplified/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/adguard-simplified/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/antipopads/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/anudeepnd-adservers/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/digitalside-threat-intel/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/disconnect.me-ad/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/disconnect.me-malvertising/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/disconnect.me-malware/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/disconnect.me-tracking/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/easylist/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/easylist/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/easyprivacy/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/easyprivacy/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/eth-phishing-detect/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/eth-phishing-detect/list.txt
@ -10,28 +14,24 @@ https://raw.githubusercontent.com/hectorm/hmirror/master/data/fademind-add.2o7ne
https://raw.githubusercontent.com/hectorm/hmirror/master/data/fademind-add.dead/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/fademind-add.dead/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/fademind-add.risk/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/fademind-add.risk/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/fademind-add.spam/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/fademind-add.spam/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/gfrogeye-firstparty-trackers/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/hostsvn/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/kadhosts/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/kadhosts/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/lightswitch05-ads-and-tracking/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/malwaredomainlist.com/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/malwaredomains.com-immortaldomains/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/malwaredomains.com-justdomains/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/matomo.org-spammers/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/matomo.org-spammers/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/mitchellkrogza-badd-boyz-hosts/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/mitchellkrogza-badd-boyz-hosts/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/pgl.yoyo.org/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/pgl.yoyo.org/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/phishing.army/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/ransomwaretracker.abuse.ch/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/socram8888-notonmyshift/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/someonewhocares.org/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/someonewhocares.org/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/spam404.com/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/spam404.com/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/stevenblack/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/stevenblack/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/ublock/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/ublock-abuse/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/ublock-badware/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/ublock-privacy/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/urlhaus/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/winhelp2002.mvps.org/list.txt https://raw.githubusercontent.com/hectorm/hmirror/master/data/winhelp2002.mvps.org/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/zerodot1-coinblockerlists-browser/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/zeustracker.abuse.ch/list.txt
https://raw.githubusercontent.com/CHEF-KOCH/Audio-fingerprint-pages/master/AudioFp.txt
https://raw.githubusercontent.com/CHEF-KOCH/Canvas-fingerprinting-pages/master/Canvas.txt
https://raw.githubusercontent.com/CHEF-KOCH/WebRTC-tracking/master/WebRTC.txt
https://raw.githubusercontent.com/CHEF-KOCH/CKs-FilterList/master/Anti-Corp/hosts/NSABlocklist.txt
https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-blocklist.txt https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-blocklist.txt
https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-malware.txt https://gitlab.com/quidsup/notrack-blocklists/raw/master/notrack-malware.txt
https://www.stopforumspam.com/downloads/toxic_domains_whole.txt https://www.stopforumspam.com/downloads/toxic_domains_whole.txt
https://mirror.cedia.org.ec/malwaredomains/immortal_domains.txt