-
Notifications
You must be signed in to change notification settings - Fork 4
/
glassFrog.py
119 lines (96 loc) · 3.19 KB
/
glassFrog.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
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
sys.dont_write_bytecode = True
from Core.Styling.Banners import sd
from Core.Styling.Colors import bc
from Core.Config import CoreConfig
from Core.Commands import Command
from Core.Database import DBManager
from Core.Validity import Validation
from Core.Collector import CollectionManager
from Core.Scanner import ContentScanner
from Core.Error import ErrorHandler
class GlassFrog:
def __init__(self):
self.Config = CoreConfig()
self.Cmd = Command()
self.Database = DBManager()
self.Validator = Validation()
self.Collector = CollectionManager()
self.Error = ErrorHandler()
def PrintHelpMenu(self):
print(f"{sd.iBan} Include {bc.GC}http://{bc.BC} or {bc.GC}https://{bc.BC} in URL")
print(f"\t{sd.eBan} {bc.RC}example.com{bc.BC}")
print(f"\t{sd.eBan} {bc.RC}www.example.com{bc.BC}")
print(f"\t{sd.sBan} {bc.GC}https://example.com{bc.BC}")
print(f"\t{sd.sBan} {bc.GC}https://www.example.com\n{bc.BC}")
def SetBaseURL(self):
self.PrintHelpMenu()
self.BaseURL = str(input(f"{bc.BC} Base URL: {bc.GC}"))
if(self.Validator.NotEmpty(self.BaseURL)):
if(self.BaseURL.endswith("/")):
self.BaseURL = self.BaseURL
else:
self.BaseURL = f"{self.BaseURL}/"
if(self.Validator.HasProtocol(self.BaseURL)):
return self.BaseURL
else:
self.Cmd.Clear()
print(self.Error.Throw("invalid_base_url_protocol"))
Initiate()
else:
self.Cmd.Clear()
print(self.Error.Throw("empty_base_url"))
self.SetBaseURL()
def SetKeyword(self):
self.Keyword: str = str(input(f"{bc.BC} Keyword: {bc.GC}"))
if(self.Validator.NotEmpty(self.Keyword)):
return self.Keyword
else:
self.Cmd.Clear()
print(f"{sd.eBan} Keyword value cannot be empty\n")
self.SetKeyword()
def SetExtend(self):
self.Extend: str = str(input(f"\n{bc.BC} Extend to Branches[{bc.GC}y{bc.BC}/{bc.GC}n{bc.BC}]: {bc.GC}")).lower()
self.Cmd.Clear()
if(self.Validator.NotEmpty(self.Extend)):
if(self.Extend == "y"):
return "y"
else:
return "n"
else:
return "n"
def StartSearch(self, BaseURL: str, Keyword: str):
self.BaseURL: str = BaseURL
self.Keyword: str = Keyword
self.Cmd.Clear()
self.Branches, self.BranchSetKey = self.Collector.GetBranches(self.BaseURL, self.Keyword)
if(self.Branches != None):
return self.Branches, self.BranchSetKey
else:
return None, None
if(__name__ == "__main__"):
def Initiate():
try:
Frog = GlassFrog()
BaseURL = Frog.SetBaseURL()
Keyword = f" {Frog.SetKeyword()} "
Branches, BranchSetKey = Frog.StartSearch(BaseURL, Keyword)
if(Branches != None and BranchSetKey != None):
ContentScanner().SearchData(BaseURL=BaseURL, BranchList=Branches, BranchSetKey=BranchSetKey)
else:
quit()
# Remove any duplicated data from DataAnalysis/UNKNOWN_TYPE_DATA.txt
Command().RemoveDuplicateFileContent(CoreConfig().UnknownDataAnalysisFilePath)
ShouldExtend = Frog.SetExtend()
if(ShouldExtend == "y"):
print(f" [{bc.GC} * * * {bc.BC}] EXTENDER COMING SOON! [{bc.GC} * * * {bc.BC}]\n")
# Frog.StartSearch(Branches)
else:
print(f"{bc.BC} Returned to {CoreConfig().AppName}...\n")
Initiate()
except KeyboardInterrupt:
quit()
Command().Clear()
Initiate()