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

Function formatCSharp

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

Source from the content-addressed store, hash-verified

97#------------------------------------------------------------------------
98# data as a bytearray
99def formatCSharp(data, key, cipherType):
100 shellcode = '0x'
101 shellcode += ',0x'.join(format(b,'02x') for b in data)
102 result = convertFromTemplate({'shellcode': shellcode, 'key': key, 'cipherType': cipherType}, templates['csharp'])
103
104 if result != None:
105 try:
106 fileName = os.path.splitext(resultFiles['csharp'])[0] + "_" + cipherType + os.path.splitext(resultFiles['csharp'])[1]
107 with open(fileName,"w+") as f:
108 f.write(result)
109 f.close()
110 print(color("[+] C# code file saved in [{}]".format(fileName)))
111 except IOError:
112 print(color("[!] Could not write C# code [{}]".format(fileName)))
113
114#------------------------------------------------------------------------
115# data as a bytearray

Callers 1

Calls 2

convertFromTemplateFunction · 0.85
colorFunction · 0.85

Tested by

no test coverage detected