155 lines
3.9 KiB
Text
155 lines
3.9 KiB
Text
package web
|
|
|
|
import "git.jmbit.de/jmb/scanfile/server/internal/sqlc"
|
|
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, diec database.Diec) {
|
|
<div class="w-full">
|
|
<h2 class="text-3xl">Generic Information</h2>
|
|
@table.Table() {
|
|
@table.Row() {
|
|
@table.Cell() {
|
|
Size
|
|
}
|
|
@table.Cell() {
|
|
{file.Size} Bytes
|
|
}
|
|
}
|
|
@table.Row() {
|
|
@table.Cell() {
|
|
Filetype
|
|
}
|
|
@table.Cell() {
|
|
{file.Mimetype}
|
|
}
|
|
|
|
}
|
|
@table.Row() {
|
|
@table.Cell() {
|
|
Blake2b Hash
|
|
}
|
|
@table.Cell() {
|
|
{hex.EncodeToString(file.Blake2)}
|
|
}
|
|
}
|
|
@table.Row() {
|
|
@table.Cell() {
|
|
SHA256 Hash
|
|
}
|
|
@table.Cell() {
|
|
{hex.EncodeToString(fileProperties.Sha256)}
|
|
}
|
|
}
|
|
@table.Row() {
|
|
@table.Cell() {
|
|
MD5 Hash
|
|
}
|
|
@table.Cell() {
|
|
{hex.EncodeToString(fileProperties.Md5)}
|
|
}
|
|
}
|
|
if fileProperties.LibmagicMime.Valid {
|
|
@table.Row() {
|
|
@table.Cell() {
|
|
Mimetype
|
|
}
|
|
@table.Cell() {
|
|
{fileProperties.LibmagicMime.String}
|
|
}
|
|
}
|
|
}
|
|
if fileProperties.LibmagicExtension.Valid {
|
|
@table.Row() {
|
|
@table.Cell() {
|
|
File Extensions
|
|
}
|
|
@table.Cell() {
|
|
{fileProperties.LibmagicExtension.String}
|
|
}
|
|
}
|
|
}
|
|
if fileProperties.LibmagicApple.Valid && fileProperties.LibmagicApple.String != "UNKNUNKN" {
|
|
@table.Row() {
|
|
@table.Cell() {
|
|
Apple Filetype
|
|
}
|
|
@table.Cell() {
|
|
{fileProperties.LibmagicApple.String}
|
|
}
|
|
}
|
|
}
|
|
@table.Row() {
|
|
@table.Cell() {
|
|
Uploaded
|
|
}
|
|
@table.Cell() {
|
|
{file.Created.Time.String()}
|
|
}
|
|
}
|
|
}
|
|
@DiecInfo(diec)
|
|
@OtherServices(hex.EncodeToString(fileProperties.Sha256))
|
|
</div>
|
|
}
|
|
|
|
templ DiecInfo(diec database.Diec) {
|
|
<h3 class="text-2xl">Detect-It-Easy information</h3>
|
|
@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) {
|
|
<h3 class="text-2xl">Look for this file on other Services</h3>
|
|
<div class="flex space-x-4 pb-4">
|
|
@button.Button(button.Props{
|
|
Variant: button.VariantOutline,
|
|
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", sha256),
|
|
}) {Malware Bazaar}
|
|
</div>
|
|
}
|