예제 #1
0
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.

w3af is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with w3af; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

'''
from core.controllers.dependency_check.os_detection import is_mac, is_openbsd, is_fedora, is_suse 

if is_mac():
    from .mac import (SYSTEM_NAME, PKG_MANAGER_CMD,
                      SYSTEM_PACKAGES, PIP_CMD,
                      PIP_PACKAGES, os_package_is_installed,
                      after_hook)

elif is_openbsd():
    from .openbsd import (SYSTEM_NAME, PKG_MANAGER_CMD,
                          SYSTEM_PACKAGES, PIP_CMD,
                          PIP_PACKAGES, os_package_is_installed,
                          after_hook)
elif is_fedora():
    from .fedora import (SYSTEM_NAME, PKG_MANAGER_CMD,
                          SYSTEM_PACKAGES, PIP_CMD,
                          PIP_PACKAGES, os_package_is_installed,
                          after_hook)
예제 #2
0
def gtkui_dependency_check():
    '''
    This function verifies that the dependencies that are needed by the GTK
    user interface are met.
    '''
    reason_for_exit = False
    packages = []
    packages_debian = []
    packages_mac_ports = []
    packages_pip = []
    packages_openbsd = []
    additional_information = []

    om.out.debug('Checking GTK UI dependencies')

    try:
        proc = subprocess.Popen('neato -V', shell=True, stdout=subprocess.PIPE,
                                stderr=subprocess.PIPE)
    except:
        packages_debian.append('graphviz')
        packages_mac_ports.append('graphviz')
        packages_openbsd.append('graphviz')
        reason_for_exit = True
    else:
        
        # E1101: Instance of 'Popen' has no 'stderr' member
        if 'graphviz' not in proc.stderr.read().lower(): # pylint: disable=E1101
            packages_debian.append('graphviz')
            packages_mac_ports.append('graphviz')
            reason_for_exit = True
        

    try:
        import pygtk
        pygtk.require('2.0')
        import gtk
        import gobject
        assert gtk.gtk_version >= (2, 12)
        assert gtk.pygtk_version >= (2, 12)
    except:
        packages.extend(['pygtk', 'gtk'])
        packages_debian.append('python-gtk2')
        packages_mac_ports.append('py27-pygtk')
        reason_for_exit = True

    try:
        import xdot
    except ImportError:
        packages_pip.append('xdot')
        reason_for_exit = True

    try:
        import gtksourceview2
    except:
        packages.append('gtksourceview2')
        packages_debian.append('python-gtksourceview2')
        packages_openbsd.append('gtksourceview')
        packages_mac_ports.append('py27-pygtksourceview')
        reason_for_exit = True

    if packages:
        msg = 'Your python installation needs the following packages:\n'
        msg += '    ' + ' '.join(packages)
        print msg, '\n'
    if packages_debian and is_linux():
        msg = 'On debian based systems:\n'
        msg += '    sudo apt-get install ' + ' '.join(packages_debian)
        print msg, '\n'
    if packages_mac_ports and is_mac():
        msg = 'On a mac with mac ports installed:\n'
        msg += '    sudo port install ' + ' '.join(packages_mac_ports)
        print msg, '\n'
    if packages_openbsd and is_openbsd():
        msg = 'On a OpenBSD 5.1 install the requirements by running:\n'
        msg += '    export PKG_PATH="http://ftp.openbsd.org/pub/OpenBSD/5.1/packages/i386/"\n'
        msg += '    pkg_add -v  ' + ' '.join(packages_openbsd)
        print msg, '\n'
    if packages_pip:
        msg = 'After installing any missing operating system packages, use'\
              ' pip to install the remaining modules:\n'
        msg += '    sudo pip install ' + ' '.join(packages_pip)
        print msg, '\n'
    if additional_information:
        msg = 'Additional information:\n'
        msg += '\n'.join(additional_information)
        print msg

    #Now exit if necessary
    if reason_for_exit:
        exit(1)
예제 #3
0
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.

w3af is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with w3af; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

'''
from core.controllers.dependency_check.os_detection import is_mac, is_openbsd, is_fedora

if is_mac():
    from .mac import (SYSTEM_NAME, PKG_MANAGER_CMD, SYSTEM_PACKAGES, PIP_CMD,
                      PIP_PACKAGES, os_package_is_installed, after_hook)

elif is_openbsd():
    from .openbsd import (SYSTEM_NAME, PKG_MANAGER_CMD, SYSTEM_PACKAGES,
                          PIP_CMD, PIP_PACKAGES, os_package_is_installed,
                          after_hook)
elif is_fedora():
    from .fedora import (SYSTEM_NAME, PKG_MANAGER_CMD, SYSTEM_PACKAGES,
                         PIP_CMD, PIP_PACKAGES, os_package_is_installed,
                         after_hook)
else:
    from .linux import (SYSTEM_NAME, PKG_MANAGER_CMD, SYSTEM_PACKAGES, PIP_CMD,
                        PIP_PACKAGES, os_package_is_installed, after_hook)
예제 #4
0
def gtkui_dependency_check():
    '''
    This function verifies that the dependencies that are needed by the GTK
    user interface are met.
    '''
    reason_for_exit = False
    packages = []
    packages_debian = []
    packages_mac_ports = []
    packages_pip = []
    packages_openbsd = []
    additional_information = []

    om.out.debug('Checking GTK UI dependencies')

    try:
        proc = subprocess.Popen('neato -V',
                                shell=True,
                                stdout=subprocess.PIPE,
                                stderr=subprocess.PIPE)
    except:
        packages_debian.append('graphviz')
        packages_mac_ports.append('graphviz')
        packages_openbsd.append('graphviz')
        reason_for_exit = True
    else:

        # E1101: Instance of 'Popen' has no 'stderr' member
        if 'graphviz' not in proc.stderr.read().lower():  # pylint: disable=E1101
            packages_debian.append('graphviz')
            packages_mac_ports.append('graphviz')
            reason_for_exit = True

    try:
        import pygtk
        pygtk.require('2.0')
        import gtk
        import gobject
        assert gtk.gtk_version >= (2, 12)
        assert gtk.pygtk_version >= (2, 12)
    except:
        packages.extend(['pygtk', 'gtk'])
        packages_debian.append('python-gtk2')
        packages_mac_ports.append('py27-pygtk')
        reason_for_exit = True

    try:
        import xdot
    except ImportError:
        packages_pip.append('xdot')
        reason_for_exit = True

    try:
        import gtksourceview2
    except:
        packages.append('gtksourceview2')
        packages_debian.append('python-gtksourceview2')
        packages_openbsd.append('gtksourceview')
        packages_mac_ports.append('py27-pygtksourceview')
        reason_for_exit = True

    if packages:
        msg = 'Your python installation needs the following packages:\n'
        msg += '    ' + ' '.join(packages)
        print msg, '\n'
    if packages_debian and is_linux():
        msg = 'On debian based systems:\n'
        msg += '    sudo apt-get install ' + ' '.join(packages_debian)
        print msg, '\n'
    if packages_mac_ports and is_mac():
        msg = 'On a mac with mac ports installed:\n'
        msg += '    sudo port install ' + ' '.join(packages_mac_ports)
        print msg, '\n'
    if packages_openbsd and is_openbsd():
        msg = 'On a OpenBSD 5.1 install the requirements by running:\n'
        msg += '    export PKG_PATH="http://ftp.openbsd.org/pub/OpenBSD/5.1/packages/i386/"\n'
        msg += '    pkg_add -v  ' + ' '.join(packages_openbsd)
        print msg, '\n'
    if packages_pip:
        msg = 'After installing any missing operating system packages, use'\
              ' pip to install the remaining modules:\n'
        msg += '    sudo pip install ' + ' '.join(packages_pip)
        print msg, '\n'
    if additional_information:
        msg = 'Additional information:\n'
        msg += '\n'.join(additional_information)
        print msg

    #Now exit if necessary
    if reason_for_exit:
        exit(1)