Esempio n. 1
0
func initClamAV() *clamav.Engine {
	engine := clamav.New()
	sigs, err := engine.Load(clamav.DBDir(), clamav.DbStdopt)
	if err != nil {
		log.Fatalf("can not initialize ClamAV engine: %v", err)
	}
	if *debug {
		log.Printf("loaded %d signatures", sigs)
	}
	engine.Compile()

	return engine
}
Esempio n. 2
0
func initClamAV() *clamav.Engine {
	clamav.Init(clamav.InitDefault)
	engine := clamav.New()
	sigs, err := engine.Load(*db, clamav.DbStdopt)
	if err != nil {
		log.Fatalf("can not initialize ClamAV engine: %v", err)
	}
	if *debug {
		log.Printf("loaded %d signatures", sigs)
	}

	engine.SetPreCacheCallback(PreCacheCb)
	engine.SetPreScanCallback(PreScanCb)
	engine.SetPostScanCallback(PostScanCb)
	engine.SetHashCallback(HashCb)

	engine.Compile()

	return engine
}