def _generate_report(self, changelog, local_commit_id, remote_commit_id): """ :return: A string with a report of the latest update from local commit to remote commit which changes stuff in changelog. """ lshort = to_short_id(local_commit_id) rshort = to_short_id(remote_commit_id) ldate = get_commit_id_date(local_commit_id) rdate = get_commit_id_date(remote_commit_id) report = 'The following changes were applied to the local w3af'\ ' installation during the last update from %s (%s) to'\ ' %s (%s):\n\n%s' return report % (lshort, ldate, rshort, rdate, changelog)
def _generate_report(self, changelog, local_commit_id, remote_commit_id): """ :return: A string with a report of the latest update from local commit to remote commit which changes stuff in changelog. """ lshort = to_short_id(local_commit_id) rshort = to_short_id(remote_commit_id) ldate = get_commit_id_date(local_commit_id) rdate = get_commit_id_date(remote_commit_id) report = 'The following changes were applied to the local w3af' \ ' installation during the last update from %s (%s) to' \ ' %s (%s):\n\n%s' return report % (lshort, ldate, rshort, rdate, changelog)
def get_w3af_version_as_dict(): """ :return: All the version information in a dict """ commit = to_short_id(get_latest_commit()) if is_git_repo() else 'unknown' cdate = ' - %s' % get_latest_commit_date() if is_git_repo() else '' branch = get_current_branch() if is_git_repo() else 'unknown' dirty = 'Yes' if is_dirty_repo() else 'No' return {'version': get_minimalistic_version(), 'revision': commit + cdate, 'branch': branch, 'dirty': dirty}
def update(self, force=False): """ Perform code update if necessary. Return three elems tuple with the ChangeLog of the changed files, the local and the final commit id. :param force: Force update ignoring the startup config. :return: (changelog: A ChangeLog instance, local_head_id: The local id before the update, commit_id: The commit id after the update) """ if not force and not self._has_to_update(): # No need to update based on user preferences return # Save the latest update date, always, even when the update had errors # or there was no update available self._start_cfg.last_upd = date.today() self._start_cfg.save() local_head_id = self._client.get_local_head_id() short_local_head_id = to_short_id(local_head_id) # Lets update! self._notify(VersionMgr.ON_UPDATE_CHECK) # This performs a fetch() which takes time remote_head_id = self._client.get_remote_head_id() short_remote_head_id = to_short_id(remote_head_id) if local_head_id == remote_head_id: # If local and repo's rev are the same => Nothing to do. self._notify(VersionMgr.ON_ALREADY_LATEST) return if self._user_confirmed_update(short_local_head_id, local_head_id, short_remote_head_id, remote_head_id): return self.__update_impl()
def get_w3af_version(): """ :return: A string with the w3af version. """ commit = to_short_id(get_latest_commit()) if is_git_repo() else 'unknown' cdate = ' - %s' % get_latest_commit_date() if is_git_repo() else '' branch = get_current_branch() if is_git_repo() else 'unknown' dirty = 'Yes' if is_dirty_repo() else 'No' vnumber = get_minimalistic_version() return ('w3af - Web Application Attack and Audit Framework\n' 'Version: %s\n' 'Distribution: Kali Linux\n' 'Author: Andres Riancho and the w3af team.') % (vnumber)
def get_w3af_version(): """ :return: A string with the w3af version. """ commit = to_short_id(get_latest_commit()) if is_git_repo() else 'unknown' cdate = ' - %s' % get_latest_commit_date() if is_git_repo() else '' branch = get_current_branch() if is_git_repo() else 'unknown' dirty = 'Yes' if is_dirty_repo() else 'No' vnumber = get_minimalistic_version() return ('w3af - Web Application Attack and Audit Framework\n' 'Version: %s\n' 'Revision: %s%s\n' 'Branch: %s\n' 'Local changes: %s\n' 'Author: Andres Riancho and the w3af team.') % ( vnumber, commit, cdate, branch, dirty)
def get_w3af_version_as_dict(): """ This method seems to take considerable time to run when w3af is run from a git installation (.git directory is present). All of the time it takes to solve this function comes from get_w3af_version_as_dict(), which reads the Git meta-data. Some plugins, such as xml_file, call get_w3af_version every N seconds to write that information to the output file. I added @memoized in order to reduce the time it takes to run the output plugin. :return: All the version information in a dict """ commit = to_short_id(get_latest_commit()) if is_git_repo() else 'unknown' cdate = ' - %s' % get_latest_commit_date() if is_git_repo() else '' branch = get_current_branch() if is_git_repo() else 'unknown' dirty = 'Yes' if is_dirty_repo() else 'No' return {'version': get_minimalistic_version(), 'revision': commit + cdate, 'branch': branch, 'dirty': dirty}
def get_w3af_version_as_dict(): """ This method seems to take considerable time to run when w3af is run from a git installation (.git directory is present). All of the time it takes to solve this function comes from get_w3af_version_as_dict(), which reads the Git meta-data. Some plugins, such as xml_file, call get_w3af_version every N seconds to write that information to the output file. I added @memoized in order to reduce the time it takes to run the output plugin. :return: All the version information in a dict """ commit = to_short_id(get_latest_commit()) if is_git_repo() else 'unknown' cdate = ' - %s' % get_latest_commit_date() if is_git_repo() else '' branch = get_current_branch() if is_git_repo() else 'unknown' dirty = 'Yes' if is_dirty_repo() else 'No' return { 'version': get_minimalistic_version(), 'revision': commit + cdate, 'branch': branch, 'dirty': dirty }