def mark(self, cve, **args): user = args["current_user"].get_id() if db.p_readUserSetting(self.collectionName, user, "mark") == "show": color = db.p_readUserSetting(self.collectionName, user, "markcolor") userdata = db.p_queryOne(self.collectionName, {'user': user}) if userdata and 'cves' in userdata and cve in userdata['cves']: return (None, color)
def getCVEActions(self, cve, **args): if db.p_readUserSetting(self.collectionName, args["current_user"].get_id(), "buttons") == "show": userdata = db.p_queryOne(self.collectionName, {'user': args["current_user"].get_id()}) if userdata and 'cves' in userdata and cve in userdata['cves']: return [{'text': 'Unsee', 'action': 'unsee', 'icon': 'eye-close'}] else: return [{'text': 'See', 'action': 'see', 'icon': 'eye-open'}]
def doFilter(self, filters, **args): for fil in filters.keys(): if fil == "hideSeen": if args["current_user"].is_authenticated(): if filters[fil] == "hide": cves = db.p_queryOne(self.collectionName, {'user': args["current_user"].get_id()}) cves = cves["cves"] if cves and 'cves' in cves else [] return {'id': {"$nin": cves}} return {}
def getCVEActions(self, cve, **args): if self._userAlowed(args["current_user"]): if db.p_readUserSetting(self.collectionName, args["current_user"].get_id(), "buttons") == "show": userdata = db.p_queryOne(self.collectionName, {}) shortname = self.shortName + " " if self.shortName else "" if userdata and 'cves' in userdata and cve in userdata['cves']: return [{'text': shortname+'Uncheck', 'action': 'uncheck', 'icon': 'check'}] else: return [{'text': shortname+'Check', 'action': 'check', 'icon': 'unchecked'}]
def doFilter(self, filters, **args): for fil in filters.keys(): if fil == self.uid+"_"+"hidechecked": if self._userAlowed(args["current_user"]): if filters[fil] == "hide": cves = db.p_queryOne(self.collectionName, {}) cves = cves["cves"] if cves and 'cves' in cves else [] return {'id': {"$nin": cves}} return {}
def doFilter(self, filters, **args): for fil in filters.keys(): if fil == self.uid + "_" + "hidechecked": if self._userAlowed(args["current_user"]): if filters[fil] == "hide": cves = db.p_queryOne(self.collectionName, {}) cves = cves["cves"] if cves and 'cves' in cves else [] return {'id': {"$nin": cves}} return {}
def doFilter(self, filters, **args): for fil in filters.keys(): if fil == "hideSeen": if args["current_user"].is_authenticated(): if filters[fil] == "hide": cves = db.p_queryOne( self.collectionName, {'user': args["current_user"].get_id()}) cves = cves["cves"] if cves and 'cves' in cves else [] return {'id': {"$nin": cves}} return {}
def getPage(self, **args): cvesp = cves.last(rankinglookup=True, namelookup=True, vfeedlookup=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] page = "bookmarks.html" return (page, {"cve": cve})
def cvePluginInfo(self, cve, **args): misp = db.p_queryOne(self.collectionName, {'id': cve}) if misp: misp.pop("id") data = "<table class='invisiTable'>" for key in misp.keys(): data+="<tr> <td><b>%s</b></td> <td>"%key for value in misp[key]: data+="<pre>%s</pre>"%value data+="</td> </tr>" data += "</table>" return {'title': "MISP", 'data': data}
def getCVEActions(self, cve, **args): if db.p_readUserSetting(self.collectionName, args["current_user"].get_id(), "buttons") == "show": userdata = db.p_queryOne(self.collectionName, {'user': args["current_user"].get_id()}) if userdata and 'cves' in userdata and cve in userdata['cves']: return [{ 'text': 'Unsee', 'action': 'unsee', 'icon': 'eye-close' }] else: return [{'text': 'See', 'action': 'see', 'icon': 'eye-open'}]
def getCVEActions(self, cve, **args): userdata = db.p_queryOne(self.collectionName, {'user': args["current_user"].get_id()}) if userdata and 'bookmarks' in userdata and cve in userdata[ 'bookmarks']: return [{ 'text': 'Remove bookmark', 'action': 'unbookmark', 'icon': 'star' }] else: return [{ 'text': 'Bookmark', 'action': 'bookmark', 'icon': 'star-empty' }]
def onCVEAction(self, cve, action, **args): if args["current_user"].is_authenticated(): if action == "save": data = db.p_queryOne(self.collectionName, {'cve': cve}) user = args["current_user"].get_id() # Ensure the entry exists if not data: db.p_addEntry(self.collectionName, {"cve": cve, "notes": []}) # Get note if exists: self._deleteIfExists(cve, user, int(args["fields"]["id"][0])) # Add note nid = db.p_readSetting(self.collectionName, "last_note") + 1 db.p_addToList(self.collectionName, {'cve': cve}, "notes", {'id': nid, 'user': user, 'notes': args["fields"]["text"][0]}) # Update last note id db.p_writeSetting(self.collectionName, "last_note", nid) return True elif action == "delete": user = args["current_user"].get_id() self._deleteIfExists(cve, user, int(args["fields"]["id"][0])) return True
def getCVEActions(self, cve, **args): if self._userAlowed(args["current_user"]): if db.p_readUserSetting(self.collectionName, args["current_user"].get_id(), "buttons") == "show": userdata = db.p_queryOne(self.collectionName, {}) shortname = self.shortName + " " if self.shortName else "" if userdata and 'cves' in userdata and cve in userdata['cves']: return [{ 'text': shortname + 'Uncheck', 'action': 'uncheck', 'icon': 'check' }] else: return [{ 'text': shortname + 'Check', 'action': 'check', 'icon': 'unchecked' }]
def _getNotesFor(self, cve, user): data = db.p_queryOne(self.collectionName, {'cve': cve}) notes = [] if data and 'notes' in data and user in [x["user"] for x in data['notes'] if 'user' in x]: notes = [x for x in data['notes'] if x.get('user') == user] return notes