Skip to content
28 changes: 18 additions & 10 deletions modules/getweblinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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')
7 changes: 5 additions & 2 deletions torBot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down