(data, key, cipherType)
| 114 | #------------------------------------------------------------------------ |
| 115 | # data as a bytearray |
| 116 | def 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 |
no test coverage detected