MCPcopy
hub / github.com/vulnersCom/getsploit / search_exploit_online

Function search_exploit_online

getsploit/__init__.py:82–108  ·  view source on GitHub ↗
(ctx: Context, query: str, limit: int)

Source from the content-addressed store, hash-verified

80
81
82def search_exploit_online(ctx: Context, query: str, limit: int) -> Iterable[Mapping[str, Any]]:
83 resp = ctx.client.post(
84 "v3/search/lucene/",
85 json={
86 "query": f"bulletinFamily:exploit AND ({query})",
87 "size": limit,
88 "fields": ["id", "type", "title", "description", "sourceData", "published"],
89 },
90 )
91 resp.raise_for_status()
92 data = resp.json()["data"]
93 if data.get("exactMatch"):
94 results = [data["exactMatch"]]
95 elif data.get("search"):
96 results = data["search"]
97 else:
98 results = []
99 for item in results:
100 d = item["_source"]
101 yield {
102 "id": d["id"],
103 "title": d["title"],
104 "description": d["description"],
105 "sourceData": d.get("sourceData", ""),
106 "published": d["published"],
107 "vhref": f"https://vulners.com/{d['type']}/{d['id']}",
108 }
109
110
111def slugify(value: str) -> str:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected