Example #1
0
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}
Example #2
0
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)
Example #3
0
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)
Example #4
0
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}
Example #5
0
    def update(self):
        if self._force_upd in (None, True) and is_git_repo() and \
        verify_dir_has_perm(W3AF_LOCAL_PATH, os.W_OK, levels=1):
            try:
                resp = self._call_update()
                self._handle_update_output(resp)
            except KeyboardInterrupt:
                pass
            except Exception, ex:
                self._logger('An error occurred while updating: "%s"' % ex)

            # TODO: Please read https://github.com/andresriancho/w3af/issues/6
            # for more information on what's missing here
            """
Example #6
0
    def update(self):
        if self._force_upd in (None, True) and is_git_repo() and \
        verify_dir_has_perm(W3AF_LOCAL_PATH, os.W_OK, levels=1):
            try:
                resp = self._call_update()
                self._handle_update_output(resp)
            except KeyboardInterrupt:
                pass
            except Exception, ex:
                self._logger('An error occurred while updating: "%s"' % ex)

            # TODO: Please read https://github.com/andresriancho/w3af/issues/6
            # for more information on what's missing here 
            """
Example #7
0
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
    }
Example #8
0
 def test_is_git_repo_negative(self):
     self.assertFalse(is_git_repo('/etc/'))
Example #9
0
 def test_is_git_repo(self):
     self.assertTrue(is_git_repo('.'))
Example #10
0
 def test_is_git_repo_negative(self):
     self.assertFalse(is_git_repo('/etc/'))
Example #11
0
 def test_is_git_repo(self):
     self.assertTrue(is_git_repo('.'))