How to use get_hostnames method in autotest

Best Python code snippet using autotest_python

theharvester

Source:theharvester Github

copy

Full Screen

...105 print "[-] Searching in Google:"106 search = googlesearch.search_google(word, limit, start)107 search.process()108 all_emails = search.get_emails()109 all_hosts = search.get_hostnames()110 if engine == "googleCSE":111 print "[-] Searching in Google Custom Search:"112 search = googleCSE.search_googleCSE(word, limit, start)113 search.process()114 search.store_results()115 all_emails = search.get_emails()116 all_hosts = search.get_hostnames()117 if engine == "exalead":118 print "[-] Searching in Exalead:"119 search = exaleadsearch.search_exalead(word, limit, start)120 search.process()121 all_emails = search.get_emails()122 all_hosts = search.get_hostnames()123 elif engine == "bing" or engine == "bingapi":124 print "[-] Searching in Bing:"125 search = bingsearch.search_bing(word, limit, start)126 if engine == "bingapi":127 bingapi = "yes"128 else:129 bingapi = "no"130 search.process(bingapi)131 all_emails = search.get_emails()132 all_hosts = search.get_hostnames()133 elif engine == "yandex": # Not working yet134 print "[-] Searching in Yandex:"135 search = yandexsearch.search_yandex(word, limit, start)136 search.process()137 all_emails = search.get_emails()138 all_hosts = search.get_hostnames()139 elif engine == "pgp":140 print "[-] Searching in PGP key server.."141 search = pgpsearch.search_pgp(word)142 search.process()143 all_emails = search.get_emails()144 all_hosts = search.get_hostnames()145 elif engine == "jigsaw":146 print "[-] Searching in Jigsaw.."147 search = jigsaw.search_jigsaw(word, limit)148 search.process()149 people = search.get_people()150 print "Users from Jigsaw:"151 print "====================="152 for user in people:153 print user154 sys.exit()155 elif engine == "dogpilesearch":156 print "[-] Searching in Dogpilesearch.."157 search = dogpilesearch.search_dogpile(word, limit)158 search.process()159 all_emails = search.get_emails()160 all_hosts = search.get_hostnames()161 elif engine == "yahoo":162 print "[-] Searching in Yahoo.."163 search = yahoosearch.search_yahoo(word, limit)164 search.process()165 all_emails = search.get_emails()166 all_hosts = search.get_hostnames()167 elif engine == "baidu":168 print "[-] Searching in Baidu.."169 search = baidusearch.search_baidu(word, limit)170 search.process()171 all_emails = search.get_emails()172 all_hosts = search.get_hostnames()173 elif engine == "googleplus":174 print "[-] Searching in Google+ .."175 search = googleplussearch.search_googleplus(word, limit)176 search.process()177 people = search.get_people()178 print "Users from Google+:"179 print "===================="180 for user in people:181 print user182 sys.exit()183 elif engine == "twitter":184 print "[-] Searching in Twitter .."185 search = twittersearch.search_twitter(word, limit)186 search.process()187 people = search.get_people()188 print "Users from Twitter:"189 print "===================="190 for user in people:191 print user192 sys.exit()193 elif engine == "linkedin":194 print "[-] Searching in Linkedin.."195 search = linkedinsearch.search_linkedin(word, limit)196 search.process()197 people = search.get_people()198 print "Users from Linkedin:"199 print "===================="200 for user in people:201 print user202 sys.exit()203 elif engine == "google-profiles":204 print "[-] Searching in Google profiles.."205 search = googlesearch.search_google(word, limit, start)206 search.process_profiles()207 people = search.get_profiles()208 print "Users from Google profiles:"209 print "---------------------------"210 for users in people:211 print users212 sys.exit()213 elif engine == "all":214 print "Full harvest.."215 all_emails = []216 all_hosts = []217 virtual = "basic"218 print "[-] Searching in Google.."219 search = googlesearch.search_google(word, limit, start)220 search.process()221 emails = search.get_emails()222 hosts = search.get_hostnames()223 all_emails.extend(emails)224 all_hosts.extend(hosts)225 print "[-] Searching in PGP Key server.."226 search = pgpsearch.search_pgp(word)227 search.process()228 emails = search.get_emails()229 hosts = search.get_hostnames()230 all_hosts.extend(hosts)231 all_emails.extend(emails)232 print "[-] Searching in Bing.."233 bingapi = "no"234 search = bingsearch.search_bing(word, limit, start)235 search.process(bingapi)236 emails = search.get_emails()237 hosts = search.get_hostnames()238 all_hosts.extend(hosts)239 all_emails.extend(emails)240 print "[-] Searching in Exalead.."241 search = exaleadsearch.search_exalead(word, limit, start)242 search.process()243 emails = search.get_emails()244 hosts = search.get_hostnames()245 all_hosts.extend(hosts)246 all_emails.extend(emails)247 #Clean up email list, sort and uniq248 all_emails=sorted(set(all_emails))249 #Results############################################################250 print "\n\n[+] Emails found:"251 print "------------------"252 if all_emails == []:253 print "No emails found"254 else:255 print "\n".join(all_emails)256 print "\n[+] Hosts found in search engines:"257 print "------------------------------------"258 if all_hosts == []:259 print "No hosts found"260 else:261 all_hosts=sorted(set(all_hosts))262 print "[-] Resolving hostnames IPs... "263 full_host = hostchecker.Checker(all_hosts)264 full = full_host.check()265 for host in full:266 ip = host.split(':')[0]267 print host268 if host_ip.count(ip.lower()):269 pass270 else:271 host_ip.append(ip.lower())272 #DNS reverse lookup#################################################273 dnsrev = []274 if dnslookup == True:275 print "\n[+] Starting active queries:"276 analyzed_ranges = []277 for x in full:278 ip = x.split(":")[0]279 range = ip.split(".")280 range[3] = "0/24"281 range = string.join(range, '.')282 if not analyzed_ranges.count(range):283 print "[-]Performing reverse lookup in :" + range284 a = dnssearch.dns_reverse(range, True)285 a.list()286 res = a.process()287 analyzed_ranges.append(range)288 else:289 continue290 for x in res:291 if x.count(word):292 dnsrev.append(x)293 if x not in full:294 full.append(x)295 print "Hosts found after reverse lookup:"296 print "---------------------------------"297 for xh in dnsrev:298 print xh299 #DNS Brute force####################################################300 dnsres = []301 if dnsbrute == True:302 print "\n[-] Starting DNS brute force:"303 a = dnssearch.dns_force(word, dnsserver, verbose=True)304 res = a.process()305 print "\n[+] Hosts found after DNS brute force:\n"306 for y in res:307 print y308 dnsres.append(y)309 if y not in full:310 full.append(y)311 #DNS TLD expansion###################################################312 dnstldres = []313 if dnstld == True:314 print "[-] Starting DNS TLD expansion:"315 a = dnssearch.dns_tld(word, dnsserver, verbose=True)316 res = a.process()317 print "\n[+] Hosts found after DNS TLD expansion:"318 print "=========================================="319 for y in res:320 print y321 dnstldres.append(y)322 if y not in full:323 full.append(y)324 #Virtual hosts search###############################################325 if virtual == "basic":326 print "[+] Virtual hosts:"327 print "=================="328 for l in host_ip:329 search = bingsearch.search_bing(l, limit, start)330 search.process_vhost()331 res = search.get_allhostnames()332 for x in res:333 x = re.sub(r'[[\<\/?]*[\w]*>]*','',x)334 x = re.sub('<','',x)335 x = re.sub('>','',x)336 print l + "\t" + x337 vhost.append(l + ":" + x)338 full.append(l + ":" + x)339 vhost=sorted(set(vhost))340 else:341 pass342 shodanres = []343 shodanvisited = []344 if shodan == True:345 print "[+] Shodan Database search:"346 for x in full:347 print x348 try:349 ip = x.split(":")[0]350 if not shodanvisited.count(ip):351 print "\tSearching for: " + x352 a = shodansearch.search_shodan(ip)353 shodanvisited.append(ip)354 results = a.run()355 for res in results:356 shodanres.append(357 x + "SAPO" + str(res['banner']) + "SAPO" + str(res['port']))358 except:359 pass360 print "[+] Shodan results:"361 print "==================="362 for x in shodanres:363 print x.split("SAPO")[0] + ":" + x.split("SAPO")[1]364 else:365 pass366 ###################################################################367 # Here i need to add explosion mode.368 # Tengo que sacar los TLD para hacer esto.369 recursion = None370 if recursion:371 start = 0372 for word in vhost:373 search = googlesearch.search_google(word, limit, start)374 search.process()375 emails = search.get_emails()376 hosts = search.get_hostnames()377 print emails378 print hosts379 else:380 pass381 #Reporting#######################################################382 if filename != "":383 try:384 print "[+] Saving files..."385 html = htmlExport.htmlExport(386 all_emails,387 full,388 vhost,389 dnsres,390 dnsrev,...

Full Screen

Full Screen

theHarvester.py

Source:theHarvester.py Github

copy

Full Screen

...90 print "[-] Searching in Google:"91 search=googlesearch.search_google(word,limit,start)92 search.process()93 all_emails=search.get_emails()94 all_hosts=search.get_hostnames()95 if engine == "exalead":96 print "[-] Searching in Exalead:"97 search=exaleadsearch.search_exalead(word,limit,start)98 search.process()99 all_emails=search.get_emails()100 all_hosts=search.get_hostnames()101 elif engine == "bing" or engine =="bingapi": 102 print "[-] Searching in Bing:"103 search=bingsearch.search_bing(word,limit,start)104 if engine =="bingapi":105 bingapi="yes"106 else:107 bingapi="no"108 search.process(bingapi)109 all_emails=search.get_emails()110 all_hosts=search.get_hostnames()111 elif engine == "yandex":# Not working yet112 print "[-] Searching in Yandex:"113 search=yandexsearch.search_yandex(word,limit,start)114 search.process()115 all_emails=search.get_emails()116 all_hosts=search.get_hostnames()117 elif engine == "pgp":118 print "[-] Searching in PGP key server.."119 search=pgpsearch.search_pgp(word)120 search.process()121 all_emails=search.get_emails()122 all_hosts=search.get_hostnames()123 elif engine == "people123":124 print "[-] Searching in 123People.."125 search = people123.search_123people(word,limit)126 search.process()127 people = search.get_people()128 print "Users from 123People:"129 print "====================="130 for user in people:131 print user132 sys.exit()133 elif engine == "jigsaw":134 print "[-] Searching in Jigsaw.."135 search = jigsaw.search_jigsaw(word,limit)136 search.process()137 people = search.get_people()138 print "Users from Jigsaw:"139 print "====================="140 for user in people:141 print user142 sys.exit()143 elif engine == "linkedin":144 print "[-] Searching in Linkedin.."145 search=linkedinsearch.search_linkedin(word,limit)146 search.process()147 people=search.get_people()148 print "Users from Linkedin:"149 print "===================="150 for user in people:151 print user152 sys.exit()153 elif engine == "google-profiles":154 print "[-] Searching in Google profiles.."155 search=googlesearch.search_google(word,limit,start)156 search.process_profiles()157 people=search.get_profiles()158 print "Users from Google profiles:"159 print "---------------------------"160 for users in people:161 print users162 sys.exit()163 elif engine == "all":164 print "Full harvest.."165 all_emails=[]166 all_hosts=[]167 virtual = "basic"168 print "[-] Searching in Google.."169 search=googlesearch.search_google(word,limit,start)170 search.process()171 emails=search.get_emails()172 hosts=search.get_hostnames()173 all_emails.extend(emails)174 all_hosts.extend(hosts)175 print "[-] Searching in PGP Key server.."176 search=pgpsearch.search_pgp(word)177 search.process()178 emails=search.get_emails()179 hosts=search.get_hostnames()180 all_hosts.extend(hosts)181 all_emails.extend(emails)182 print "[-] Searching in Bing.."183 bingapi="no"184 search=bingsearch.search_bing(word,limit,start)185 search.process(bingapi)186 emails=search.get_emails()187 hosts=search.get_hostnames()188 all_hosts.extend(hosts)189 all_emails.extend(emails)190 print "[-] Searching in Exalead.."191 search=exaleadsearch.search_exalead(word,limit,start)192 search.process()193 emails=search.get_emails()194 hosts=search.get_hostnames()195 all_hosts.extend(hosts)196 all_emails.extend(emails)197 #Results############################################################198 print "\n[+] Emails found:"199 print "------------------"200 if all_emails ==[]:201 print "No emails found"202 else:203 for emails in all_emails:204 print emails 205 print "\n[+] Hosts found in search engines:"206 print "------------------------------------"207 if all_hosts == []:208 print "No hosts found"209 else:210 full_host=hostchecker.Checker(all_hosts)211 full=full_host.check()212 for host in full:213 ip=host.split(':')[0]214 print host215 if host_ip.count(ip.lower()):216 pass217 else:218 host_ip.append(ip.lower())219 220 #DNS reverse lookup#################################################221 dnsrev=[]222 if dnslookup==True:223 print "\n[+] Starting active queries:"224 analyzed_ranges=[]225 for x in full:226 ip=x.split(":")[0]227 range=ip.split(".")228 range[3]="0/24"229 range=string.join(range,'.')230 if not analyzed_ranges.count(range):231 print "[-]Performing reverse lookup in :" + range232 a=dnssearch.dns_reverse(range,True)233 a.list()234 res=a.process()235 analyzed_ranges.append(range)236 else:237 continue238 for x in res:239 if x.count(word):240 dnsrev.append(x)241 if x not in full:242 full.append(x)243 print "Hosts found after reverse lookup:"244 print "---------------------------------"245 for xh in dnsrev:246 print xh247 #DNS Brute force####################################################248 dnsres=[]249 if dnsbrute==True:250 print "[-] Starting DNS brute force:"251 a=dnssearch.dns_force(word,dnsserver,verbose=True)252 res=a.process()253 print "[+] Hosts found after DNS brute force:\n"254 for y in res:255 print y256 dnsres.append(y)257 if y not in full:258 full.append(y)259 #DNS TLD expansion###################################################260 dnstldres=[]261 if dnstld==True:262 print "[-] Starting DNS TLD expansion:"263 a=dnssearch.dns_tld(word,dnsserver,verbose=True)264 res=a.process()265 print "\n[+] Hosts found after DNS TLD expansion:"266 print "=========================================="267 for y in res:268 print y269 dnstldres.append(y)270 if y not in full:271 full.append(y)272 273 #Virtual hosts search###############################################274 if virtual == "basic":275 print "[+] Virtual hosts:"276 print "=================="277 for l in host_ip:278 search=bingsearch.search_bing(l,limit,start)279 search.process_vhost()280 res=search.get_allhostnames()281 for x in res:282 print l+"\t"+x283 vhost.append(l+":"+x)284 full.append(l+":"+x)285 else:286 pass287 shodanres=[]288 shodanvisited=[]289 if shodan == True:290 print "[+] Shodan Database search:"291 for x in full:292 print x293 try:294 ip=x.split(":")[0]295 if not shodanvisited.count(ip):296 print "\tSearching for: " + x 297 a=shodansearch.search_shodan(ip)298 shodanvisited.append(ip)299 results=a.run()300 for res in results:301 shodanres.append(x+"SAPO"+str(res['banner'])+"SAPO"+str(res['port']))302 except:303 pass304 print "[+] Shodan results:"305 print "==================="306 for x in shodanres:307 print x.split("SAPO")[0] +":"+ x.split("SAPO")[1]308 else:309 pass310 ###################################################################311 #Here i need to add explosion mode.312 #Tengo que sacar los TLD para hacer esto.313 recursion= None 314 if recursion:315 start=0316 for word in vhost:317 search=googlesearch.search_google(word,limit,start)318 search.process()319 emails=search.get_emails()320 hosts=search.get_hostnames()321 print emails322 print hosts323 else:324 pass325 326 if filename!="": 327 try:328 print "Saving file"329 html = htmlExport.htmlExport(all_emails,full,vhost,dnsres,dnsrev,filename,word,shodanres,dnstldres)330 save = html.writehtml()331 sys.exit()332 except Exception,e:333 print e 334 print "Error creating the file"...

Full Screen

Full Screen

run_tests.py

Source:run_tests.py Github

copy

Full Screen

...26 response = requests.get(proxy_instances_url)27 response_body = response.json()28 instance_list = list(filter(lambda instance: instance["isProxy"] == False, response_body))29 assert len(instance_list) == 530def get_hostnames():31 response = requests.get(proxy_instances_url)32 response_body = response.json()33 return [instance["hostname"] for instance in response_body]34def test_instance_hostnames_are_stable():35 initial_set = get_hostnames()36 for _ in range(1, 21):37 assert get_hostnames() == initial_set38def test_only_two_instances_are_active():39 response = requests.get(proxy_instances_url)40 response_body = response.json()41 instance_list = list(filter(lambda instance: instance["isActive"] == True, response_body))42 assert len(instance_list) == 243def test_only_one_proxy_is_active():44 response = requests.get(proxy_instances_url)45 response_body = response.json()46 instance_list = list(filter(lambda instance: instance["isActive"] == True and 47 instance["isProxy"] == True, response_body))48 assert len(instance_list) == 149def test_only_one_backend_is_active():50 response = requests.get(proxy_instances_url)51 response_body = response.json()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful