def build(self): # copy source files into build directory buildtools.clone_source_files() # change the settings file based on the args we been given buildtools.update_settings_file(self) # now we need to run 'make' inside the cloned dir buildtools.make_in_clone() # now get the beacon in the correct format if self.format == "raw": # extract the shellcode from the new beacon rcode = buildtools.extract_shellcode() # write the shellcode buildtools.write_and_bridge(self.outfile, rcode) if self.format == "exe": # get the bytes of the exe with open("/root/shad0w/beacon/beacon.exe", 'rb') as file: rcode = file.read() # then give them the exe and bridge it buildtools.write_and_bridge(self.outfile, rcode)
def format_raw(builder, length=True, code=False): # extract the shellcode from the new beacon rcode = buildtools.extract_shellcode() # write the shellcode buildtools.write_and_bridge(builder.outfile, rcode) if length: return get_size(builder.outfile) if code: return rcode
def format_exe(builder, length=True, code=False): # get the bytes of the exe # with open("/root/shad0w/beacon/beacon.exe", 'rb') as file: # rcode = file.read() # then give them the exe and bridge it # length = buildtools.write_and_bridge(builder.outfile, rcode) # get the the beacon shellcode rcode = format_raw(builder, length=False, code=True) # create an exe from the shellcode ecode = exe.generate(rcode, debug=builder.debugv) length = buildtools.write_and_bridge(builder.outfile, ecode) # shrink the finally binary if not builder.no_shrink: length = buildtools.shrink_exe(builder.outfile) if length: return length if code: with open(builder.outfile, 'rb') as file: return file.read()
def format_dll(builder, length=True, code=False): # get the the beacon shellcode rcode = format_raw(builder, length=False, code=True) # create an exe from the shellcode ecode = dll.generate(rcode, debug=builder.debugv) length = buildtools.write_and_bridge(builder.outfile, ecode) if length: return length if code: with open(builder.outfile, 'rb') as file: return file.read()
def format_exe(builder, length=True, code=False): # get the bytes of the exe with open("/root/shad0w/beacon/beacon.exe", 'rb') as file: rcode = file.read() # then give them the exe and bridge it length = buildtools.write_and_bridge(builder.outfile, rcode) # shrink the finally binary if not builder.no_shrink: length = buildtools.shrink_exe(builder.outfile) if length: return length if code: with open(builder.outfile, 'rb') as file: return file.read()