Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates morph-hta.py to python3 #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions morph-hta.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/python3
import os;
import random;
import uuid;
Expand Down Expand Up @@ -101,17 +102,17 @@ def banner(self):
with open('banner.txt', 'r') as f:
data = f.read()

print "\033[1;31m%s\033[0;0m" % data
print "\033[1;34mMorphing Evil.HTA from Cobalt Strike"
print "\033[1;32mAuthor: Vincent Yiu (@vysec, @vysecurity)\033[0;0m"
print("\033[1;31m%s\033[0;0m" % data)
print("\033[1;34mMorphing Evil.HTA from Cobalt Strike")
print("\033[1;32mAuthor: Vincent Yiu (@vysec, @vysecurity)\033[0;0m")

def output(self):
print "\033[1;33m[+] Writing payload to \033[1;31m%s\033[0;0m" % self.args.out
print("\033[1;33m[+] Writing payload to \033[1;31m%s\033[0;0m" % self.args.out)
f = open(self.args.out, "w+")
self.newlines
f.write('\n'.join(self.newlines))
f.close()
print "\033[1;33m[+] Payload written\033[0;0m"
print("\033[1;33m[+] Payload written\033[0;0m")

def make_argparser(self):
parser = argparse.ArgumentParser(description = "")
Expand Down Expand Up @@ -150,13 +151,13 @@ def check_args(self, args):
def run(self, args):

self.banner()
print ""
print("")

m.check_args(args)

print ""
print("")

print "\033[1;32m[*] morphHTA initiated\033[0;0m"
print("\033[1;32m[*] morphHTA initiated\033[0;0m")

hta = open(self.args.infile,'r')
lines = []
Expand Down Expand Up @@ -370,9 +371,9 @@ def run(self, args):

#print "R1: %s" % (red.split("\"")[1]) # powershell bit
#print "R3: %s" % (red.split("\"")[3]) # parameter bit
print "Param: %s" % param
print("Param: %s" % param)

print self.obfuscate(line0) + self.obfuscateNum(self.obfuscate(cmd)) + "," + (self.obfuscateNum(self.obfuscate(param) + critical)) + self.obfuscate(line2)
print(self.obfuscate(line0) + self.obfuscateNum(self.obfuscate(cmd)) + "," + (self.obfuscateNum(self.obfuscate(param) + critical)) + self.obfuscate(line2))

line = self.obfuscate(line0) + self.obfuscateNum(self.obfuscate(cmd)) + "," + (self.obfuscateNum(self.obfuscate(param) + critical)) + self.obfuscate(line2)

Expand Down