-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathVaile
More file actions
executable file
·364 lines (337 loc) · 15.9 KB
/
Vaile
File metadata and controls
executable file
·364 lines (337 loc) · 15.9 KB
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
_____, ___
'+ .;
, ;
.
.
.;.
.;
:
,
┌─[Vaile]─[]
└──╼ VainlyStrain
"""
import sys, platform
import os, socket
import requests
from vsconsole import VainShell
from core.methods.cache import createVal
from PyQt5.QtCore import Qt
import core.variables as variables
from subprocess import Popen, PIPE
from core.variables import interface, username
from PyQt5 import QtWidgets, uic, QtCore, QtGui
from core.methods.select import mlist as modulelist
from PyQt5.QtWidgets import QTreeWidgetItem, QTableWidgetItem
shell = VainShell()
class VaileApp(QtWidgets.QDialog):
def __init__(self):
super(VaileApp, self).__init__() # Call the inherited classes __init__ method
uic.loadUi("core/qt5/Main.ui", self) # Load the .ui file
#menu = self.menuBar()
#vaile_menu = bar.addMenu('Vaile')
#info_action = QtWidgets.QAction('Info', self)
#menu.addAction(info_action)
self.sessionType.addItem("normal")
self.sessionType.addItem("parametrised")
self.versionNumber.setText(variables.r_version)
modules = modulelist("all", False)
rootrecon = QTreeWidgetItem(self.treeView)
rootrecon.setText(0, "Phase 1: Reconnaissance")
rootrecon.setFlags(rootrecon.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable)
osint = QTreeWidgetItem(rootrecon)
osint.setFlags(osint.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable)
osint.setText(0, "OSINT/Fingerprinting")
self.genTree(osint, modules[0])
active = QTreeWidgetItem(rootrecon)
active.setFlags(active.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable)
active.setText(0, "Active Reconnaissance")
self.genTree(active, modules[1])
disc = QTreeWidgetItem(rootrecon)
disc.setFlags(disc.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable)
disc.setText(0, "Information Disclosure")
self.genTree(disc, modules[2])
scanroot = QTreeWidgetItem(self.treeView)
scanroot.setText(0, "Phase 2: Scanning & Enumeration")
scanroot.setFlags(scanroot.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable)
self.genTree(scanroot, modules[3])
port = QTreeWidgetItem(scanroot)
port.setText(0, "Port Scanners")
port.setFlags(port.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable)
self.genTree(port, modules[4])
crawl = QTreeWidgetItem(scanroot)
crawl.setText(0, "Web Crawlers")
crawl.setFlags(crawl.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable)
self.genTree(crawl, modules[5])
vlnroot = QTreeWidgetItem(self.treeView)
vlnroot.setText(0, "Phase 3: Vulnerability Analysis")
vlnroot.setFlags(vlnroot.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable)
miscon = QTreeWidgetItem(vlnroot)
miscon.setText(0, "Misconfigurations")
miscon.setFlags(miscon.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable)
self.genTree(miscon, modules[6])
severe = QTreeWidgetItem(vlnroot)
severe.setText(0, "Severe Vulnerabilities")
severe.setFlags(severe.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable)
self.genTree(severe, modules[7])
brute = QTreeWidgetItem(vlnroot)
brute.setText(0, "Password Attacks")
brute.setFlags(brute.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable)
self.genTree(brute, modules[8])
sploit = QTreeWidgetItem(self.treeView)
sploit.setText(0, "Phase 4: Exploitation")
sploit.setFlags(sploit.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable)
self.genTree(sploit, modules[9])
aid = QTreeWidgetItem(self.treeView)
aid.setText(0, "Additional Modules")
aid.setFlags(aid.flags() | Qt.ItemIsTristate | Qt.ItemIsUserCheckable)
self.genTree(aid, modules[10])
self.treeView.header().hide()
self.processNumberLabel.setText(str(variables.processes))
self.show() # Show the GUI
self.addTargetButton.clicked.connect(self.addTargetInput)
self.editTargetButton.clicked.connect(self.editTargetInput)
self.deleteTargetButton.clicked.connect(self.deleteTarget)
self.loadSessionButton.clicked.connect(self.chooseSession)
self.fetchButton.clicked.connect(self.fetchNetInfo)
self.optsButton.clicked.connect(self.displayInfo)
self.attackButton.clicked.connect(self.attack)
self.checkUpdatesButton.clicked.connect(self.checkUpdate)
self.processUpdateButton.clicked.connect(self.setProcessNumber)
def setProcessNumber(self):
new = self.processNumberEdit.text()
shell.do_processes(new)
self.processNumberLabel.setText(str(variables.processes))
def genTree(self, parent, modulist):
for i in range(len(modulist)):
if "-all" not in modulist[i]:
child = QTreeWidgetItem(parent)
child.setFlags(child.flags() | Qt.ItemIsUserCheckable)
child.setText(0, modulist[i])
child.setCheckState(0, Qt.Unchecked)
def addTargetInput(self):
self.addTargetDialog = QtWidgets.QDialog()
uic.loadUi("core/qt5/AddTargetDialog.ui", self.addTargetDialog)
self.addTargetDialog.httpBox.addItem("http")
self.addTargetDialog.httpBox.addItem("https")
self.addTargetDialog.show()
self.addTargetDialog.addTargetToListButton.clicked.connect(self.addTarget)
self.addTargetDialog.cancelButton.clicked.connect(self.addClose)
def addTarget(self):
try:
base = self.addTargetDialog.urlField.text()
assert base != "" and "://" not in base and "@" not in base
user = self.addTargetDialog.userField.text()
passwd = self.addTargetDialog.passwordField.text()
protocol = self.addTargetDialog.httpBox.currentText()
if protocol == "":
protocol = "http"
if user != "" and passwd != "":
if self.addTargetDialog.ipOnly.isChecked():
target = base
else:
target = protocol + "://" + user + ":" + passwd + "@" + base
else:
if self.addTargetDialog.ipOnly.isChecked():
target = base
else:
target = protocol + "://" + base
self.targetsListWidget.addItem(target)
self.targetsListWidget.show()
self.addTargetDialog.close()
except AssertionError:
os.system("konsole -x 'echo AssertionError'")
def addClose(self):
self.addTargetDialog.close()
def deleteTarget(self, item):
for item in self.targetsListWidget.selectedItems():
self.targetsListWidget.takeItem(self.targetsListWidget.row(item))
self.targetsListWidget.show()
def editTargetInput(self):
self.editTargetDialog = QtWidgets.QDialog()
uic.loadUi("core/qt5/EditTargetDialog.ui", self.editTargetDialog)
self.editTargetDialog.httpBox.addItem("http")
self.editTargetDialog.httpBox.addItem("https")
for item in self.targetsListWidget.selectedItems():
target = item.text()
if "://" in target:
protocol = target.split("://")[0]
rest = target.split("://")[1]
if "@" in rest:
user = rest.split(":")[0]
passwd = rest.split(":")[1].split("@")[0]
base = rest.split("@")[1]
else:
user = ""
passwd = ""
base = rest
index = self.editTargetDialog.httpBox.findText(protocol, QtCore.Qt.MatchFixedString)
if index >= 0:
self.editTargetDialog.httpBox.setCurrentIndex(index)
else:
user = ""
passwd = ""
base = target
self.editTargetDialog.ipOnly.setChecked(True)
self.editTargetDialog.userField.setText(user)
self.editTargetDialog.passwordField.setText(passwd)
self.editTargetDialog.urlField.setText(base)
self.editTargetDialog.show()
self.editTargetDialog.saveTargetInListButton.clicked.connect(self.editTarget)
self.editTargetDialog.cancelButton.clicked.connect(self.closeEdit)
def editTarget(self):
try:
base = self.editTargetDialog.urlField.text()
assert base != "" and "://" not in base and "@" not in base
user = self.editTargetDialog.userField.text()
passwd = self.editTargetDialog.passwordField.text()
protocol = self.editTargetDialog.httpBox.currentText()
if protocol == "":
protocol = "http"
if user != "" and passwd != "":
if self.editTargetDialog.ipOnly.isChecked():
target = base
else:
target = protocol + "://" + user + ":" + passwd + "@" + base
else:
if self.editTargetDialog.ipOnly.isChecked():
target = base
else:
target = protocol + "://" + base
for item in self.targetsListWidget.selectedItems():
self.targetsListWidget.takeItem(self.targetsListWidget.row(item))
self.targetsListWidget.addItem(target)
self.targetsListWidget.show()
self.editTargetDialog.close()
except AssertionError:
os.system("konsole -x 'echo AssertionError'")
def closeEdit(self):
self.editTargetDialog.close()
def chooseSession(self):
if ".val" in self.sessionFileEdit.text() or self.sessionType.currentText() != "normal":
self.loadValSession()
else:
self.loadNormalSession()
def loadNormalSession(self):
#targets loaded into vars.targets at attack launch
try:
targets = []
filepath = self.sessionFileEdit.text()
assert os.path.isfile("core/sessioncache/{}".format(filepath)) and filepath != ""
with open("core/sessioncache/{}".format(filepath),"r") as f:
targets = [line.rstrip("\n") for line in f]
self.targetsListWidget.clear()
for vic in targets:
self.targetsListWidget.addItem(vic)
self.targetsListWidget.show()
except AssertionError:
print("AssertionError")
def loadValSession(self):
try:
filepath = self.sessionFileEdit.text()
assert os.path.isfile("core/sessioncache/{}".format(filepath)) and filepath != ""
targets = shell.do_sessions("load --val {}".format(filepath), gui=True)
self.targetsListWidget.clear()
for vic in targets:
self.targetsListWidget.addItem(vic)
self.targetsListWidget.show()
except AssertionError:
print("AssertionError")
def fetchNetInfo(self):
try:
mac = os.popen("cat /sys/class/net/{}/address".format(interface)).read()
self.macDisplay.setText(mac)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('google.com', 0))
localaddr = s.getsockname()[0]
self.privIpDisplay.setText(localaddr)
ipaddr = requests.get('http://ip.42.pl/raw').text
self.publicIpDisplay.setText(ipaddr)
def_gw_device = os.popen("route | grep '^default' | grep -o '[^ ]*$'").read()
self.whoIsDisplay.clear()
self.whoIsDisplay.addItem("Operating System: " + platform.system())
self.whoIsDisplay.addItem("Name: " + platform.node())
self.whoIsDisplay.addItem("Interface: " + def_gw_device)
self.networkTab.show()
except Exception as e:
print("Exception encountered: {}".format(e))
def displayInfo(self):
self.infoOptDialog = QtWidgets.QDialog()
uic.loadUi("core/qt5/InfoOpts.ui", self.infoOptDialog)
try:
for item in self.treeView.selectedIndexes():
shell.do_load(item.data())
info = shell.do_info("", gui=True)
self.infoOptDialog.titleLabel.setText(item.data())
self.infoOptDialog.infoPanel.setText(info[0])
for key, value in info[1].items():
rowPosition = self.infoOptDialog.optionTable.rowCount()
self.infoOptDialog.optionTable.insertRow(rowPosition)
self.infoOptDialog.optionTable.setItem(rowPosition , 0, QTableWidgetItem(key))
self.infoOptDialog.optionTable.setItem(rowPosition , 1, QTableWidgetItem(value[0]))
self.infoOptDialog.optionTable.setItem(rowPosition , 2, QTableWidgetItem(value[1]))
except:
pass
self.infoOptDialog.show()
self.infoOptDialog.cancelButton.clicked.connect(self.closeOpts)
self.infoOptDialog.saveButton.clicked.connect(self.saveOpts)
def saveOpts(self):
try:
for item in self.treeView.selectedIndexes():
shell.do_load(item.data())
for i in range(0, self.infoOptDialog.optionTable.rowCount()):
prop = self.infoOptDialog.optionTable.item(i, 0).text()
val = self.infoOptDialog.optionTable.item(i, 2).text()
shell.do_set("{} {}".format(prop, val))
except:
pass
self.infoOptDialog.close()
def closeOpts(self):
self.infoOptDialog.close()
def iterItems(self, root):
def recurse(parent):
for i in range(parent.childCount()):
child = parent.child(i)
yield child
if child.childCount() > 0:
yield from recurse(child)
if root is not None:
yield from recurse(root)
def attack(self):
tor = self.torBox.isChecked()
blacklist = ["OSINT/Fingerprinting", "Active Reconnaissance", "Information Disclosure",
"Port Scanners", "Web Crawlers",
"Misconfigurations", "Severe Vulnerabilities", "Password Attacks"]
viclist = [str(self.targetsListWidget.item(i).text()) for i in range(self.targetsListWidget.count())]
modlist = []
root = self.treeView.invisibleRootItem()
for item in self.iterItems(root):
if item.checkState(0) == QtCore.Qt.Checked:
if "Phase " not in item.text(0) and "Additional" not in item.text(0):
if item.text(0) not in blacklist:
modlist.append(item.text(0))
print(modlist)
if not os.path.isfile("core/sessioncache/syn.val"):
path = os.path.dirname(os.path.realpath(__file__))
if "/home/" not in path:
os.system("pkexec /opt/Vaile/core/methods/create.py OPT {}".format(username))
else:
os.system("pkexec /home/{0}/Vaile/core/methods/create.py HOME {0}".format(username))
createVal(viclist, modlist, "syn.val")
if tor:
os.system("konsole --hold -e 'sudo ./vsconsole.py -p -c syn.val'")
else:
os.system("konsole --hold -e 'sudo ./vsconsole.py -c syn.val'")
def checkUpdate(self):
result = shell.do_fetch("", gui=True)
if result[0]:
self.fetchOutput.setText("Vaile latest version is installed: {}".format(result[1]))
else:
self.fetchOutput.setText("An update is available!\n\nCurrent version: {}\nAvailable version: {}".format(variables.r_version, result[1]))
self.show()
app = QtWidgets.QApplication(sys.argv) # Create an instance of QtWidgets.QApplication
window = VaileApp() # Create an instance of our class
app.setWindowIcon(QtGui.QIcon("core/qt5/icons/vaile.png"))
app.exec_() # Start the application