Skip to content

Commit e3c75e3

Browse files
author
root
committed
checking live websites using getcode()
1 parent 0920399 commit e3c75e3

4 files changed

Lines changed: 29 additions & 17 deletions

File tree

modules/bcolors.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class bcolors:
2+
HEADER = '\033[95m'
3+
OKBLUE = '\033[94m'
4+
OKGREEN = '\033[92m'
5+
WARNING = '\033[93m'
6+
FAIL = '\033[91m'
7+
ENDC = '\033[0m'
8+
BOLD = '\033[1m'
9+
UNDERLINE = '\033[4m'
10+
WHITE = '\033[97m'
11+
On_Black = '\033[40m'
12+
On_Red = '\033[41m'
13+

modules/getemails.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from modules.bcolors import bcolors
12
import bs4
23

34
"""Get all emails from the website"""
@@ -17,10 +18,10 @@ def getMails(soup):
1718
pass
1819
"""Pretty print output as below"""
1920
print ('')
20-
print ('Mails Found - '+str(len(emails)))
21+
print (bcolors.OKGREEN+'Mails Found - '+bcolors.ENDC+str(len(emails)))
2122
print ('-------------------------------')
2223
for mail in emails:
2324
print (mail)
2425
return ''
2526
else:
26-
raise('Method parameter is not of instance bs4.BeautifulSoup')
27+
raise(bcolors.FAIL+'Method parameter is not of instance bs4.BeautifulSoup'+bcolors.ENDC)

modules/getweblinks.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import urllib.request
2+
import modules.bcolors
13
import bs4
24

35
"""Get all onion links from the website"""
@@ -20,7 +22,10 @@ def getLinks(soup):
2022
print ('Websites Found - '+str(len(websites)))
2123
print ('-------------------------------')
2224
for web in websites:
23-
print (web)
25+
if (urllib.request.urlopen(web).getcode() == 200):
26+
print (web)
27+
else :
28+
print(bcolors.On_Red+web +bcolors.ENDC)
2429
return websites
2530
else:
2631
raise('Method parameter is not of instance bs4.BeautifulSoup')

torBot.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from modules.getemails import getMails
22
from modules.getweblinks import getLinks
33
from modules.pagereader import readPage
4+
from modules.bcolors import bcolors
45
import socket
56
import socks
67
import argparse
@@ -23,20 +24,6 @@ def getaddrinfo(*args):
2324

2425
socket.getaddrinfo = getaddrinfo
2526

26-
class bcolors:
27-
HEADER = '\033[95m'
28-
OKBLUE = '\033[94m'
29-
OKGREEN = '\033[92m'
30-
WARNING = '\033[93m'
31-
FAIL = '\033[91m'
32-
ENDC = '\033[0m'
33-
BOLD = '\033[1m'
34-
UNDERLINE = '\033[4m'
35-
WHITE = '\033[97m'
36-
On_Black = '\033[40m'
37-
On_Red = '\033[41m'
38-
39-
4027
def header():
4128
""" Display the header of TorBot """
4229
print("#######################################################")
@@ -97,4 +84,10 @@ def main():
9784
return 0
9885

9986
if __name__ == '__main__':
87+
88+
try:
10089
main()
90+
except KeyboardInterrupt:
91+
print("Interrupt received! Exiting cleanly...")
92+
93+

0 commit comments

Comments
 (0)