-
Notifications
You must be signed in to change notification settings - Fork 0
/
terminal_app.py
182 lines (162 loc) · 6.98 KB
/
terminal_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
from bs4 import BeautifulSoup
import requests
import re
import pyautogui
import webbrowser
import time
import os
import sys
import colorama
from colorama import Fore
from colorama import Style
from colorama import init
init(strip=not sys.stdout.isatty())
from termcolor import cprint
from pyfiglet import figlet_format
newword = ''
newurl = ''
choice = ""
cwd = os.getcwd()
folder = 'screenshots'
try:
os.mkdir(folder)
except OSError as error:
pass
keywords = 'Keywords.txt'
wordlist = [line.strip() for line in open(keywords, encoding='utf-8-sig')]
websites = 'URLs.csv'
with open(websites, encoding='utf-8-sig') as f:
URLs = [line.split()[0] for line in f]
def banner():
os.system("clear")
print("\t<=============================>")
print("\t<===========WELCOME===========>")
print("\t<=============================>")
def display_title_bar():
os.system('clear')
cprint(figlet_format('Content Scanner'))
def end_banner():
print(Fore.RED + '\n <================= Thankyou for using Content Scanner by Th3Blacksmith =================>')
time.sleep(1)
print('')
print('''
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@/
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(
,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(
(@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%
*%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*
@@@@@@@@@@@@@@@@@@
#@@@@@@@@@@@@@@@#
@@@@@@@@@@@@@@@@@
*&@@@@@@@@@@@@@@@@@@@@@#
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
,@@@@@@@@@@@@&/. *#@@@@@@@@@@@@(
,@@@@@@@@@/ .@@@@@@@@@(
''')
print('')
print(''' ####### ##### ######
# # # # # # # # ## #### # # #### # # # ##### # #
# # # # # # # # # # # # # # ## ## # # # #
# ###### ##### ###### # # # # #### #### # ## # # # ######
# # # # # # # ###### # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # ##### ###### ###### # # #### # # #### # # # # # #
''' + Style.RESET_ALL)
def process_start():
print(Fore.BLUE + '<====================================================>')
print('<================= Process Starting =================>')
print('<====================================================>' + Style.RESET_ALL)
print('')
print('')
def process_end():
print('')
print('')
print(Fore.BLUE + '<=====================================================>')
print('<================= Process Completed =================>')
print('<=====================================================>' + Style.RESET_ALL)
def user_choice():
return input("\nWhat would you like to do?: ")
def options():
print("\n[1] Run program using 'URLs.csv' and 'wordlist.txt' files.")
print("[2] Add a url to scan list.")
print("[3] Add a word to wordlist.")
print("[4] View current url list")
print("[5] View current word list")
print("[q] Press 'q' to exit")
def scan_action():
for i in wordlist:
for url in URLs:
page = requests.get(url)
html = page.content
soup = BeautifulSoup(html, 'html.parser')
word = soup.body.find_all(string=re.compile(i))
if len(word) > 0:
print('Found matching result of',i,'on '+url)
print('')
webbrowser.open(url, 2)
time.sleep(5)
open(cwd + '/screenshots/%s.png' %(i), 'w+')
Screenshot = pyautogui.screenshot()
Screenshot.save(cwd + '/screenshots/%s.png' %(i))
print('Taking screenshot and saving to screenshot folder...')
print('')
display_title_bar()
options()
while choice != 'q':
choice = user_choice()
if choice == '1':
display_title_bar()
process_start()
scan_action()
process_end()
elif choice == '2':
display_title_bar()
newurl = input('\nType your new url here then press enter: ')
with open('URLs.csv', 'a+') as file_object:
file_object.seek(0)
file_object.write("\n")
file_object.write(newurl)
print(Fore.GREEN + '\nupdating urls...\n' + Style.RESET_ALL)
time.sleep(1)
file_object.flush()
with open(websites, encoding='utf-8-sig') as f:
URLs = [line.split()[0] for line in f]
print('The current URLs are: \n')
print(Fore.YELLOW + str(URLs) + Style.RESET_ALL)
time.sleep(1)
elif choice == '3':
display_title_bar()
newwword = input('\nType your new word here then press enter: ')
with open('Keywords.txt', 'a+') as file_object:
file_object.seek(0)
file_object.write("\n")
file_object.write(newwword)
print(Fore.GREEN + '\nupdating wordlist...\n' + Style.RESET_ALL)
time.sleep(1)
file_object.flush()
wordlist = [line.strip() for line in open(keywords, encoding='utf-8-sig')]
print('The current wordlist is: \n')
print(Fore.YELLOW + str(wordlist) + Style.RESET_ALL)
time.sleep(1)
elif choice == '4':
display_title_bar()
print('The current URLs are: \n')
print(Fore.YELLOW + str(URLs) + Style.RESET_ALL)
time.sleep(1)
elif choice == '5':
display_title_bar()
wordlist = [line.strip() for line in open(keywords, encoding='utf-8-sig')]
print('The current wordlist is: \n')
print(Fore.YELLOW + str(wordlist) + Style.RESET_ALL)
time.sleep(1)
elif choice == 'q':
display_title_bar()
end_banner()
elif choice == 'options':
display_title_bar()
options()
else:
print(Fore.RED + "\nUnknown choice, type 'options' to see a list of commands" + Style.RESET_ALL)
time.sleep(1)