def test_get_san_failed(self): """Test if get_san() exits correctly with non-existant domain.""" with self.assertRaises(SystemExit) as cm: print('Testing non-existant domain name:') get_san(hostname='123oaenf.comasd', port=443) exception = cm.exception self.assertEqual(exception.code, 1)
def test_get_san_crt_sh_integration(self): """Test if get_san() returns domains from crt.sh.""" subdomain_set = get_san(hostname=self.hostname, port=self.port, crt_sh=True, match=True) self.assertIsInstance(subdomain_set, set) self.assertTrue(len(subdomain_set) > 100)
'--version', action='version', help='Print version information.', version='1.3.1') args = parser.parse_args() """ if GAN detects the 'hostname' is actually a file, then it assumes that it's an NMAP XML output and try to parse it. If it's not a file, then it asummes that it is actually a hostname. """ if not isfile(args.hostname): sans = get_san(hostname=args.hostname, port=args.port, xml_parse=False, crt_sh=args.search_crt, match=args.match_domain) report_single(sans, args.hostname, args.format) if args.clipboard: clipboard_output(sans, args.clipboard) if args.output: output(sans, args.format, args.output) else: hosts = parse_nmap(args.hostname) # if no hosts are found in XML then exits if not any(hosts):
def test_get_san_return_empty_list(self): """Returns empty list if host from Nmap XML returned no SAN's.""" subdomain_set = get_san(hostname='123oaenf.comasd', port=self.port, xml_parse=True) self.assertIsInstance(subdomain_set, list)
def test_get_san_single_host(self): """Test get_san() when invoked with a single host and port.""" subdomain_set = get_san(hostname=self.hostname, port=self.port) self.assertIsInstance(subdomain_set, set) self.assertTrue(self.hostname in subdomain_set)