Yvan Janssens
8a61a52fa1
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
43 lines
991 B
Go
43 lines
991 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
)
|
|
|
|
func banner() {
|
|
fmt.Println(" _ \n _ __ ___ __ _| |___ ___ __ _ _ __ \n| '_ ` _ \\ / _` | / __|/ __/ _` | '_ \\ \n| | | | | | (_| | \\__ \\ (_| (_| | | | |\n|_| |_| |_|\\__,_|_|___/\\___\\__,_|_| |_|\n ")
|
|
fmt.Println("malscan v0.1 microservice")
|
|
fmt.Println("")
|
|
}
|
|
|
|
func sanity_check() (bool, int) {
|
|
vName, error, sigNo := scan_data([]byte("X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*"))
|
|
if error != nil && vName == "" {
|
|
panic(error)
|
|
}
|
|
if vName == "Win.Test.EICAR_HDB-1" {
|
|
return true, sigNo
|
|
}
|
|
return false, 0
|
|
}
|
|
|
|
func main() {
|
|
|
|
banner()
|
|
// start freshclam goroutine
|
|
go freshclam_update()
|
|
|
|
log.Println("Carrying out sanity checks...")
|
|
scannerIsSane, _ := sanity_check()
|
|
if !scannerIsSane {
|
|
log.Println("Sanity check failed!")
|
|
return
|
|
}
|
|
log.Println("Sanity check passed! Continuing startup...")
|
|
|
|
// start API
|
|
start_api()
|
|
|
|
}
|