Esempio n. 1
0
def download_exploit_details():
    """
    Download the selected exploit.
    :return: a template showing the details about the selected exploit and the source code.
    """
    exploit_id = request.args.get('exploit-id', None)
    exploit = get_exploit_by_id(exploit_id)
    file_path = init_path + "/exploitdb/" + exploit.file
    try:
        with open(file_path, 'r') as f:
            content = f.readlines()
            vulnerability_code = ''.join(content)
        copyfile(
            file_path,
            os.path.expanduser("~") + "/exploit_" + exploit_id +
            get_vulnerability_extension(exploit.file))
        download_alert = "exploit_" + exploit_id + get_vulnerability_extension(
            exploit.file) + " has been downloaded in your home directory"
        return render_template('code_viewer.html',
                               vulnerability_code=vulnerability_code,
                               vulnerability_description=exploit.description,
                               vulnerability_file=exploit.file,
                               vulnerability_author=exploit.author,
                               vulnerability_date=exploit.date,
                               vulnerability_type=exploit.type,
                               vulnerability_platform=exploit.platform,
                               vulnerability_port=exploit.port,
                               file_path=file_path,
                               download_alert=download_alert,
                               exploit_id=exploit_id)
    except FileNotFoundError:
        error_msg = 'Sorry! This file does not exist :('
        return render_template('error_page.html', error=error_msg)
Esempio n. 2
0
def view_exploit_details():
    """
    Open details about the selected exploit, included the source code.
    :return: a template showing the details about the selected exploit and the source code.
    """
    exploit_id = request.args.get('exploit-id', None)
    exploit = get_exploit_by_id(exploit_id)
    file_path = init_path + "/exploitdb/" + exploit.file
    try:
        with open(file_path, 'r') as f:
            content = f.readlines()
            vulnerability_code = ''.join(content)
        return render_template('code_viewer.html',
                               vulnerability_code=vulnerability_code,
                               vulnerability_description=exploit.description,
                               vulnerability_file=exploit.file,
                               vulnerability_author=exploit.author,
                               vulnerability_date=exploit.date,
                               vulnerability_type=exploit.type,
                               vulnerability_platform=exploit.platform,
                               vulnerability_port=exploit.port,
                               file_path=file_path,
                               exploit_id=exploit_id)
    except FileNotFoundError:
        error_msg = 'Sorry! This file does not exist :('
        return render_template('error_page.html', error=error_msg)