Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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'}]
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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 {}
Exemplo n.º 5
0
 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'}]
Exemplo n.º 6
0
 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 {}
Exemplo n.º 7
0
 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 {}
Exemplo n.º 8
0
 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 {}
Exemplo n.º 9
0
 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})
Exemplo n.º 10
0
 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}
Exemplo n.º 11
0
 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'}]
Exemplo n.º 12
0
 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'
         }]
Exemplo n.º 13
0
 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
Exemplo n.º 14
0
 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'
                 }]
Exemplo n.º 15
0
 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