import struct
import os
import binascii
import win32com.client
import time
idx = 0
n = 0
maxbytes = 2000
payload_vba_file = "payload.vba"
exe_name = "putty.exe"
size = os.path.getsize(exe_name)
exe = open(exe_name)
final_bytes = ""
print "Writing Document ",
while (idx < size):
exe.seek(idx)
c = binascii.b2a_hex(exe.read(1))
# print ("&H%2s" % c.upper()),
exe_byte = ("&H%2s" % c.upper())
final_bytes = final_bytes +exe_byte
idx = idx + 1
if (idx%2000 == 0):
print "\bX\b",
time.sleep(.1)
if (idx%2000 == 1000):
print "\bO\b",
time.sleep(.1)
print final_bytes
fh = open(payload_vba_file,'w')
fh.write(final_bytes)
fh.close()
-
No comments:
Post a Comment