MCPcopy
hub / github.com/Threekiii/Awesome-Redteam / formatCPP

Function formatCPP

scripts/ShellcodeWrapper/shellcode_encoder_py3.py:82–95  ·  view source on GitHub ↗
(data, key, cipherType)

Source from the content-addressed store, hash-verified

80#------------------------------------------------------------------------
81# data as a bytearray
82def formatCPP(data, key, cipherType):
83 shellcode = "\\x"
84 shellcode += "\\x".join(format(b,'02x') for b in data)
85 result = convertFromTemplate({'shellcode': shellcode, 'key': key, 'cipherType': cipherType}, templates['cpp'])
86
87 if result != None:
88 try:
89 fileName = os.path.splitext(resultFiles['cpp'])[0] + "_" + cipherType + os.path.splitext(resultFiles['cpp'])[1]
90 with open(fileName,"w+") as f:
91 f.write(result)
92 f.close()
93 print(color("[+] C++ code file saved in [{}]".format(fileName)))
94 except IOError:
95 print(color("[!] Could not write C++ code [{}]".format(fileName)))
96
97#------------------------------------------------------------------------
98# data as a bytearray

Callers 1

Calls 2

convertFromTemplateFunction · 0.85
colorFunction · 0.85

Tested by

no test coverage detected