updated ipbl

This commit is contained in:
Paul 2022-09-18 10:23:24 +02:00
parent 3f000cbf8f
commit 77e57b4f7d
3 changed files with 14 additions and 11 deletions

View File

@ -55,18 +55,18 @@ func (cfg *Config) GetConfig() error {
} }
type Config struct { type Config struct {
Db *xorm.Engine `json:"-"` Db *xorm.Engine
DbParams struct { DbParams struct {
DbHostname string DbHostname string
DbUsername string DbUsername string
DbPassword string DbPassword string
DbDatabase string DbDatabase string
} `json:"-"` }
Options struct { Options struct {
Version string Version string
HideBanner bool HideBanner bool
ZMQChannel string ZMQChannel string
} `json:"-"` }
Switchs struct { Switchs struct {
Port int Port int
NoFeed bool NoFeed bool
@ -75,5 +75,5 @@ type Config struct {
Init bool Init bool
Version bool Version bool
NoScanIP bool NoScanIP bool
} `json:"-"` }
} }

View File

@ -219,4 +219,5 @@ type APIIP struct {
City string `json:"city"` City string `json:"city"`
Country string `json:"country"` Country string `json:"country"`
Date string `json:"date"` Date string `json:"date"`
Mode string `json:"mode"`
} }

View File

@ -49,6 +49,7 @@ func Handle(cfg *config.Config, reqsock *goczmq.Sock, pubsock *goczmq.Sock, chan
log.Println("unable to parse ip address", err) log.Println("unable to parse ip address", err)
continue continue
} }
if apiip.IP != "init" {
ip = *apiip.APIConvert() ip = *apiip.APIConvert()
numinsert, numupdate, err := ip.InsertOrUpdate(cfg) numinsert, numupdate, err := ip.InsertOrUpdate(cfg)
@ -56,9 +57,10 @@ func Handle(cfg *config.Config, reqsock *goczmq.Sock, pubsock *goczmq.Sock, chan
log.Println(err) log.Println(err)
} }
log.Printf("zmq: Inserted %d IP, Updated %d IP\n", numinsert, numupdate) log.Printf("zmq: Inserted %d IP, Updated %d IP\n", numinsert, numupdate)
}
tmpval := fmt.Sprintf("%s %s", channel, string(val)) tmpval := fmt.Sprintf("%s %s", channel, string(val))
val = []byte(tmpval) ipjson := []byte(tmpval)
topub = append(topub, val) topub = append(topub, ipjson)
} }
err = pubsock.SendMessage(topub) err = pubsock.SendMessage(topub)