Example #1
0
 def send_fact(self, source: str, scan_id, fact: BaseFact):
     fact_type = fact.schema()["title"]
     fact_dict = {
         "@metadata": {
             "index": f"facts-{fact_type.lower()}",
         },
         "fact_type": fact_type,
         "fact_source": source,
         "scan_id": scan_id,
         **fact.dict()
     }
     fact_str = ujson.dumps(fact_dict).encode('utf-8') + b"\n"
     self.send(fact_str)
Example #2
0
 def elastic_mapping(cls):
     return BaseFact.make_mapping(
         {'mappings': {
             'properties': {
                 'fqdn': {
                     'type': 'keyword'
                 }
             }
         }}, )
Example #3
0
 def elastic_mapping(cls):
     return BaseFact.make_mapping(
         {'mappings': {
             'properties': {
                 'address': {
                     'type': 'ip'
                 }
             }
         }}, )
Example #4
0
 def elastic_mapping(cls):
     return BaseFact.make_mapping(
         {
             'mappings': {
                 'properties': {
                     'lastname': {'type': 'keyword'},
                     'firstname': {'type': 'keyword'},
                 },
             },
         },
     )