If you add an argument "my_target" to dropped_file_contents, and then pass along the target's plat/arch options to generate_payload_exe, the payload at least gets the right binary format in osx:

generate_payload_exe( {:code=>p.encoded, :arch => my_target.arch, :platform => my_target.platform} )

However, the binary it drops is fux0red somehow and won't execute