Dlux-cyber-projects / cve-search-2023

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bespoke Vulnerability Watch - Developer Guide

Table of Contents

  1. Introduction

  2. databaseLayer.py

  3. db_actions.db

  4. Sources_process.py

  5. db_updater.py

  6. views.py (admin)

  7. utils.py

  8. views.py (home)

  9. admin.js

  10. scripts.js

  11. statusses.js

  12. admin.html

  13. menu.html

  14. New files

Introduction

This file aims to help the futures developers to update our custom version of CVE-Search manually after a fresh new git clone from the original repository

This documentation tries to be comprehensive, if you notice any missing part of code, please add it to this file.

Another way to check if everything has been added is to search globally (e.g. ctrl + maj + f on VScode) certain key words ("entity", "entities", "watchlist", "signal") on the repository.

databaseLayer.py

location: cve-search/lib/DatabaseLayer.py

Add these variables at the beginning of the file:

colENTITIES = db["entities"]
colWATCHLIST = db["watchlist"]

databaselayer1

Add this variable to the function getDBStats(): "watchlist": {}

databaselayer2

Add these functions at the end of the file:

initWatchlist()
addEntity(entityName):
removeEntity(entityName):
addEntityCpe(entityName, cpe):
getAllEntities():
getEntityCpes(entityName):
deleteCPEFromEntity(entityName, cpe):
updateWatchlistCVE(doc):
updateWatchlistCVELastmodified(filter, date):
setWatchlistCVEComment(cveid, entity, product, comment):
switchWatchlistCVEStatus(cveid, entity, product):
deleteWatchlistCVE(cveid, en![databaselayer1](https://github.com/Dlux-cyber-projects/cve-search-2023/assets/82516361/e252e98c-bdb0-4423-96a2-8318ecdd958c)
tity, product):
getWatchlistCVE(cveid, entity, product):
getWatchlistCVEbyID(cveid):

databaselayer3 databaselayer4

db_actions.db

location: cve-search/lib/db_action.py

Add import for signal and watchlist

db_actions1

This argument:

update_watchlist=False, signal_groups=[]

These variables:

self.update_watchlist = update_watchlist
self.signal_groups = signal_groups

And the if condition:

db_actions2

Add the following function:

_update_watchlist(self)

db_actions3 db_actions4

Sources_process.py

location: cve-search/lib/Sources_process.py

Add import for signal notifications:

Sources_process1

In __init__() function, add:

This argument:

update_watchlist=False, signal_groups=[]

These variables:

self.update_watchlist = update_watchlist
self.signal_groups = signal_groups

Sources_process2

In function process_item() add these variables:

update_watchlist=self.update_watchlist
signal_groups=self.signal_groups

Sources_process3

Toolkit.py

location: cve-search/lib/Toolkit.py

Add this import

Toolkit1

Add isBlacklisted() function

Toolkit2

db_updater.py

location: cve-search/sbin/db_updater.py

Import getInfo from lib.DatabaseLayer

db_updater0

Add this function

argParser.add_argument()

db_updater1

In else statement of "while loop", add what is related to signal notification and watchlist:

db_updater2

views.py (admin)

location: cve-search/web/admin/views.py

Add these imports:

view_admin0

Add view_entities(args, kwargs) function

views_admin1

Add entities() function

views_admin2

Add entityAdd() function

views_admin3

Add entityRemove() function

views_admin4

Add entityCpeAdd() function

views_admin5

Add verify() function

views_admin6

Add verifyCaptcha() function

views_admin7

Add verifyCode() function

views_admin8

Add changeThresholds() function

views_admin9

Add deleteEntityCpe() function

views_admin10

utils.py

location: cve-search/web/home/utils.py

import getInfo in lib.DatabaseLayer

utils0

In generate_minimal_query() function, add threshold related code

utils1

In adminInfo() function, add:

"signalPhoneRegistered": getInfo('subscriptions')['registeredPhone'] != '',
watchlistInfos": getInfo('watchlist'),

utils2

views.py (home)

location: cve-search/web/home/views.py

In import add:

from flask_login.utils import login_required

views_home0

and

getEntityCpes,
setWatchlistCVEComment,
switchWatchlistCVEStatus,
deleteWatchlistCVE,
getWatchlistCVE,

view_home1

Add view_cpe_name() function

view_home2

Add view_entity_name() function:

view_home3

Add search_entity() function:

view_home4

Add browse_entity() function

view_home5

Add watchlist() function

view_home6

Add watchlist_cve() function

view_home7

Add save_comment() function

view_home8

Add switch_status() function

view_home9

Add delete_from_watchlist() function

view_home10

Add delete_filtered_watchlist() function view_home11

Add export_csv() function

view_home12

Add export_notice() function

view_home13

admin.js

Location: cve-search/web/static/js/custom/admin.js

Add verify() function

admin_js1

Add verifyCaptcha() function

admin_js2

Add verifyCode() function

admin_js3

scripts.js

Location: cve-search/web/static/js/custom/statuscriptssses.js

Add escapeHtml() function

script_js1

statusses.js

Location: cve-search/web/static/js/custom/statusses.js

In parseStatus(), add these cases

statusses

admin.html

location: cve-search/web/templates/admin.html

Add related watchlist code button

admin1

Add entities management

admin2

Add CVSS threshold

admin3

Add signal notifications

admin4

menu.html

Location: cve-search/web/templates/subpages/menu.html

Add link related to watchlist, vendor and entity

menu

New files

Locations: cve-search/lib/signalNotification.py

cve-search/web/static/css/custom/entities.css

cve-search/web/static/css/custom/entities.css

cve-search/web/static/css/custom/watchlistCVE.css

cve-search/web/static/css/custom/watchlistCVE.css

cve-search/web/static/js/custom/entities.js

cve-search/web/static/js/custom/entities.js

cve-search/web/static/js/custom/watchlist.js

cve-search/web/static/js/custom/watchlistCVE.js

cve-search/web/static/js/custom/watchlistCVE.js

cve-search/web/templates/browse_entity_products.html

cve-search/web/templates/browse_entity_products.html

cve-search/web/templates/entities.html

cve-search/web/templates/entities.html

cve-search/web/templates/search_entity.html

cve-search/web/templates/search_entity.html

cve-search/web/templates/watchlist.html

cve-search/web/templates/watchlistCve.html

cve-search/web/templates/subpages/browse_entity.html

cve-search/web/templates/subpages/browse_entity.html

cve-search/web/templates/subpages/static_table.html

cve-search/web/templates/subpages/static_table.html

cve-search/web/templates/subpages/watchlist_table.html

cve-search/web/templates/subpages/watchlist_table.html

Add these new files.

About

License:GNU Affero General Public License v3.0


Languages

Language:Python 77.4%Language:HTML 14.8%Language:JavaScript 6.1%Language:CSS 1.7%