diff --git a/server/web/fileView.go b/server/web/fileView.go
index 30ab5c0..f333f88 100644
--- a/server/web/fileView.go
+++ b/server/web/fileView.go
@@ -25,7 +25,13 @@ func FileViewWebHandler(w http.ResponseWriter, r *http.Request) {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
- component := FileView(file, fileProperties)
+ diec, err := database.GetFileDiec(file.ID)
+ if err != nil {
+ slog.Error("Error getting Detect-It-Easy in FileViewWebHandler", "error", err, "file-uuid", r.PathValue("uuid"))
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+ component := FileView(file, fileProperties, diec)
err = component.Render(r.Context(), w)
if err != nil {
slog.Error("Error rendering in FileViewWebHandler", "error", err)
diff --git a/server/web/fileView.templ b/server/web/fileView.templ
index b3e172c..2fd81c0 100644
--- a/server/web/fileView.templ
+++ b/server/web/fileView.templ
@@ -6,8 +6,9 @@ import "git.jmbit.de/jmb/scanfile/server/web/templui/components/modal"
import "git.jmbit.de/jmb/scanfile/server/internal/processing"
import "fmt"
import "git.jmbit.de/jmb/scanfile/server/web/templui/components/icon"
+import "git.jmbit.de/jmb/scanfile/server/internal/database"
-templ FileView(file sqlc.File, fileProperties sqlc.FileProperty) {
+templ FileView(file sqlc.File, fileProperties sqlc.FileProperty, diec database.Diec) {
@Base(file.Name) {
{file.Name}
@@ -15,12 +16,11 @@ templ FileView(file sqlc.File, fileProperties sqlc.FileProperty) {
@FileViewDownloadModal(file.ID.String())
- @FileViewGenericTable(file, fileProperties)
+ @FileViewGenericTable(file, fileProperties, diec)
if processing.TypeFromMime(file.Mimetype) == processing.TypeMSOffice {
@FileViewMsofficeLoader(file.ID.String())
}
-
}
}
diff --git a/server/web/fileViewGeneric.templ b/server/web/fileViewGeneric.templ
index 822c330..aee9092 100644
--- a/server/web/fileViewGeneric.templ
+++ b/server/web/fileViewGeneric.templ
@@ -5,8 +5,9 @@ import "git.jmbit.de/jmb/scanfile/server/web/templui/components/table"
import "git.jmbit.de/jmb/scanfile/server/web/templui/components/button"
import "encoding/hex"
import "fmt"
+import "git.jmbit.de/jmb/scanfile/server/internal/database"
-templ FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) {
+templ FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty, diec database.Diec) {
Generic Information
@table.Table() {
@@ -71,7 +72,7 @@ templ FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) {
}
}
}
- if fileProperties.LibmagicApple.Valid {
+ if fileProperties.LibmagicApple.Valid && fileProperties.LibmagicApple.String != "UNKNUNKN" {
@table.Row() {
@table.Cell() {
Apple Filetype
@@ -90,17 +91,65 @@ templ FileViewGenericTable(file sqlc.File, fileProperties sqlc.FileProperty) {
}
}
}
+ @DiecInfo(diec)
+ @OtherServices(hex.EncodeToString(fileProperties.Sha256))
+
+}
- Look for this file on other services
+templ DiecInfo(diec database.Diec) {
+ Detect-It-Easy information
+ @table.Table() {
+ @table.Header() {
+ @table.Head() {
+ Info
+ }
+ @table.Head() {
+ Name
+ }
+ @table.Head() {
+ Type
+ }
+ @table.Head() {
+ Details
+ }
+ @table.Head() {
+ Version
+ }
+ }
+ @table.Body() {
+ for _, row := range diec.Data.Detects[0].Values {
+ @table.Row() {
+ @table.Cell() {
+ {row.Info}
+ }
+ @table.Cell() {
+ {row.Name}
+ }
+ @table.Cell() {
+ {row.Type}
+ }
+ @table.Cell() {
+ {row.String}
+ }
+ @table.Cell() {
+ {row.Version}
+ }
+ }
+ }
+ }
+ }
+}
+
+templ OtherServices(sha256 string) {
+ Look for this file on other Services
@button.Button(button.Props{
Variant: button.VariantOutline,
- Href: fmt.Sprintf("https://www.virustotal.com/gui/file/%s", hex.EncodeToString(fileProperties.Sha256)),
+ Href: fmt.Sprintf("https://www.virustotal.com/gui/file/%s", sha256),
}) {VirusTotal}
@button.Button(button.Props{
Variant: button.VariantOutline,
- Href: fmt.Sprintf("https://bazaar.abuse.ch/sample/%s", hex.EncodeToString(fileProperties.Sha256)),
+ Href: fmt.Sprintf("https://bazaar.abuse.ch/sample/%s", sha256),
}) {Malware Bazaar}
-
}