Пример #1
0
def retirejs_is_installed():
    """
    :return: True if retirejs is installed and we were able to parse the version.
    """
    paths_to_retire = which('retire')
    if not paths_to_retire:
        return False

    path_to_retire = paths_to_retire[0]

    try:
        version = subprocess.check_output('%s --version' % path_to_retire,
                                          shell=True)
    except subprocess.CalledProcessError:
        return False

    version = version.strip()
    version_split = version.split('.')

    # Just check that the version has the format 1.6.0
    if len(version_split) != 3:
        return False

    if not version.startswith(SUPPORTED_RETIREJS):
        return False

    return True
Пример #2
0
    def _get_retirejs_path(self):
        """
        :return: Path to the retirejs binary
        """
        paths_to_retire = which('retire')

        # The dependency check script guarantees that there will always be
        # at least one installation of the retirejs command.
        return paths_to_retire[0]
Пример #3
0
def retirejs_is_installed():
    """
    :return: True if retirejs is installed and we were able to parse the version.
    """
    paths_to_retire = which('retire')
    if not paths_to_retire:
        return False

    path_to_retire = paths_to_retire[0]

    version = subprocess.check_output('%s --version' % path_to_retire, shell=True)
    version = version.strip()
    version_split = version.split('.')

    # Just check that the version has the format 1.6.0
    if len(version_split) != 3:
        return False

    return True
Пример #4
0
    def _get_base_args(self):
        """
        Simple logic to get the base args in different environments where:
            * sqlmap is in PATH
            * The embedded sqlmap is not available

        :see: https://github.com/andresriancho/w3af/issues/10538

        :return: The base args to execute sqlmap in this environment, or raise
                 an exception if something is wrong.
        """
        if os.path.exists(self.SQLMAP_LOCATION):
            # This is the most common scenario where the user installs w3af
            # from source and wants to use the embedded sqlmap
            return self.SQLMAP_LOCATION, self.EMBEDDED_DEFAULT_ARGS

        # sqlmap is not embedded, most likely because the packager removed
        # it and sqlmap executable is in path, make sure it's there before
        # we return the base args
        if not which('sqlmap'):
            raise RuntimeError('The "sqlmap" command is not in PATH')

        return os.getcwd(), self.INSTALLED_DEFAULT_ARGS
Пример #5
0
    def _get_base_args(self):
        """
        Simple logic to get the base args in different environments where:
            * sqlmap is in PATH
            * The embedded sqlmap is not available

        :see: https://github.com/andresriancho/w3af/issues/10538

        :return: The base args to execute sqlmap in this environment, or raise
                 an exception if something is wrong.
        """
        if os.path.exists(self.SQLMAP_LOCATION):
            # This is the most common scenario where the user installs w3af
            # from source and wants to use the embedded sqlmap
            return self.SQLMAP_LOCATION, self.EMBEDDED_DEFAULT_ARGS

        # sqlmap is not embedded, most likely because the packager removed
        # it and sqlmap executable is in path, make sure it's there before
        # we return the base args
        if not which('sqlmap'):
            raise RuntimeError('The "sqlmap" command is not in PATH')

        return os.getcwd(), self.INSTALLED_DEFAULT_ARGS
Пример #6
0
def retirejs_is_installed():
    """
    :return: True if retirejs is installed and we were able to parse the version.
    """
    paths_to_retire = which('retire')
    if not paths_to_retire:
        return False

    path_to_retire = paths_to_retire[0]

    try:
        version = subprocess.check_output('%s --version' % path_to_retire, shell=True)
    except subprocess.CalledProcessError:
        return False

    version = version.strip()
    version_split = version.split('.')

    # Just check that the version has the format 1.6.0
    if len(version_split) != 3:
        return False

    return True
Пример #7
0
def dependency_check():
    """
    This dependency check function uses the information stored in the platforms
    module to call the function in core.controllers.dependency_check which
    actually checks for the dependencies.
    
    The data in the core.ui.gui.dependency_check.platforms module is actually
    based on the data stored in core.controllers.dependency_check.platforms,
    we extend() the lists present in the base module before passing them to
    mdep_check() 
    """
    should_exit = mdep_check(dependency_set=GUI, exit_on_failure=False)
    
    try:
        import pygtk
        pygtk.require('2.0')
        import gtk
        import gobject
        assert gtk.gtk_version >= (2, 12)
        assert gtk.pygtk_version >= (2, 12)
    except:
        msg = 'The GTK package requirements are not met, please make sure your'\
              ' system meets these requirements:\n'\
              '    - PyGTK >= 2.12\n'\
              '    - GTK >= 2.12\n'
        print(msg)
        should_exit = True

    if not which('dot'):
        msg = 'The required "dot" binary is missing, please install the' \
              ' "graphviz" package in your operating system.'
        print(msg)
        should_exit = True

    if should_exit:
        sys.exit(1)
Пример #8
0
    def test_which_simple(self):
        python_executables = which('python')

        for exec_name in python_executables:
            self.assertTrue(exec_name.endswith('python'))
Пример #9
0
 def test_which_simple(self):
     python_executables = which('python')
     
     for exec_name in python_executables:
         self.assertTrue(exec_name.endswith('python'))