I guess you're redefining generate_payload_exe here to have your own get_custom_exe, but I dunno why are you redefining it? I guess I'm forgetting something :? (see comment below)