package web
import (
"git.jmbit.de/jmb/scanfile/server/internal/sqlc"
"git.jmbit.de/jmb/scanfile/server/web/templui/components/badge"
"git.jmbit.de/jmb/scanfile/server/web/templui/components/icon"
"git.jmbit.de/jmb/scanfile/server/web/templui/components/table"
"git.jmbit.de/jmb/scanfile/server/web/templui/components/accordion"
"git.jmbit.de/jmb/scanfile/server/web/templui/components/code"
"git.jmbit.de/jmb/scanfile/server/web/templui/components/skeleton"
"fmt"
)
// Loads MSOffice data if required
templ FileViewMsofficeLoader(fileid string) {
}
templ FileViewMsoffice(data sqlc.Msoffice) {
Microsoft Office
if data.Verdict.String == "suspicious" {
@badge.Badge(badge.Props{
Variant: badge.VariantDestructive,
}) {
@icon.FileWarning(icon.Props{Size: 14})
Suspicious
}
}
File properties
@table.Table() {
@table.Row() {
@table.Cell() {
Container
}
@table.Cell() {
{data.ContainerFormat.String}
}
}
@table.Row() {
@table.Cell() {
Encrypted
}
@table.Cell() {
{fmt.Sprintf("%v",data.Encrypted.Bool)}
}
}
@table.Row() {
@table.Cell() {
File Format
}
@table.Cell() {
{data.FileFormat.String}
}
}
@table.Row() {
@table.Cell() {
VBA Macros Result
}
@table.Cell() {
{data.VbaMacros.String}
}
}
@table.Row() {
@table.Cell() {
XLM Macros Result
}
@table.Cell() {
{data.XlmMacros.String}
}
}
@table.Row() {
@table.Cell() {
VBA Stomping
}
@table.Cell() {
if data.VbaStomping.Bool {
Yes
} else {
No
}
}
}
}
@FileViewMsofficeOleVBAResults(data.OlevbaResults)
@FileViewMsofficeOleMacros(data.Macros)
}
templ FileViewMsofficeOleVBAResults(results [][]string) {
OLEVBA results
@table.Table() {
@table.Header() {
@table.Head() {
Type
}
@table.Head() {
Keyword
}
@table.Head() {
Description
}
}
@table.Body() {
for _, row := range results {
@table.Row() {
@table.Cell() {
{row[0]}
}
@table.Cell() {
{row[1]}
}
@table.Cell() {
{row[2]}
}
}
}
}
}
}
templ FileViewMsofficeOleMacros(macros [][]string) {
Macros
for _, macro := range macros {
@accordion.Accordion(accordion.Props{
Class: "w-full",
}) {
@accordion.Item() {
@accordion.Trigger() {
File: {macro[0]}, Subfile: {macro[1]}, Stream: {macro[2]}
}
@accordion.Content() {
@code.Code(code.Props{
Language: "vb",
ShowCopyButton: true,
}) {
{ macro[3] }
}
}
}
}
}
@code.Script()
}