def test_parse_amass_output_locations(tmp_path): pao = ParseAmassOutput(target_file=tf, exempt_list=el, results_dir=str(tmp_path)) assert pao.output().get("target-ips").path == str((Path(tmp_path) / "target-results" / "ipv4_addresses").resolve()) assert pao.output().get("target-ip6s").path == str((Path(tmp_path) / "target-results" / "ipv6_addresses").resolve()) assert pao.output().get("target-subdomains").path == str( (Path(tmp_path) / "target-results" / "subdomains").resolve() )
def test_parse_amass_subdomain_results(tmp_path): pao = ParseAmassOutput(target_file=tf, exempt_list=el, results_dir=str(tmp_path)) pao.input = lambda: luigi.LocalTarget(amass_json) pao.run() contents = (Path(pao.output().get("target-subdomains").path)).read_text() print((Path(pao.output().get("target-subdomains").path))) print(contents) for line in contents.split(): assert line.strip() in subdomains
def test_parse_amass_ip6_results_only_contain_ipv6_addys(tmp_path): pao = ParseAmassOutput(target_file=tf, exempt_list=el, results_dir=str(tmp_path)) pao.input = lambda: luigi.LocalTarget(amass_json) pao.run() contents = (Path(pao.output().get("target-ip6s").path)).read_text() for line in contents.split(): try: ipaddress.ip_interface(line.strip()) # is it a valid ip/network? except ValueError: assert 0