(data, key, cipherType)
| 80 | #------------------------------------------------------------------------ |
| 81 | # data as a bytearray |
| 82 | def 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 |
no test coverage detected