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

Function formatPy

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

Source from the content-addressed store, hash-verified

114#------------------------------------------------------------------------
115# data as a bytearray
116def formatPy(data, key, cipherType):
117 shellcode = '\\x'
118 shellcode += '\\x'.join(format(b,'02x') for b in data)
119 result = convertFromTemplate({'shellcode': shellcode, 'key': key, 'cipherType': cipherType}, templates['python'])
120
121 if result != None:
122 try:
123 fileName = os.path.splitext(resultFiles['python'])[0] + "_" + cipherType + os.path.splitext(resultFiles['python'])[1]
124 with open(fileName,"w+") as f:
125 f.write(result)
126 f.close()
127 print(color("[+] Python code file saved in [{}]".format(fileName)))
128 except IOError:
129 print(color("[!] Could not write Python code [{}]".format(fileName)))
130
131#------------------------------------------------------------------------
132# data as a bytearray

Callers 1

Calls 2

convertFromTemplateFunction · 0.85
colorFunction · 0.85

Tested by

no test coverage detected