Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bookmark plugin to make it work with v4.0.dev121 #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/plugins/bookmarks/plugins/bookmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self):
self.collectionName = "user_bookmarks"

def getPage(self, **args):
cvesp = cves.last(rankinglookup=True, namelookup=True, via4lookup=True, capeclookup=True,subscorelookup=True)
cvesp = cves.CveHandler(rankinglookup=True, namelookup=True, via4lookup=True, capeclookup=True,subscorelookup=True)
data = db.p_queryOne(self.collectionName, {"user": args["current_user"].get_id()})
bookmarks = data.get("bookmarks", []) if data else []
cve=[cvesp.getcve(cveid=x) for x in bookmarks]
Expand Down
70 changes: 64 additions & 6 deletions plugins/plugins/bookmarks/web.templates.plugins/bookmarks.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,68 @@
{% extends 'layouts/master-page' %}
{% extends 'layouts/master-page.html' %}
{% block title %}Bookmarked CVEs{% endblock %}
{% block content %}
<!-- breadcrumb -->

<ol class="breadcrumb">
<li><a href="/">Home</a></li>
<li class="active">Bookmarked</li>
</ol>
{% include 'subpages/table.html' %}
<a href="/">Home</a>
&nbsp;>&nbsp;
<a href="{{ url_for('plugins.openPlugin', plugin='Bookmarks') }}">Bookmarks</a>
</ol>
<table id="CVEs" class="table table-hover table-striped">
<thead class="thead-dark">
<tr>
<th width="2%"></th>
<th width="6%">ID</th>
<th width="3%">CVSS</th>
<th width="3%">CVSS3</th>
<th width="65%">Summary</th>
<th width="11%">Last (major) update</th>
<th width="11%">Published</th>
</tr>
</thead>
<tbody>
{% for c in cve %}
{% if 'whitelisted' in c %}{%set class="whitelisted"%}{% elif 'blacklisted' in c %}{%set class="blacklisted"%}
{% else %}{%set class=""%}{% endif %}
<tr id ="{{ c['id'] }}" class="{{class}}" {{'style=color:'+c['color'] if 'color' in c else ''}}>
<td>
{% if 'icon' in c %}
<i class="{{c['icon']}}"></i>
{% else %}
{% if 'whitelisted' in c %}
<i class="far fa-bookmark"></i>
{% elif 'blacklisted' in c %}
<i class="far fa-eye-slash"></i>
{% endif %}
{% endif %}
</td>
<td data-type="ID">
<a href="/cve/{{ c['id'] }}">{{ c['id'] }}</a>
{% if 'reason' in c %}
<br /><span class="badge badge-success">{{c['reason']}}</span>
{% endif %}
</td>
<td data-type="CVSS" data-value="{{ c['cvss'] }}">
{{ c['cvss'] }}
</td>
<td data-type="CVSS" data-value="{{ c['cvss3'] }}">
{{ c['cvss3'] }}
</td>
<td data-type="SUMMARY">
<div rel="tooltip" title="{{ c['summary'] }}">
{{ c['summary'][:250] }}
</div>
</td>
<td data-type="MODIFIED" data-value="{{ c['Modified'].strftime('%m/%d/%Y') }}">
{{ c['Modified'].strftime('%d-%m-%Y - %H:%M') }}
</td>
<td data-type="PUBLISHED" data-value="{{ c['Published'].strftime('%m/%d/%Y')}}">
{{ c['Published'].strftime('%d-%m-%Y - %H:%M') }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="#" class="back-to-top">Back to Top</a>
<a href="#" class="select-submit">Mark selected</a>
{% endblock %}