Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only .onion sites #8

Merged
merged 4 commits into from
Jun 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added modules/__init__.py
Empty file.
9 changes: 6 additions & 3 deletions modules/getweblinks.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import bs4


"""Get all onion links from the website"""
def getLinks(soup):
_soup_instance = bs4.BeautifulSoup
extensions = ['.onion','.onion/']
if isinstance(type(soup), type(_soup_instance)):
websites = []
for link in soup.find_all('a'):
email_link = link.get('href')
if email_link != None:
if 'http' in email_link:
websites.append(email_link)
for extension in extensions:
if email_link.endswith(extension):
websites.append(email_link)
else:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not email_link. its web_link, will fix tnat on next commit.

pass
"""Pretty print output as below"""
Expand All @@ -19,6 +21,7 @@ def getLinks(soup):
print ('-------------------------------')
for web in websites:
print (web)
return ''
#return ''
return websites
else:
raise('Method parameter is not of instance bs4.BeautifulSoup')
3 changes: 2 additions & 1 deletion tests/test_getweblinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ def setUp(self):
self.held, sys.stdout = sys.stdout, StringIO()

def test_print_links(self):
data = "\nWebsites Found - 7\n-------------------------------\nhttp://ads.wsrs.net/www/delivery/ck.php?n=MyIP856a6b4\nhttp://ads.wsrs.net/www/delivery/ck.php?n=MyIPbf5d683\nhttp://aff.ironsocket.com/SH7L\nhttp://aff.ironsocket.com/SH7L\nhttp://ads.wsrs.net/www/delivery/ck.php?n=MyIPdb5f512\nhttp://wsrs.net/\nhttp://cmsgear.com/\n"
#data = "\nWebsites Found - 7\n-------------------------------\nhttp://ads.wsrs.net/www/delivery/ck.php?n=MyIP856a6b4\nhttp://ads.wsrs.net/www/delivery/ck.php?n=MyIPbf5d683\nhttp://aff.ironsocket.com/SH7L\nhttp://aff.ironsocket.com/SH7L\nhttp://ads.wsrs.net/www/delivery/ck.php?n=MyIPdb5f512\nhttp://wsrs.net/\nhttp://cmsgear.com/\n"
data = "\nWebsites Found - 0\n-------------------------------\n"

getweblinks.getLinks(soup)
self.assertEqual(sys.stdout.getvalue(),data)
Expand Down
3 changes: 2 additions & 1 deletion torBot.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ def header():
def main():
header()
print ("Tor Ip Address :")
a = readPage("https://check.torproject.org/")
#a = readPage("https://check.torproject.org/")
print ("Onion Site Test")
b = readPage("http://torlinkbgs6aabns.onion/")
print (b)
getMails(b)
getLinks(b)
print ("\n\n")
Expand Down