Repository navigation
Expand file tree
/
Copy pathGUI.go
More file actions
103 lines (90 loc) · 2.48 KB
/
Copy pathGUI.go
File metadata and controls
103 lines (90 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package main
import (
"fmt"
"image/color"
"os/exec"
"sgngui"
"strings"
"syscall"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
)
func buildCommand(params *sgngui.Options) string {
args := []string{
"sgn.exe",
"-i", params.Input,
"-o", params.Output,
"-a", fmt.Sprintf("%d", params.Arch),
"-c", fmt.Sprintf("%d", params.EncCount),
"-M", fmt.Sprintf("%d", params.ObsLevel),
}
if params.PlainDecoder {
args = append(args, "-plain")
}
if params.AsciiPayload {
args = append(args, "-ascii")
}
if params.Safe {
args = append(args, "-S")
}
if params.BadChars != "" {
args = append(args, "-badchars", params.BadChars)
}
if params.Verbose {
args = append(args, "-v")
}
return strings.Join(args, " ")
}
func main() {
myApp := app.New()
myWindow := myApp.NewWindow("Sh311C0d3CryPt0")
statusLabel := canvas.NewText("Empty*", color.RGBA{255, 0, 0, 255})
outputPathLabel := canvas.NewText("", color.RGBA{0, 0, 255, 255})
var params *sgngui.Options
startButton := widget.NewButton("sgnCONFIG", func() {
sgngui.ShowGUI(myWindow, statusLabel, func(updatedOptions *sgngui.Options) {
params = updatedOptions
})
})
buildButton := widget.NewButton("Build", func() {
if params == nil {
statusLabel.Text = "Error: Parameters not configured"
statusLabel.Color = color.RGBA{255, 0, 0, 255}
statusLabel.Refresh()
return
}
statusLabel.Text = "Progressing"
statusLabel.Color = color.RGBA{255, 255, 0, 255}
statusLabel.Refresh()
command := buildCommand(params)
fmt.Println("Executing command:", command)
cmd := exec.Command("cmd", "/C", command)
cmd.SysProcAttr = &syscall.SysProcAttr{
HideWindow: true,
}
err := cmd.Run()
if err != nil {
statusLabel.Text = "Error: Command failed"
statusLabel.Color = color.RGBA{255, 0, 0, 255}
} else {
statusLabel.Text = "Success"
statusLabel.Color = color.RGBA{0, 255, 0, 255}
outputPathLabel.Text = "Generated file: " + params.Output
outputPathLabel.Refresh()
}
statusLabel.Refresh()
})
content := container.NewVBox(
container.NewHBox(startButton, statusLabel),
buildButton,
outputPathLabel,
)
myWindow.SetContent(content)
defaultSize := myWindow.Canvas().Size()
myWindow.Resize(defaultSize.Add(fyne.NewSize(defaultSize.Width*0.3, defaultSize.Height*0.3)))
myWindow.SetFixedSize(true)
myWindow.ShowAndRun()
}