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

Function search_exploit_local

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

Source from the content-addressed store, hash-verified

66
67
68def search_exploit_local(ctx: Context, query: str, limit: int) -> Iterable[Mapping[str, Any]]:
69 if not ctx.database_path.exists():
70 raise click.ClickException("There is no local database file. Run 'getsploit --update'")
71 conn = sqlite3.connect(ctx.database_path)
72 cursor = conn.cursor()
73 search_results = cursor.execute(
74 f"SELECT * FROM exploits WHERE exploits MATCH ? ORDER BY published LIMIT ?",
75 (query, limit),
76 ).fetchall()
77 fields = [d[0] for d in cursor.description]
78 for row in search_results:
79 yield dict(zip(fields, row))
80
81
82def search_exploit_online(ctx: Context, query: str, limit: int) -> Iterable[Mapping[str, Any]]:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected