-
Notifications
You must be signed in to change notification settings - Fork 1
/
destroyer-browser.py
398 lines (338 loc) · 13.8 KB
/
destroyer-browser.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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
import sys
import os
from enum import Enum
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import Qt, QUrl,QTimer
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import (
QDesktopWidget, QApplication, QMainWindow, QWidget, QTabBar, QToolBar,
QAction, QLineEdit, QTabWidget, QPushButton, QVBoxLayout, QToolButton, QHBoxLayout
)
from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage, QWebEngineSettings
import qdarkstyle
import atexit
class WebPage(QWebEnginePage):
def certificateError(self, error):
return True
def modify_number(input_number):
if input_number > 1900:
return input_number / 1.2
if input_number > 1870:
return input_number / 1.3
elif input_number > 1770:
return input_number / 1.4
elif input_number > 1670:
return input_number / 1.5
elif input_number > 1570:
return input_number / 1.6
elif input_number > 1470:
return input_number / 1.8
elif input_number > 1370:
return input_number / 2.2
elif input_number > 1270:
return input_number / 2.4
elif input_number > 1170:
return input_number / 2.6
elif input_number > 1070:
return input_number / 2.8
elif input_number > 970:
return input_number / 3.2
elif input_number > 870:
return input_number / 3.4
elif input_number > 770:
return input_number / 3.6
else:
return input_number // 3.8
class Urls(Enum):
DEFAULT_HOME = "https://duckduckgo.com/"
SHODAN = 'https://www.shodan.io/'
DRONEBL = 'https://dronebl.org/lookup?'
DNSDUMPSTER = 'https://dnsdumpster.com/'
DEHASHED = 'https://www.dehashed.com/'
CYBERCRIME = 'https://cybercrime-tracker.net/'
ONYPHE = 'https://www.onyphe.io/'
AHMIA = 'https://ahmia.fi/'
ARCHIVE = 'https://archive.org/search?'
ARIN = 'https://search.arin.net/arin/'
BGPVIEW = 'https://bgpview.io/'
CERTIFICATE = 'https://crt.sh/'
THREAT_CROWD = "http://ci-www.threatcrowd.org/"
VIRUS_TOTAL = "https://www.virustotal.com/"
MIT_OCW = "https://ocw.mit.edu/"
HACKER_ONE = "https://www.hackerone.com/"
CYBRARY = "https://www.cybrary.it/"
OWASP_TOP_10 = "https://owasp.org/Top10/"
HACKER_NEWS = "https://thehackernews.com/"
KREBS_ON_SECURITY = "https://krebsonsecurity.com/"
TECHCRUNCH = "https://techcrunch.com/"
GITHUB = "https://github.com/"
STACK_OVERFLOW = "https://stackoverflow.com/"
REDDIT_INFOSEC = "https://www.reddit.com/r/Infosec/"
PROJECT_GUTENBERG = "https://dev.gutenberg.org/"
METAEXPLOIT_RAPID7 = "https://www.rapid7.com/products/metasploit/"
HACKER_NMAP = "https://hackertarget.com/nmap-online-port-scanner/"
ZDNET_SECURITY = "https://www.zdnet.com/topic/security/"
SECURITY_WEEK = "https://www.securityweek.com/"
HACKER_NEWS_YCOMBINATOR = "https://news.ycombinator.com/"
DARK_READING = "https://www.darkreading.com/"
WHOIS_LOOKUP = "https://who.is/"
URL_VOID = "https://www.urlvoid.com/"
NIST_NVD = "https://nvd.nist.gov/vuln/search"
INTERNET_ARCHIVE = "https://archive.org/"
DNS_DUMPSTER = "https://dnsdumpster.com/"
EXPLOIT_DB = "https://www.exploit-db.com/"
MITRE_ATTACK = "https://attack.mitre.org/"
OSVF = "https://openssf.org/"
TENABLE = "https://www.tenable.com/plugins"
SANS_INSTITUTE = "https://www.sans.org/"
class Navigator:
@staticmethod
def navigate(web_view, url):
try:
web_view.setUrl(QUrl(url))
except (ValueError, TypeError) as e:
print(f"Error navigating to {url}: {e}")
class TabWidget(QWidget):
urlChanged = QtCore.pyqtSignal(QUrl)
def __init__(self, url=None):
super().__init__()
self.webView = QWebEngineView()
self.webView.setPage(WebPage())
self.webView.setUrl(QUrl(url)) if url else self.webView.setUrl(
QUrl(Urls.DEFAULT_HOME.value))
layout = QVBoxLayout(self)
layout.addWidget(self.webView)
self.webView.urlChanged.connect(self.handleUrlChanged)
self.page = self.webView.page()
self.page.linkHovered.connect(self.handleLinkHovered)
def handleUrlChanged(self, url):
self.urlChanged.emit(url)
def handleLinkHovered(self, url):
modifiers = QApplication.keyboardModifiers()
openInNewTab = modifiers == Qt.ControlModifier or modifiers == Qt.ShiftModifier
if openInNewTab:
self.urlChanged.emit(QUrl(url))
class ClosableTabWidget(QTabWidget):
def __init__(self, parent=None):
super(ClosableTabWidget, self).__init__(parent)
self.setTabsClosable(True)
self.tabCloseRequested.connect(self.closeTab)
def createTab(self, url=None, tabName=None, tabIndex=None):
browserTab = TabWidget(url)
index = self.insertTab(tabIndex if tabIndex is not None else self.count(
), browserTab, tabName if tabName else "Destroyer")
closeButton = QPushButton("❌")
closeButton.clicked.connect(
lambda _, index=index: self.closeTab(index))
self.tabBar().setTabButton(index, QTabBar.RightSide, closeButton)
browserTab.urlChanged.connect(self.updateUrl)
browserTab.webView.titleChanged.connect(
lambda title, index=index: self.setTabText(index, title))
def closeTab(self, index):
widget = self.widget(index)
if widget:
widget.deleteLater()
self.removeTab(index)
def updateUrl(self, url):
index = self.indexOf(self.sender().parent())
self.setTabText(index, url.host())
class AppMainWindow(QMainWindow):
def __init__(self):
super(AppMainWindow, self).__init__()
settings = QWebEngineSettings.globalSettings()
settings.setAttribute(QWebEngineSettings.LocalStorageEnabled, False)
settings.setAttribute(QWebEngineSettings.PluginsEnabled, False)
self.statusBar = self.statusBar()
self.tabs = ClosableTabWidget()
self.setCentralWidget(self.tabs)
self.tabBar = QTabBar()
self.tabBar.setTabsClosable(True)
self.createTab()
layout = QHBoxLayout()
navbar1 = QToolBar()
self.setupUi(navbar1)
layout.addWidget(navbar1)
navbarq = QToolBar()
self.quit(navbarq)
layout.addWidget(navbarq)
navbar2 = QToolBar()
self.setupBookmarksNavbar(navbar2)
layout.addWidget(navbar2)
container = QWidget()
container.setLayout(layout)
self.addToolBar(navbar1)
self.addToolBar(navbarq)
self.addToolBar(navbar2)
self.addToolBar(Qt.LeftToolBarArea, navbar2)
self.urlBar = QLineEdit()
self.urlBar.returnPressed.connect(self.navigateToUrl)
navbar1.addWidget(self.urlBar)
self.setWindowTitle("Destroyer Browser")
self.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
self.show()
self.timer = QTimer(self)
self.timer.timeout.connect(self.update_window_size)
self.timer.start(100) # Update every 100 milliseconds
def update_window_size(self):
window_size = self.size()
window_width = window_size.width()
if hasattr(self, 'saved_window_size'):
saved_width = self.saved_window_size
if window_width != saved_width :
self.saved_window_size = (window_width)
window_width_s=int(modify_number(window_width))
self.urlBar.setFixedWidth(window_width_s)
else:
self.saved_window_size = (window_width)
def navigateBack(self):
currentTab = self.tabs.currentWidget()
if currentTab and hasattr(currentTab, 'webView'):
currentTab.webView.back()
def navigateForward(self):
currentTab = self.tabs.currentWidget()
if currentTab and hasattr(currentTab, 'webView'):
currentTab.webView.forward()
def reloadPage(self):
currentTab = self.tabs.currentWidget()
if currentTab and hasattr(currentTab, 'webView'):
currentTab.webView.reload()
def createTab(self, url=None, tabName=None, tabIndex=None):
browserTab = TabWidget(url)
index = self.tabs.insertTab(tabIndex if tabIndex is not None else self.tabs.count(
), browserTab, tabName if tabName else "Destroyer")
closeButton = QPushButton("❌")
closeButton.clicked.connect(
lambda _, index=index: self.closeTab(index))
self.tabBar.setTabButton(index, QTabBar.RightSide, closeButton)
browserTab.urlChanged.connect(self.updateUrl)
browserTab.webView.titleChanged.connect(
lambda title, index=index: self.tabs.setTabText(index, title))
def updateUrl(self, url):
index = self.tabs.currentIndex()
self.urlBar.setText(url.toString())
self.tabs.setTabText(index, url.host())
self.statusBar.showMessage(f'Page loaded: {url.toString()}')
def navigate(self, url):
currentWidget = self.tabs.currentWidget()
if currentWidget and hasattr(currentWidget, 'webView'):
Navigator.navigate(currentWidget.webView, url)
def quit(self, navbar):
quitAction = QAction('Quit', self)
iconPath = "icons/exit.png"
icon = QIcon(iconPath)
quitAction.setIcon(icon)
quitAction.triggered.connect(self.quitApplication)
navbar.addActions([quitAction])
def setupUi(self, navbar):
backAction = QAction('Back', self)
iconPath = "icons/Back.svg"
icon = QIcon(iconPath)
backAction.setIcon(icon)
backAction.triggered.connect(self.navigateBack)
forwardAction = QAction('Forward', self)
iconPath = "icons/Forward.svg"
icon = QIcon(iconPath)
forwardAction.setIcon(icon)
forwardAction.triggered.connect(self.navigateForward)
reloadAction = QAction('Reload', self)
iconPath = "icons/reload.svg"
icon = QIcon(iconPath)
reloadAction.setIcon(icon)
reloadAction.triggered.connect(self.reloadPage)
homeIconPath = "icons/home.svg"
homeIcon = QIcon(homeIconPath)
homeAction = QAction('Home', self)
homeAction.setIcon(homeIcon)
homeAction.triggered.connect(self.navigateHome)
navbar.addActions(
[backAction, forwardAction, reloadAction, homeAction])
newTabButton = QToolButton()
newTabButton.setText(" ➕ ")
iconPath = "icons/new_tab.svg"
icon = QIcon(iconPath)
newTabButton.setIcon(icon)
newTabButton.clicked.connect(self.createTab)
navbar.addWidget(newTabButton)
def navigateHome(self):
homeUrl = Urls.DEFAULT_HOME.value
self.navigate(homeUrl)
def closeTab(self, index):
self.tabs.closeTab(index)
def closeCurrentTab(self):
index = self.tabs.currentIndex()
self.closeTab(index)
def quitApplication(self):
appInstance = QtWidgets.QApplication.instance()
if appInstance and self.isVisible():
self.close()
os.system('cls' if os.name == 'nt' else 'clear')
def navigateToUrl(self):
url = self.urlBar.text()
currentTab = self.tabs.currentWidget()
if currentTab:
currentTab.webView.setUrl(QUrl(url))
def setupBookmarksNavbar(self, navbar):
bookmarks = [
('Shodan', Urls.SHODAN),
('DroneBL', Urls.DRONEBL),
('Dnsdumpster', Urls.DNSDUMPSTER),
('Dehashed', Urls.DEHASHED),
('Cybercrime', Urls.CYBERCRIME),
('Onyphe', Urls.ONYPHE),
('Ahmia', Urls.AHMIA),
('Archive', Urls.ARCHIVE),
('Arin', Urls.ARIN),
('Bgpview', Urls.BGPVIEW),
('Certificate', Urls.CERTIFICATE),
('Threat Crowd', Urls.THREAT_CROWD),
('VirusTotal', Urls.VIRUS_TOTAL),
('MIT OCW', Urls.MIT_OCW),
('HackerOne', Urls.HACKER_ONE),
('Cybrary', Urls.CYBRARY),
('OWASP Top 10', Urls.OWASP_TOP_10),
('Hacker News', Urls.HACKER_NEWS),
('Krebs Sec', Urls.KREBS_ON_SECURITY),
('TechCrunch', Urls.TECHCRUNCH),
('GitHub', Urls.GITHUB),
('Stack Overflow', Urls.STACK_OVERFLOW),
('Reddit Infosec', Urls.REDDIT_INFOSEC),
('Gutenberg', Urls.PROJECT_GUTENBERG),
('MetaX Rapid7', Urls.METAEXPLOIT_RAPID7),
('Hackertarget', Urls.HACKER_NMAP),
('ZDNet Security', Urls.ZDNET_SECURITY),
('SecurityWeek', Urls.SECURITY_WEEK),
('YCombinator', Urls.HACKER_NEWS_YCOMBINATOR),
('Dark Reading', Urls.DARK_READING),
('Whois Lookup', Urls.WHOIS_LOOKUP),
('URLVoid', Urls.URL_VOID),
('NIST NVD', Urls.NIST_NVD),
('Internet Archive', Urls.INTERNET_ARCHIVE),
('DNS Dumpster', Urls.DNS_DUMPSTER),
('Exploit DB', Urls.EXPLOIT_DB),
('Mitre ATT&CK', Urls.MITRE_ATTACK),
('OSVF', Urls.OSVF),
('Tenable', Urls.TENABLE),
('SANS Institute', Urls.SANS_INSTITUTE),
]
for bookmarkText, bookmarkUrl in bookmarks:
bookmarkAction = QAction(bookmarkText, self)
bookmarkAction.triggered.connect(
lambda _, url=bookmarkUrl: self.openBookmarkInNewTab(url.value))
navbar.addAction(bookmarkAction)
def openBookmarkInNewTab(self, url):
currentTab = self.tabs.currentWidget()
if currentTab:
self.createTab(url)
self.urlBar.setText(url)
self.navigate(url)
def main():
try:
app = QApplication(sys.argv + ['--no-sandbox'])
QApplication.setApplicationName("Destroyer Browser")
window = AppMainWindow()
atexit.register(window.quitApplication)
sys.exit(app.exec_())
except Exception as e:
print(e)
if __name__ == "__main__":
main()