-
Notifications
You must be signed in to change notification settings - Fork 62
/
Encrypt.py
32 lines (27 loc) · 1006 Bytes
/
Encrypt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#coding:utf-8
#Author:Evi1oX
import sys
import base64
import argparse
def xor(data, key):
l = len(key)
keyAsInt = list(map(ord, key))
return bytes(bytearray((
(data[i] ^ keyAsInt[i % l]) for i in range(0,len(data))
)))
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="python3 {0} -f payload.bin -k Evi1oX".format(sys.argv[0]))
parser.add_argument("-f","--file", help="Raw Shellcode File",required=True)
parser.add_argument("-k","--key", help="XOR Encrypted key",required=True)
args = parser.parse_args()
try:
with open(args.file, 'rb') as f:
scBytes = f.read()
xorBytes = xor(scBytes, args.key)
print("XorKey: "+args.key)
print("Result: "+base64.b64encode(xorBytes).decode())
with open("payload.txt","w") as f:
f.write(base64.b64encode(xorBytes).decode())
except Exception as e:
print(e)
sys.exit()