Skip to content

Commit

Permalink
better handling of IPv6
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechromancer committed Dec 30, 2023
1 parent c089b9c commit baef2b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bbot/modules/masscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def process_output(self, line, result_callback):
with suppress(KeyError):
source = self.alive_hosts[ip]
if proto != "icmp":
result += f":{port_number}"
result = self.helpers.make_netloc(result, port_number)
if source is None:
source = self.make_event(ip, "IP_ADDRESS", source=self.get_source_event(ip))
self.emit_event(source)
Expand Down
6 changes: 4 additions & 2 deletions bbot/modules/templates/portscanner.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import ipaddress

from bbot.modules.base import BaseModule


Expand Down Expand Up @@ -38,7 +40,7 @@ async def filter_event(self, event):
return False, f"skipping IP_RANGE {event.host} because asset_inventory.use_previous=True"
return True

def _build_targets(self, target, delimiter=","):
def _build_targets(self, target):
invalid_targets = 0
targets = []
for t in target:
Expand All @@ -47,7 +49,7 @@ def _build_targets(self, target, delimiter=","):
invalid_targets += 1
else:
if self.helpers.is_ip(t):
targets.append(f"{t}/32")
targets.append(str(ipaddress.ip_network(t)))
else:
targets.append(str(t))
return targets, invalid_targets

0 comments on commit baef2b5

Please sign in to comment.