Beispiel #1
0
def call_database_updater():
    if views.user:
        if (user_collection.find_one({'id':
                                      views.user.id})['auto_update'] == '0'):
            sf.run_Database_Updater_Script()
            gv.collect_Checkable_Packages()

            for package_cursor in package_collection.find({
                    'matching_ids': {
                        '$exists': True,
                        '$not': {
                            '$size': 0
                        }
                    },
                    'updateable': 1
            }):
                for patch_id in package_cursor['matching_ids']:
                    try:
                        print(
                            cve_collection.find_one({
                                'id': patch_id,
                                'deleted': 0
                            })['id'])
                        patch_cursor = cve_collection.find_one(
                            {'id': patch_id})
                        if ap.handle_Patch_Update(
                                patch_cursor, package_cursor['package_name']):
                            print("Successfully applied patch")
                        else:
                            print("Admin patch requested")
                    except:
                        pass
            gv.collect_Checkable_Packages()
Beispiel #2
0
def update_using_admin_patch(package_name, cve_id):
    prev_ubuntu_vers = package_collection.find_one(
        {'package_name': package_name})['ubuntu_version']
    ap.handle_Patch_Update(cve_collection.find_one({'id': cve_id}),
                           package_name)
    if prev_ubuntu_vers != sf.get_Ubuntu_Package_Version(package_name):
        gv.remove_Special_Characters()
        gv.collect_Checkable_Packages()
    return redirect(url_for('vulnerabilities') + '/' + package_name)
Beispiel #3
0
def version_update():
    prev_ubunut_vers = package_collection.find_one(
        {'package_name': request.form['package-name']})['ubuntu_version']

    if not ap.handle_Version_Patch_By_User(
            request.form['package-name'], request.form['version-name'],
            request.form['link'], request.form['comment']):
        return redirect(
            url_for('vulnerabilities') + '/' + request.form['package-name'])

    gv.remove_Special_Characters()
    gv.collect_Checkable_Packages()
    db.update_Matched_Vulnerability_Packages_JSON()
    db.update_Update_Log()

    curr_ubuntu_vers = package_collection.find_one(
        {'package_name': request.form['package-name']})['ubuntu_version']

    return render_template('package_alterations.html',
                           previous_ubuntu_version=prev_ubunut_vers,
                           current_ubuntu_version=curr_ubuntu_vers,
                           link_For_Button="/vulnerabilities/" +
                           request.form['package-name'])
Beispiel #4
0
def update_vulnerabilities():
    sf.run_Database_Updater_Script()
    gv.collect_Checkable_Packages()
    return redirect(url_for('vulnerabilities'))
Beispiel #5
0
def refresh():
    print("Refreshing vulnerabilities")
    gv.remove_Special_Characters()
    gv.collect_Checkable_Packages()
    db.update_Matched_Vulnerability_Packages_JSON()
    return redirect(url_for('vulnerabilities'))
Beispiel #6
0
def reverse_file_patch_log_page(package_name, date_of_patch):
    ph.handle_Patch_Maintenance(package_name, date_of_patch)
    gv.collect_Checkable_Packages()
    db.update_Update_Log()
    db.update_Matched_Vulnerability_Packages_JSON()
    return redirect(url_for('log'))