go format

This commit is contained in:
Johannes Bülow 2025-07-25 12:43:28 +02:00
parent 4ee3a0be1a
commit cc8246c222
Signed by: jmb
GPG key ID: B56971CF7B8F83A6
18 changed files with 207 additions and 217 deletions

View file

@ -78,5 +78,4 @@ func GetAllFiles() ([]sqlc.File, error) {
}
return files, err
}

View file

@ -24,7 +24,6 @@ type olevbaResponse struct {
Stomping bool `json:"stomping"`
}
func OleVBAScan(fileID pgtype.UUID) (olevbaResponse, error) {
slog.Debug("Starting OLEvba scan", "file-uuid", fileID.String())
oleidUrl, err := url.Parse(viper.GetString("processing.oleurl"))

View file

@ -10,7 +10,6 @@ import (
"github.com/spf13/viper"
)
func TestOleVba(t *testing.T) {
slog.SetDefault(slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelDebug})))
viper.Set("processing.oleurl", "http://localhost:5000")

View file

@ -21,7 +21,7 @@ func compileSourcesFromFiles() error {
return err
}
cmd := exec.Command("/usr/local/bin/yr", "compile","--path-as-namespace", "--relaxed-re-syntax", "--output", outputPath, root)
cmd := exec.Command("/usr/local/bin/yr", "compile", "--path-as-namespace", "--relaxed-re-syntax", "--output", outputPath, root)
slog.Debug("Yara compile command", "cmd", cmd.String())
result, err := cmd.Output()
if err != nil {
@ -46,7 +46,7 @@ func scanFile(fileName string) ([]string, error) {
slog.Error("Error in Yara Scan", "file-uuid", fileName, "error", err)
return matched, err
}
cmd := exec.Command("/usr/local/bin/yr", "scan", "--output-format ndjson", "--print-namespace","--compiled-rules", outputPath, fullPath)
cmd := exec.Command("/usr/local/bin/yr", "scan", "--output-format ndjson", "--print-namespace", "--compiled-rules", outputPath, fullPath)
slog.Debug("Yara scan command", "cmd", cmd.String())
result, err := cmd.Output()
if err != nil {

View file

@ -5,7 +5,7 @@ import (
"git.jmbit.de/jmb/scanfile/server/internal/sqlc"
)
func InitYara() error{
func InitYara() error {
return compileSourcesFromFiles()
}
@ -27,6 +27,5 @@ func YaraProcessing(job sqlc.ProcessingJob) error {
return err
}
return nil
}

View file

@ -27,11 +27,10 @@ func GetFileType(fileId string) (string, error) {
// Returns the MimeType for a []byte
// Only pass the necessary data!
func GetBytesFileType(data []byte) (string) {
func GetBytesFileType(data []byte) string {
mimetype.SetLimit(uint32(viper.GetSizeInBytes("processing.maxmimesize")))
mtype := mimetype.Detect(data)
slog.Debug("GetBytesFileType", "file-mime", mtype.String())
return mtype.String()
}

View file

@ -41,7 +41,6 @@ func setconf() error {
return nil
}
func TestFileType(t *testing.T) {
err := setconf()
if err != nil {

View file

@ -7,8 +7,6 @@ import (
"git.jmbit.de/jmb/scanfile/server/internal/database"
)
func AdminWebHandler(w http.ResponseWriter, r *http.Request) {
jobs, err := database.ALlProcessingJobs()
if err != nil {
@ -23,5 +21,3 @@ func AdminWebHandler(w http.ResponseWriter, r *http.Request) {
return
}
}