

def install(cmd_arguments):
    'Perform installation of OWTF Framework. Wraps around all helper methods made in this module.\n\n    :param cmd_arguments:\n    '
    args = parser.parse_args(cmd_arguments)
    cp = ConfigParser.ConfigParser({
        'RootDir': root_dir,
        'Pid': pid,
    })
    cp.read(distros_cfg)
    (distro, version, arch) = platform.linux_distribution()
    distro_num = 0
    if ('kali' in distro.lower()):
        distro_num = 1
    elif ('samurai' in distro.lower()):
        distro_num = 2
    elif is_compatible():
        distro_num = 3
    while True:
        if (distro_num != 0):
            Colorizer.info(('[*] %s has been automatically detected... ' % distro))
            Colorizer.normal('[*] Continuing in auto-mode')
            break
        if args.no_user_input:
            distro_num = 0
            break
        print('')
        for (i, item) in enumerate(cp.sections()):
            Colorizer.warning(('(%d) %s' % ((i + 1), item)))
        Colorizer.warning(('(0) My distro is not listed :( %s' % distro))
        distro_num = raw_input('Select a number based on your distribution : ')
        try:
            distro_num = int(distro_num)
            break
        except ValueError:
            print('')
            Colorizer.warning('[!] Invalid Number specified')
            continue
    install_restricted_from_cfg(restricted_cfg)
    if (distro_num != 0):
        run_command(cp.get(cp.sections()[(int(distro_num) - 1)], 'install'))
    else:
        Colorizer.normal('[*] Skipping distro related installation :(')
    if args.core_only:
        return
    Colorizer.normal('[*] Upgrading pip to the latest version ...')
    run_command('sudo pip2 install --upgrade pip')
    Colorizer.normal('Upgrading setuptools to the latest version ...')
    run_command('sudo pip2 install --upgrade setuptools')
    Colorizer.normal('Upgrading cffi to the latest version ...')
    run_command('sudo pip2 install --upgrade cffi')
    if (distro_num == '1'):
        kali_version = os.popen('cat /etc/issue', 'r').read().split(' ')[2][0]
        if (kali_version == '1'):
            if args.no_user_input:
                fixsetuptools = 'n'
            else:
                fixsetuptools = raw_input('Delete /usr/lib/python2.7/dist-packages/setuptools.egg-info? (y/n)\n(recommended, solves some issues in Kali 1.xx)')
            if (fixsetuptools == 'y'):
                Colorizer.normal('[*] Backing up the original symlink...')
                ts = time.time()
                human_timestamp = datetime.fromtimestamp(ts).strftime('%Y-%m-%d-%H:%M:%S')
                symlink_orig_path = '/usr/lib/python2.7/dist-packages/setuptools.egg-info'
                run_command(('mv %s %s-BACKUP-%s' % (symlink_orig_path, symlink_orig_path, human_timestamp)))
                Colorizer.info(('[*] The original symlink exists at %s-BACKUP-%s' % (symlink_orig_path, human_timestamp)))
                install_using_pip(owtf_pip)
        else:
            Colorizer.warning('[!] Moving on with the installation but you were warned: there may be some errors!')
    install_using_pip(owtf_pip)
    run_command(('sudo sh %s init' % os.path.join(scripts_path, 'db_setup.sh')))
    run_command(('sudo sh %s' % os.path.join(scripts_path, 'db_run.sh')))

dataset/ETHPy150Open owtf/owtf/install/install.py install/original