(data, key, cipherType)
| 97 | #------------------------------------------------------------------------ |
| 98 | # data as a bytearray |
| 99 | def 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 |
no test coverage detected