MCPcopy Create free account
hub / github.com/TheSecuredAnalyst/security-suite / SearchSploit

Class SearchSploit

modules/exploit/searchsploit.py:12–185  ·  view source on GitHub ↗

Interface to searchsploit and Exploit-DB.

Source from the content-addressed store, hash-verified

10
11class SearchSploit:
12 """Interface to searchsploit and Exploit-DB."""
13
14 def __init__(self):
15 self.logger = get_logger("exploit.searchsploit")
16 self.searchsploit_available = shutil.which("searchsploit") is not None
17
18 async def search(
19 self,
20 query: str,
21 exact_match: bool = False,
22 exclude_dos: bool = True,
23 ) -> list[dict]:
24 """Search for exploits matching query."""
25 if not self.searchsploit_available:
26 self.logger.warning("searchsploit not found. Install exploitdb package.")
27 return []
28
29 cmd = ["searchsploit", "--json"]
30
31 if exact_match:
32 cmd.append("--exact")
33
34 if exclude_dos:
35 cmd.append("--exclude=dos")
36
37 cmd.append(query)
38
39 try:
40 proc = await asyncio.create_subprocess_exec(
41 *cmd,
42 stdout=asyncio.subprocess.PIPE,
43 stderr=asyncio.subprocess.PIPE,
44 )
45
46 stdout, stderr = await proc.communicate()
47
48 if stdout:
49 data = json.loads(stdout.decode())
50 return data.get("RESULTS_EXPLOIT", [])
51
52 except json.JSONDecodeError:
53 self.logger.error("Failed to parse searchsploit output")
54 except Exception as e:
55 self.logger.error(f"searchsploit failed: {e}")
56
57 return []
58
59 async def search_for_service(
60 self,
61 service: str,
62 version: str | None = None,
63 ) -> list[dict]:
64 """Search for exploits for a specific service and version."""
65 query = service
66 if version:
67 query = f"{service} {version}"
68
69 return await self.search(query)

Callers 1

exploit_searchFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected