MCPcopy Create free account
hub / github.com/TideSec/GoBypassAV / main

Function main

Encryption/ShellcodeUtils/main.go:21–257  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19)
20
21func main() {
22 verbose := flag.Bool("v", false, "Enable verbose output")
23 encryptionType := flag.String("type", "", "The type of encryption to use [xor, aes256, rc4, null]")
24 key := flag.String("key", "", "Encryption key")
25 b64 := flag.Bool("base64", false, "Base64 encode the output. Can be used with or without encryption")
26 input := flag.String("i", "", "Input file path of binary file")
27 output := flag.String("o", "", "Output file path")
28 mode := flag.String("mode", "encrypt", "Mode of operation to perform on the input file [encrypt,decrypt]")
29 salt := flag.String("salt", "", "Salt, in hex, used to generate an AES256 32-byte key through Argon2. Only used during decryption")
30 inputNonce := flag.String("nonce", "", "Nonce, in hex, used to decrypt an AES256 input file. Only used during decryption")
31 flag.Usage = func() {
32 flag.PrintDefaults()
33 os.Exit(0)
34 }
35 flag.Parse()
36
37 // Check to make sure the input file exists
38 _, errInputFile := os.Stat(*input)
39
40 if os.IsNotExist(errInputFile) {
41 os.Exit(1)
42 }
43
44 shellcode, errShellcode := ioutil.ReadFile(*input)
45
46 if errShellcode != nil {
47 os.Exit(1)
48 }
49
50 // Check to make sure an output file was provided
51 if *output == "" {
52 os.Exit(1)
53 }
54
55 // Check to make sure the output directory exists
56 dir, _ := filepath.Split(*output)
57 if *verbose {
58 }
59
60 outDir, errOutDir := os.Stat(dir)
61 if errOutDir != nil {
62 os.Exit(1)
63 }
64
65 if !outDir.IsDir() {
66 }
67
68 if *verbose {
69 }
70
71 if strings.ToUpper(*mode) != "ENCRYPT" && strings.ToUpper(*mode) != "DECRYPT" {
72 os.Exit(1)
73 }
74
75 // Make sure a key was provided
76 if *encryptionType != "" {
77 if *key == "" {
78 os.Exit(1)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected