diff --git a/modules/getweblinks.py b/modules/getweblinks.py index 4e882f61..f2bf953b 100644 --- a/modules/getweblinks.py +++ b/modules/getweblinks.py @@ -6,7 +6,7 @@ import bs4 """Get all onion links from the website""" -def getLinks(soup,ext): +def getLinks(soup,ext,live=0): _soup_instance = bs4.BeautifulSoup extensions = [] if ext: @@ -30,16 +30,24 @@ def getLinks(soup,ext): print ('') print (bcolors.OKGREEN+'Websites Found - '+bcolors.ENDC+str(len(websites))) print ('-------------------------------') - for web in websites: - flag=1 - try: - urllib.request.urlopen(web) - except urllib.error.HTTPError as e: - if e.code: + if live: + for web in websites: + flag=1 + try: + urllib.request.urlopen(web) + except urllib.error.HTTPError as e: + if e.code: + print(bcolors.On_Red+web+bcolors.ENDC) + flag=0 + except urllib.error.URLError as e: print(bcolors.On_Red+web+bcolors.ENDC) flag=0 - if flag: - print(web) - return websites + + if flag: + print(web) + else: + for web in websites: + print(web) + return websites else: raise('Method parameter is not of instance bs4.BeautifulSoup') diff --git a/torBot.py b/torBot.py index c665f6e7..46dfecf1 100644 --- a/torBot.py +++ b/torBot.py @@ -77,14 +77,17 @@ def main(): parser = argparse.ArgumentParser() parser.add_argument("-q","--quiet",action="store_true") parser.add_argument("-u","--url",help="Specifiy a website link to crawl") - parser.add_argument("-m","--mail",action="store_true", help="Get e-mail addresses from the crawled sites.") + parser.add_argument("-m","--mail",action="store_true", help="Get e-mail addresses from the crawled sites") parser.add_argument("-e","--extension",action='append',dest='extension',default=[],help="Specifiy additional website extensions to the list(.com or .org etc)") + parser.add_argument("-l","--live",action="store_true",help="Check if websites are live or not (slow)") args = parser.parse_args() if args.quiet == 0: header() print ("Tor Ip Address :") link = args.url ext = 0 + live = 0 + live = args.live ext = args.extension a = readPage("https://check.torproject.org/",1) if link: @@ -93,7 +96,7 @@ def main(): b = readPage("http://torlinkbgs6aabns.onion/") if args.mail: getMails(b) - getLinks(b,ext) + getLinks(b,ext,live) print ("\n\n") return 0