Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add masscan support #92

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions grinder/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,13 +1190,23 @@ def __process_current_product_queries(self, product_info: dict) -> None:
)


manmolecular marked this conversation as resolved.
Show resolved Hide resolved
masscan_raw_results = self.masscan_scan(
hosts=hosts,
ports=ports,
top_ports=top_ports,
rate=rate,
)
self.__parse_masscan_results(masscan_raw_results, hosts, product_info)
try:
masscan_raw_results = self.masscan_scan(
hosts=hosts,
ports=ports,
top_ports=top_ports,
rate=rate,
)
self.__parse_masscan_results(masscan_raw_results, hosts, product_info)
except Exception as masscan_exception:
if "FAIL: failed to detect MAC address of interface" in str(masscan_exception):
manmolecular marked this conversation as resolved.
Show resolved Hide resolved
print("│ ", end="")
cprint(f"You are probably using a VPN, but Masscan is not working with one", "yellow")
print(f"└ ", end="")
cprint(f"Skip all Masscan tasks", "yellow")
else:
raise masscan_exception


manmolecular marked this conversation as resolved.
Show resolved Hide resolved
@exception_handler(expected_exception=GrinderCoreTlsScanner)
def tls_scan(self, scanner_path: str) -> None:
Expand Down Expand Up @@ -1367,10 +1377,7 @@ def masscan_scan(
except Exception as masscan_exception:
if "network is unreachable" in str(masscan_exception):
manmolecular marked this conversation as resolved.
Show resolved Hide resolved
print("│ ", end="")
cprint(
f"Network {hosts} is unreachable, skip",
"yellow",
)
cprint(f"Network {hosts} is unreachable, skip", "yellow")
else:
raise masscan_exception

Expand Down