This repository has been archived by the owner on Jan 10, 2024. It is now read-only.
/
messages.py
148 lines (121 loc) · 5.16 KB
/
messages.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
"""
Common terminal messages used across the framework.
"""
import os, sys, types
import settings
import helpers
version = "2.19.1"
# try to find and import the settings.py config file
if os.path.exists("/etc/veil/settings.py"):
try:
sys.path.append("/etc/veil/")
import settings
# check for a few updated values to see if we have a new or old settings.py file
try:
settings.VEIL_EVASION_PATH
except AttributeError:
os.system('clear')
print '========================================================================='
print ' New major Veil-Evasion version installed'
print ' Re-running ./setup/setup.sh'
print '========================================================================='
time.sleep(3)
os.system('cd setup && ./setup.sh')
# reload the settings import to refresh the values
reload(settings)
except ImportError:
print "\n [!] ERROR: run ./config/update.py manually\n"
sys.exit()
elif os.path.exists("./config/settings.py"):
try:
sys.path.append("./config")
import settings
except ImportError:
print "\n [!] ERROR: run ./config/update.py manually\n"
sys.exit()
else:
# if the file isn't found, try to run the update script
os.system('clear')
print '========================================================================='
print ' Veil First Run Detected... Initializing Script Setup...'
print '========================================================================='
# run the config if it hasn't been run
print '\n [*] Executing ./setup/setup.sh'
os.system('cd setup && ./setup.sh')
# check for the config again and error out if it can't be found.
if os.path.exists("/etc/veil/settings.py"):
try:
sys.path.append("/etc/veil/")
import settings
except ImportError:
print "\n [!] ERROR: run ./config/update.py manually\n"
sys.exit()
elif os.path.exists("./config/settings.py"):
try:
sys.path.append("./config")
import settings
except ImportError:
print "\n [!] ERROR: run ./config/update.py manually\n"
sys.exit()
else:
print "\n [!] ERROR: run ./config/update.py manually\n"
sys.exit()
def title():
"""
Print the framework title, with version.
"""
os.system(settings.TERMINAL_CLEAR)
print '========================================================================='
print ' Veil-Evasion | [Version]: ' + version
print '========================================================================='
print ' [Web]: https://www.veil-framework.com/ | [Twitter]: @VeilFramework'
print '========================================================================='
print ""
# if settings.OPERATING_SYSTEM != "Kali":
# print helpers.color(' [!] WARNING: Official support for Kali Linux (x86) only at this time!', warning=True)
# print helpers.color(' [!] WARNING: Continue at your own risk!\n', warning=True)
# check to make sure the current OS is supported,
# print a warning message if it's not and exit
if settings.OPERATING_SYSTEM == "Windows" or settings.OPERATING_SYSTEM == "Unsupported":
print helpers.color(' [!] ERROR: Your operating system is not currently supported...\n', warning=True)
print helpers.color(' [!] ERROR: Request your distribution at the GitHub repository...\n', warning=True)
sys.exit()
def helpmsg(commands, showTitle=True):
"""
Print a help menu.
"""
if showTitle:
title()
print " Available commands:\n"
# list commands in sorted order
#for cmd in sorted(commands.iterkeys(), reverse=True):
for (cmd, desc) in commands:
print "\t%s\t%s" % ('{0: <12}'.format(cmd), desc)
print ""
def helpModule(module):
"""
Print the first text chunk for each established method in a module.
module: module to write output from, format "folder.folder.module"
"""
# split module.x.y into "from module.x import y"
t = module.split(".")
importName = "from " + ".".join(t[:-1]) + " import " + t[-1]
# dynamically do the import
exec(importName)
moduleName = t[-1]
# extract all local functions from the imported module,
# referenced here by locals()[moduleName]
functions = [locals()[moduleName].__dict__.get(a) for a in dir(locals()[moduleName]) if isinstance(locals()[moduleName].__dict__.get(a), types.FunctionType)]
# pull all the doc strings out from said functions and print the top chunk
for function in functions:
base = function.func_doc
base = base.replace("\t", " ")
doc = "".join(base.split("\n\n")[0].strip().split("\n"))
# print function.func_name + " : " + doc
print helpers.formatLong(function.func_name, doc)
def endmsg():
"""
Print the exit message.
"""
print " [*] Your payload files have been generated, don't get caught!"
print helpers.color(" [!] And don't submit samples to any online scanner! ;)\n", warning=True)