diff --git a/html/uploadfile.html b/html/uploadfile.html
index 27c8ed6..ecd0d74 100644
--- a/html/uploadfile.html
+++ b/html/uploadfile.html
@@ -2,13 +2,46 @@
Upload a File
-
+
-
+
+
{{end}}
\ No newline at end of file
diff --git a/main.go b/main.go
index deebaab..6ad9cc3 100644
--- a/main.go
+++ b/main.go
@@ -261,7 +261,7 @@ func upload() http.Handler {
fn,_:=os.OpenFile("Data/"+filename, os.O_CREATE, 0666)
fn.Write(fileBytes)
fn.Close()
- getParamsFromExif("Data/"+filename)
+ log.Println(getDataFromFile("Data/"+filename))
})}
// index creates an HTTP handler that serves the main page with data from the database.
diff --git a/packages.go b/packages.go
index 5688d64..4c984ae 100644
--- a/packages.go
+++ b/packages.go
@@ -3,9 +3,10 @@ package main
import (
"fmt"
"log"
- "regexp"
"os"
"os/exec"
+ "regexp"
+ "runtime"
"strconv"
)
@@ -65,21 +66,55 @@ type DownloadElements struct {
// Printer struct is an empty struct. Its purpose is not clear from the provided code.
type Printer struct{}
+func getDataFromFile(path string) map[string]string {
+ log.Println(regexp.MustCompile(`\.\w+$`).FindString(path))
+ switch extention := regexp.MustCompile(`\.\w+$`).FindString(path); extention {
+ case ".exe":
+ return getParamsFromExif(path)
+
+ case ".msi":
+ return getParamsFromMsi(path)
+ }
+ return make(map[string]string)
+}
+
// getParamsFromExif extracts EXIF parameters from a file at the given path using the exiftool command.
// It returns a map where the keys are the EXIF parameter names and the values are the corresponding EXIF parameter values.
-func getParamsFromExif(path string) map[string]string{
+func getParamsFromExif(path string) map[string]string {
exiftool := os.Getenv("exiftool")
- e,_ := exec.Command(exiftool, "-f", path).Output()
- tags:=make(map[string]string)
- spliter:=regexp.MustCompile(`\r?\n`)
- crop:=spliter.Split(string(e),-1)
- head := regexp.MustCompile(`\s+:\s`)
- for _,c := range crop{
- if(len(c)>1){
- data:=head.Split(c,-1)
- log.Println("My Raw Data: ", c)
- tags[data[0]]=data[1]}
+ e, _ := exec.Command(exiftool, "-f", path).Output()
+ return splitData(e)
+}
+func splitData(commandOutput []byte) map[string]string {
+ tags := make(map[string]string)
+ spliter := regexp.MustCompile(`\r?\n`)
+ crop := spliter.Split(string(commandOutput), -1)
+ head := regexp.MustCompile(`\s+(:\s)?`)
+ for _, c := range crop {
+ if len(c) > 1 {
+ data := head.Split(c, -1)
+ log.Println("My Raw Data: ", c)
+ tags[data[0]] = data[1]
+ }
}
log.Println(tags)
return tags
}
+func getParamsFromMsi(path string) map[string]string {
+ if runtime.GOOS == "windows" {
+
+ // orca :=os.Getenv("orca")
+ // err:=os.Mkdir("tmpdir/extract", os.ModeAppend)
+ // if err != nil {
+ // log.Println("There was an error", err)
+ // }
+ // run:=exec.Command(orca, "-q", "-s", path, "-x", "tmpdir/extract")
+ // run.
+ } else {
+ msiinfo := os.Getenv("msiinfo")
+ e, _ := exec.Command(msiinfo, "export", path, "Property").Output()
+ return splitData(e)
+ }
+ return make(map[string]string)
+
+}
diff --git a/public/mod.css b/public/mod.css
index 728fbce..3df73b9 100644
--- a/public/mod.css
+++ b/public/mod.css
@@ -236,4 +236,17 @@ input[type="file"] {
#totalus {
background-color: #6a568b;
border-radius: 15px;
+}
+.form-container {
+ position: fixed; /* Fix position on the screen */
+ top: 0; /* Position at the top */
+ left: 0; /* Position at the left */
+ width: 100%; /* Full width */
+ height: 100%; /* Full height */
+ background-color: rgba(0, 0, 0, 0.8); /* Semi-transparent background */
+ z-index: 9999; /* Make it appear above other elements */
+ overflow: auto; /* Enable scroll if needed */
+ display: none; /* Center the form vertically */
+ align-items: center; /* Center the form vertically */
+ justify-content: center; /* Center the form horizontally */
}
\ No newline at end of file
diff --git a/public/script.js b/public/script.js
index 8b2035d..64c0cc2 100644
--- a/public/script.js
+++ b/public/script.js
@@ -116,4 +116,8 @@ function scriptPackage(rowid, extracommand, line){
}
function convertHtml(dt){
return dt.replace("")
+}
+function showContainer(className){
+ classShow = document.getElementsByClassName(className)[0];
+ classShow.style.display = classShow.style.display=="flex"?"none":"flex";
}
\ No newline at end of file