148 lines
3.8 KiB
Text
148 lines
3.8 KiB
Text
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) {
|
|
<div class="w-full" hx-get={fmt.Sprintf("/files/%s/msoffice", fileid)} hx-trigger="load">
|
|
@skeleton.Skeleton(skeleton.Props{Class: "h-12 w-12 rounded-full"})
|
|
<p> loading <a href={templ.URL(fmt.Sprintf("/files/%s/msoffice", fileid))}>Microsoft Office Info</a></p>
|
|
</div>
|
|
}
|
|
|
|
templ FileViewMsoffice(data sqlc.Msoffice) {
|
|
<div class="w-full">
|
|
<h2 class="text-3xl">Microsoft Office</h2>
|
|
if data.Verdict.String == "suspicious" {
|
|
@badge.Badge(badge.Props{
|
|
Variant: badge.VariantDestructive,
|
|
}) {
|
|
@icon.FileWarning(icon.Props{Size: 14})
|
|
Suspicious
|
|
}
|
|
}
|
|
<h3 class="text-2xl"> File properties </h3>
|
|
@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)
|
|
</div>
|
|
}
|
|
|
|
templ FileViewMsofficeOleVBAResults(results [][]string) {
|
|
<h3 class="text-2xl">OLEVBA results</h3>
|
|
@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) {
|
|
<h3 class="text-2xl">Macros</h3>
|
|
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()
|
|
}
|