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 {
Db *xorm.Engine `json:"-"`
Db *xorm.Engine
DbParams struct {
DbHostname string
DbUsername string
DbPassword string
DbDatabase string
} `json:"-"`
}
Options struct {
Version string
HideBanner bool
ZMQChannel string
} `json:"-"`
}
Switchs struct {
Port int
NoFeed bool
@ -75,5 +75,5 @@ type Config struct {
Init bool
Version bool
NoScanIP bool
} `json:"-"`
}
}

View File

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

View File

@ -49,16 +49,18 @@ func Handle(cfg *config.Config, reqsock *goczmq.Sock, pubsock *goczmq.Sock, chan
log.Println("unable to parse ip address", err)
continue
}
ip = *apiip.APIConvert()
if apiip.IP != "init" {
ip = *apiip.APIConvert()
numinsert, numupdate, err := ip.InsertOrUpdate(cfg)
if err != nil {
log.Println(err)
numinsert, numupdate, err := ip.InsertOrUpdate(cfg)
if err != nil {
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))
val = []byte(tmpval)
topub = append(topub, val)
ipjson := []byte(tmpval)
topub = append(topub, ipjson)
}
err = pubsock.SendMessage(topub)