Skip to content
Snippets Groups Projects
Unverified Commit a6c20ec2 authored by Julien Palard's avatar Julien Palard
Browse files

Add new flag to only crawl new domains.

parent 51fe4eb2
No related branches found
No related tags found
No related merge requests found
......@@ -160,6 +160,9 @@ def parse_args():
parser.add_argument(
"--grep", help="Test only domain matching this argument.", type=str, nargs="+"
)
parser.add_argument("--new", action="store_true",
help="Just check new domains.",
)
parser.add_argument(
"--verbose",
"-v",
......@@ -203,9 +206,11 @@ async def rescan_domains(
def filter_domains(
domains: set[Domain], limit: int, grep: list[str], partial: tuple[int, int]
domains: set[Domain], limit: int, grep: list[str], partial: tuple[int, int], new: bool
) -> list[Domain]:
"""Filter domains according to --limit and --grep command line args."""
if new:
domains = [domain for domain in domains if not domain.http_status]
if grep:
domains = [
domain
......@@ -228,7 +233,7 @@ def main():
level=[logging.WARNING, logging.INFO, logging.DEBUG][args.verbose]
)
domains = parse_csv_file(args.file)
to_check = filter_domains(domains, args.limit, args.grep, args.partial)
to_check = filter_domains(domains, args.limit, args.grep, args.partial, args.new)
try:
asyncio.run(rescan_domains(to_check, args.kindness, args.verbose, args.silent))
except KeyboardInterrupt:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment