/
hex.go
46 lines (34 loc) · 885 Bytes
/
hex.go
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
package encoder
import (
"embed"
"encoding/hex"
"github.com/loosehose/gobble/pkg/common"
"github.com/loosehose/gobble/pkg/models"
)
type HexEncoder struct {
Name string
Description string
Key string
Debug bool
}
func NewHexEncoder() models.ObjectModel {
return &HexEncoder{
Name: "hex",
Description: "Use hex encoding to encode given data",
Debug: false,
}
}
func (e *HexEncoder) Encode(shellcode []byte) ([]byte, error) {
return []byte(hex.EncodeToString(shellcode)), nil
}
func (e *HexEncoder) GetImports() []string {
return []string{
`"encoding/hex"`,
}
}
func (e *HexEncoder) RenderInstanciationCode(data embed.FS) (string, error) {
return common.CommonRendering(data, "templates/encoders/hex/instanciation.go.tmpl", e)
}
func (e *HexEncoder) RenderFunctionCode(data embed.FS) (string, error) {
return "", nil
}