Skip to content

Commit bff1822

Browse files
committed
change event type from VULNERABILITY to FINDING
1 parent 88d7b60 commit bff1822

File tree

2 files changed

+16
-25
lines changed

2 files changed

+16
-25
lines changed

bbot/modules/deadly/legba.py

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def map_protocol_to_legba_plugin_name(common_protocol_name: str) -> str:
1717

1818
class legba(BaseModule):
1919
watched_events = ["PROTOCOL"]
20-
produced_events = ["VULNERABILITY"]
20+
produced_events = ["FINDING"]
2121
flags = ["active", "aggressive", "deadly"]
2222
per_hostport_only = True
2323
meta = {
@@ -149,8 +149,8 @@ async def handle_event(self, event):
149149

150150
await self.run_process(command)
151151

152-
async for new_vuln_event in self.parse_output(output_path, event):
153-
await self.emit_event(new_vuln_event)
152+
async for finding_event in self.parse_output(output_path, event):
153+
await self.emit_event(finding_event)
154154

155155
async def parse_output(self, output_filepath, event):
156156
protocol = event.data["protocol"].lower()
@@ -177,10 +177,16 @@ async def parse_output(self, output_filepath, event):
177177
self.warning(f"Failed to parse Legba output ({line}), using raw output instead: {e}")
178178
message_addition = f"raw output: {line}"
179179

180-
yield self.create_vuln_event(
181-
"CRITICAL",
182-
f"Valid {protocol} credentials found - {message_addition}",
183-
event,
180+
yield self.make_event(
181+
{
182+
"severity": "CRITICAL",
183+
"confidence": "CONFIRMED",
184+
"host": str(event.host),
185+
"port": str(event.port),
186+
"description": f"Valid {protocol} credentials found - {message_addition}",
187+
},
188+
"FINDING",
189+
parent=event,
184190
)
185191
except FileNotFoundError:
186192
self.info(
@@ -264,18 +270,3 @@ async def construct_command(self, host, port, protocol):
264270
cmd += ["--rate-limit", self.config.rate_limit, "--concurrency", self.config.concurrency]
265271

266272
return cmd, output_path
267-
268-
def create_vuln_event(self, severity, description, source_event):
269-
host = str(source_event.host)
270-
port = int(source_event.port)
271-
272-
return self.make_event(
273-
{
274-
"severity": severity,
275-
"host": host,
276-
"port": port,
277-
"description": description,
278-
},
279-
"VULNERABILITY",
280-
source_event,
281-
)

bbot/test/test_step_2/module_tests/test_module_legba.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ async def setup_after_prep(self, module_test):
8383

8484
def check(self, module_test, events):
8585
protocol = module_test.request_fixture.getfixturevalue("protocol")
86-
vuln_events = [e for e in events if e.type == "VULNERABILITY"]
86+
finding_events = [e for e in events if e.type == "FINDING"]
8787

88-
assert len(vuln_events) == 1
88+
assert len(finding_events) == 1
8989

9090
expected_desc = {
9191
"ssh": "Valid ssh credentials found - remnux:malware",
@@ -97,4 +97,4 @@ def check(self, module_test, events):
9797
"postgresql": "Valid postgresql credentials found - postgres:postgres",
9898
}
9999

100-
assert expected_desc[protocol] in vuln_events[0].data["description"]
100+
assert expected_desc[protocol] in finding_events[0].data["description"]

0 commit comments

Comments
 (0)