-
Notifications
You must be signed in to change notification settings - Fork 4
/
elyzer.py
276 lines (224 loc) · 11.3 KB
/
elyzer.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
# -*- coding: utf-8 -*-
import os
import re
import json
import requests
from core.utils import Utils
from core.spoofing import Spoofing
from argparse import ArgumentParser
from core.colors import Colors, banner
from core.exp_json import ExportJson, export_to_json
def checkForUpdates():
try:
response = requests.get('https://api.github.com/repos/B0lg0r0v/Elyzer/releases/latest')
except requests.exceptions.ConnectionError:
#print(f'{Fore.RED}No internet connection.{Fore.RESET}')
print(Colors.red("No internet connection."))
exit()
latestRelease = json.loads(response.text)
if 'tag_name' in latestRelease:
latestVersion = latestRelease['tag_name'].lower()
match = re.search(r'v\d+\.\d\.\d+', latestVersion) #Extract only the version number
if match:
latestVersion = match.group(0)
if CURRENT_VERSION != latestVersion:
if latestVersion > CURRENT_VERSION:
print(f'A new version ({latestVersion}) is available. Please download it from the release section on GitHub.\n')
elif latestVersion == CURRENT_VERSION:
pass
elif latestVersion < CURRENT_VERSION:
pass
if __name__ == '__main__':
indent = ' ' * 3
CURRENT_VERSION = 'v0.5.0'
savings = []
checkForUpdates()
parser = ArgumentParser() # Create the Parser.
parser.add_argument('-f', '--file', help='Give the E-Mail Header as a file.', required=True)
parser.add_argument('-pa', '--passive', help='Enables the passive mode. DNS resolution is performed passively through Driftnet for better OPSEC. You need to add "DRIFTNET_API" as an environment variable in order to use this feature.', action='store_true')
parser.add_argument('-nd', '--no-dns', help='Enables the no-dns mode. No DNS resolution is performed for best OPSEC. This heavily affects the results !', action='store_true')
parser.add_argument('-q', '--quiet', help='Quiet mode. Disables banner.', action='store_true')
parser.add_argument('-j', '--json', help='EXPERIMENTAL FEATURE. Output the results in JSON format.', action='store_true')
parser.add_argument('-v', '--version', action='version', version=f'Elyzer {CURRENT_VERSION}')
parser.add_argument('-a', '--attachement', help='Check if the file is malicious.')
args = parser.parse_args() # Initialize the Parser.
if args.file is not None:
utils = Utils(args.file) # Initialize the Utils class.
spoofing = Spoofing(args.file) # Initialize the Spoofing class.
expjson = ExportJson(args.file)
current_dir = os.path.dirname(os.path.abspath(__file__))
if args.quiet:
print(Colors.yellow("E-Mail Header Analysis complete"))
if args.passive:
if args.json:
if args.attachement:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_passive_dns()
utils.check_attachment(args.attachement)
json_output = expjson.jsonoutput()
json_file = export_to_json(json_output, os.path.join(current_dir, "elyzer_report.json"))
print(f'\nElyzer.json has been saved to {json_file}')
else:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_passive_dns()
json_output = expjson.jsonoutput()
json_file = export_to_json(json_output, os.path.join(current_dir, "elyzer_report.json"))
print(f'\nElyzer.json has been saved to {json_file}')
else:
if args.attachement:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_passive_dns()
utils.check_attachment(args.attachement)
else:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_passive_dns()
elif args.no_dns:
if args.json:
if args.attachement:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_no_dns()
utils.check_attachment(args.attachement)
json_output = expjson.jsonoutput()
json_file = export_to_json(json_output, os.path.join(current_dir, "elyzer_report.json"))
print(f'\nElyzer.json has been saved to {json_file}')
else:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_no_dns()
json_output = expjson.jsonoutput()
json_file = export_to_json(json_output, os.path.join(current_dir, "elyzer_report.json"))
print(f'\nElyzer.json has been saved to {json_file}')
else:
if args.attachement:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_no_dns()
utils.check_attachment(args.attachement)
else:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_no_dns()
else:
if args.json:
if args.attachement:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_all_checks()
utils.check_attachment(args.attachement)
json_output = expjson.jsonoutput()
json_file = export_to_json(json_output, os.path.join(current_dir, "elyzer_report.json"))
print(f'\nElyzer.json has been saved to {json_file}')
else:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_all_checks()
json_output = expjson.jsonoutput()
json_file = export_to_json(json_output, os.path.join(current_dir, "elyzer_report.json"))
print(f'\nElyzer.json has been saved to {json_file}')
else:
if args.attachement:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_all_checks()
utils.check_attachment(args.attachement)
else:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_all_checks()
else:
banner()
print(Colors.yellow("E-Mail Header Analysis complete"))
if args.passive:
if args.attachement:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_passive_dns()
utils.check_attachment(args.attachement)
else:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_passive_dns()
elif args.no_dns:
if args.attachement:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_no_dns()
utils.check_attachment(args.attachement)
else:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_no_dns()
else:
if args.json:
if args.attachement:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_all_checks()
utils.check_attachment(args.attachement)
json_output = expjson.jsonoutput()
json_file = export_to_json(json_output)
print(f'\nElyzer.json has been saved to {json_file}')
else:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_all_checks()
json_output = expjson.jsonoutput()
json_file = export_to_json(json_output, os.path.join(current_dir, "elyzer_report.json"))
print(f'\nElyzer.json has been saved to {json_file}')
else:
if args.attachement:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_all_checks()
utils.check_attachment(args.attachement)
else:
utils.generalInformation()
utils.routing()
utils.securityInformations()
utils.envelope()
spoofing.spoofing_all_checks()
else:
parser.error('E-Mail Header is required.')