-
Notifications
You must be signed in to change notification settings - Fork 5
/
Enshellcode.py
46 lines (35 loc) · 985 Bytes
/
Enshellcode.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/python
# article: http://chmodsecurity.com.br/artigo/4/[python]-encode-shellcode-xor.html
#by: Mharcos Nesster
import sys
if len(sys.argv) != 2:
print 'python shell.py $\'shellcode\''
sys.exit()
shellcode = (sys.argv[1])
encoded = ""
print '[+] shellcode enconde para XOR'
print '[+] chmodsecurity'
if len(shellcode) % 2 != 0:
print '[+] Adicionando PON para uniformizar shellcode...'
shellcode += ("\x90")
print '[+] Encoding...'
byteA = ""
counter = 0
for x in bytearray(shellcode):
if counter % 2 == 0:
byteA = x
else:
y = ~x
y = y & 0xff
XORByte = byteA^y
NOTByte = y
encoded += '0x'
encoded += '%02x,' % XORByte
encoded += '0x'
encoded += '%02x,' % NOTByte
counter += 1
print '[+] Encoded Shellcode: ' + encoded + '0xff,0xff'
print '[+] msfc0d3r!'
f = open("shellcode.txt","w")
f.write(encoded + '0xff,0xff')
f.close