forked from rzc0d3r/ESET-KeyGen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
352 lines (334 loc) · 17.1 KB
/
main.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
from modules.WebDriverInstaller import *
# Bypassing ESET antivirus detection
from modules.EsetTools import EsetRegister as ER
from modules.EsetTools import EsetKeygen as EK
from modules.EsetTools import EsetBusinessRegister as EBR
from modules.EsetTools import EsetBusinessKeygen as EBK
from modules.SharedTools import *
from modules.EmailAPIs import *
from modules.Updater import get_assets_from_version, parse_update_json, updater_main
from modules.MBCI import *
import traceback
import colorama
import platform
import datetime
import argparse
import time
import sys
import os
import re
VERSION = ['v1.4.9.3', 1493]
LOGO = f"""
███████╗███████╗███████╗████████╗ ██╗ ██╗███████╗██╗ ██╗ ██████╗ ███████╗███╗ ██╗
██╔════╝██╔════╝██╔════╝╚══██╔══╝ ██║ ██╔╝██╔════╝╚██╗ ██╔╝██╔════╝ ██╔════╝████╗ ██║
█████╗ ███████╗█████╗ ██║ █████╔╝ █████╗ ╚████╔╝ ██║ ███╗█████╗ ██╔██╗ ██║
██╔══╝ ╚════██║██╔══╝ ██║ ██╔═██╗ ██╔══╝ ╚██╔╝ ██║ ██║██╔══╝ ██║╚██╗██║
███████╗███████║███████╗ ██║ ██║ ██╗███████╗ ██║ ╚██████╔╝███████╗██║ ╚████║
╚══════╝╚══════╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝
Project Version: {VERSION[0]}
Project Devs: rzc0d3r, AdityaGarg8, k0re,
Fasjeit, alejanpa17, Ischunddu,
soladify, AngryBonk, Xoncia
"""
if '--no-logo' in sys.argv:
LOGO = f"ESET KeyGen {VERSION[0]} by rzc0d3r\n"
# -- Quick settings [for Developers to quickly change behavior without changing all files] --
DEFAULT_EMAIL_API = '1secmail'
AVAILABLE_EMAIL_APIS = ['1secmail', 'hi2in', '10minutemail', 'tempmail', 'guerrillamail', 'developermail']
WEB_WRAPPER_EMAIL_APIS = ['10minutemail', 'hi2in', 'tempmail', 'guerrillamail']
EMAIL_API_CLASSES = {
'guerrillamail': GuerRillaMailAPI,
'10minutemail': TenMinuteMailAPI,
'hi2in': Hi2inAPI,
'tempmail': TempMailAPI,
'1secmail': OneSecEmailAPI,
'developermail': DeveloperMailAPI,
}
args = {
'chrome': True,
'firefox': False,
'edge': False,
'key': True,
'account': False,
'business_key': False,
'business_account': False,
'only_webdriver_update': False,
'update': False,
'skip_webdriver_menu': False,
'no_headless': False,
'custom_browser_location': '',
'email_api': DEFAULT_EMAIL_API,
'custom_email_api': False,
'skip_update_check': False,
'no_logo': False
}
def RunMenu():
MainMenu = ViewMenu(LOGO+'\n---- Main Menu ----')
SettingMenu = ViewMenu(LOGO+'\n---- Settings Menu ----')
SettingMenu.add_item(
OptionAction(
args,
title='Browsers',
action='store_true',
args_names=['chrome', 'firefox', 'edge'],
default_value='chrome'
)
)
SettingMenu.add_item(
OptionAction(
args,
title='Modes of operation',
action='store_true',
args_names=['key', 'account', 'business-account', 'business-key', 'only-webdriver-update', 'update'],
default_value='key')
)
SettingMenu.add_item(
OptionAction(
args,
title='Email APIs',
action='choice',
args_names='email-api',
choices=AVAILABLE_EMAIL_APIS,
default_value=DEFAULT_EMAIL_API
)
)
SettingMenu.add_item(
OptionAction(
args,
title='--skip-webdriver-menu',
action='bool_switch',
args_names='skip-webdriver-menu'
)
)
SettingMenu.add_item(
OptionAction(
args,
title='--no-headless',
action='bool_switch',
args_names='no-headless'
)
)
SettingMenu.add_item(
OptionAction(
args,
title='--custom-browser-location',
action='manual_input',
args_names='custom-browser-location',
default_value=''
)
)
SettingMenu.add_item(
OptionAction(
args,
title='--custom-email-api',
action='bool_switch',
args_names='custom-email-api'
)
)
SettingMenu.add_item(
OptionAction(
args,
title='--skip-update-check',
action='bool_switch',
args_names='skip_update_check'
)
)
SettingMenu.add_item(MenuAction('Back', MainMenu))
MainMenu.add_item(MenuAction('Settings', SettingMenu))
MainMenu.add_item(MenuAction(f'{colorama.Fore.LIGHTWHITE_EX}Do it, damn it!{colorama.Fore.RESET}', main))
MainMenu.add_item(MenuAction('Exit', sys.exit))
MainMenu.view()
def parse_argv():
print(LOGO)
if len(sys.argv) == 1: # Menu
RunMenu()
else: # CLI
args_parser = argparse.ArgumentParser()
# Required
## Browsers
args_browsers = args_parser.add_mutually_exclusive_group(required=('--update' not in sys.argv))
args_browsers.add_argument('--chrome', action='store_true', help='Launching the project via Google Chrome browser')
args_browsers.add_argument('--firefox', action='store_true', help='Launching the project via Mozilla Firefox browser')
args_browsers.add_argument('--edge', action='store_true', help='Launching the project via Microsoft Edge browser')
## Modes of operation
args_modes = args_parser.add_mutually_exclusive_group(required=True)
args_modes.add_argument('--key', action='store_true', help='Generating an ESET-HOME license key (example as AGNV-XA2V-EA89-U546-UVJP)')
args_modes.add_argument('--account', action='store_true', help='Generating an ESET HOME Account (To activate the free trial version)')
args_modes.add_argument('--business-account', action='store_true', help='Generating an ESET BUSINESS Account (To huge businesses) - Requires manual captcha input!!!')
args_modes.add_argument('--business-key', action='store_true', help='Generating an ESET BUSINESS Account and creating a universal license key for ESET products (1 key - 75 devices) - Requires manual captcha input!!!')
args_modes.add_argument('--only-webdriver-update', action='store_true', help='Updates/installs webdrivers and browsers without generating account and license key')
args_modes.add_argument('--update', action='store_true', help='Switching to program update mode - Overrides all arguments that are available!!!')
# Optional
args_parser.add_argument('--skip-webdriver-menu', action='store_true', help='Skips installation/upgrade webdrivers through the my custom wrapper (The built-in selenium-manager will be used)')
args_parser.add_argument('--no-headless', action='store_true', help='Shows the browser at runtime (The browser is hidden by default, but on Windows 7 this option is enabled by itself)')
args_parser.add_argument('--custom-browser-location', type=str, default='', help='Set path to the custom browser (to the binary file, useful when using non-standard releases, for example, Firefox Developer Edition)')
args_parser.add_argument('--email-api', choices=AVAILABLE_EMAIL_APIS, default=DEFAULT_EMAIL_API, help='Specify which api to use for mail')
args_parser.add_argument('--custom-email-api', action='store_true', help='Allows you to manually specify any email, and all work will go through it. But you will also have to manually read inbox and do what is described in the documentation for this argument')
args_parser.add_argument('--skip-update-check', action='store_true', help='Skips checking for program updates')
args_parser.add_argument('--no-logo', action='store_true', help='Replaces ASCII-Art with plain text')
#args_parser.add_argument('--try-auto-cloudflare',action='store_true', help='Removes the prompt for the user to press Enter when solving cloudflare captcha. In some cases it may go through automatically, which will give the opportunity to use tempmail in automatic mode!')
try:
global args
args = vars(args_parser.parse_args())
except:
time.sleep(3)
sys.exit(-1)
def main():
if len(sys.argv) == 1: # for Menu
print()
try:
# check program updates
if args['update']:
print('-- Updater --\n')
updater_main(from_main=True) # from_main - changes the behavior in Updater so that everything works correctly from under main.py
if len(sys.argv) == 1:
input('\nPress Enter to exit...')
else:
time.sleep(3) # exit-delay
sys.exit(0)
if not args['skip_update_check'] and not args['update']:
print('-- Updater --\n')
try:
latest_cloud_version = get_assets_from_version(parse_update_json(from_main=True), 'latest')['version']
latest_cloud_version_int = latest_cloud_version[1:].split('.')
latest_cloud_version_int = int(''.join(latest_cloud_version_int[:-1])+latest_cloud_version_int[-1][0])
if VERSION[1] > latest_cloud_version_int:
console_log(f'The project has an unreleased version, maybe you are using a build from the developer?\n', WARN)
elif latest_cloud_version_int > VERSION[1]:
console_log(f'Project update is available up to version: {colorama.Fore.GREEN}{latest_cloud_version}{colorama.Fore.RESET}', WARN)
console_log('If you want to download the update run this file with --update argument\n', WARN)
else:
console_log('Project up to date!!!\n', OK)
except:
pass
# initialization and configuration of everything necessary for work
webdriver_installer = WebDriverInstaller()
# changing input arguments for special cases
if platform.release() == '7' and sys.platform.startswith('win'): # fix for Windows 7
args['no_headless'] = True
elif args['business_account'] or args['business_key'] or args['email_api'] in ['tempmail']:
args['no_headless'] = True
driver = None
webdriver_path = None
browser_name = 'chrome'
if args['firefox']:
browser_name = 'firefox'
if args['edge']:
browser_name = 'edge'
if not args['skip_webdriver_menu']: # updating or installing webdriver
webdriver_path = webdriver_installer.webdriver_installer_menu(args['edge'], args['firefox'])
if webdriver_path is not None:
os.chmod(webdriver_path, 0o777)
if not args['only_webdriver_update']:
driver = initSeleniumWebDriver(browser_name, webdriver_path, args['custom_browser_location'], (not args['no_headless']))
if driver is None:
raise RuntimeError(f'Initialization {browser_name}-webdriver error!')
else:
sys.exit(0)
# main part of the programd
if not args['custom_email_api']:
console_log(f'\n[{args["email_api"]}] Mail registration...', INFO)
if args['email_api'] in WEB_WRAPPER_EMAIL_APIS: # WebWrapper API, need to pass the selenium object to the class initialization
email_obj = EMAIL_API_CLASSES[args['email_api']](driver)
else: # real APIs without the need for a browser
email_obj = EMAIL_API_CLASSES[args['email_api']]()
email_obj.init()
console_log('Mail registration completed successfully!', OK)
else:
email_obj = CustomEmailAPI()
while True:
email = input(f'\n[ {colorama.Fore.YELLOW}INPT{colorama.Fore.RESET} ] {colorama.Fore.CYAN}Enter the email address you have access to: {colorama.Fore.RESET}').strip()
try:
matched_email = re.match(r"[-a-z0-9+]+@[a-z]+\.[a-z]{2,3}", email).group()
if matched_email == email:
email_obj.email = matched_email
console_log('Mail has the correct syntax!', OK)
break
else:
raise RuntimeError
except:
console_log('Invalid email syntax!!!', ERROR)
eset_password = dataGenerator(10)
# standart generator
if args['account'] or args['key']:
ER_obj = ER(email_obj, eset_password, driver)
ER_obj.createAccount()
ER_obj.confirmAccount()
output_line = '\n'.join([
'',
'----------------------------------',
f'Account Email: {email_obj.email}',
f'Account Password: {eset_password}',
'----------------------------------',
''
])
output_filename = 'ESET ACCOUNTS.txt'
if args['key']:
output_filename = 'ESET KEYS.txt'
EK_obj = EK(email_obj, driver)
EK_obj.sendRequestForKey()
license_name, license_key, license_out_date = EK_obj.getLicenseData()
output_line = '\n'.join([
'',
'----------------------------------',
f'Account Email: {email_obj.email}',
f'Account Password: {eset_password}',
'',
f'License Name: {license_name}',
f'License Key: {license_key}',
f'License Out Date: {license_out_date}',
'----------------------------------',
''
])
# new generator
elif args['business_account'] or args['business_key']:
EBR_obj = EBR(email_obj, eset_password, driver)
EBR_obj.createAccount()
EBR_obj.confirmAccount()
output_line = '\n'.join([
'',
'----------------------------------',
f'Business Account Email: {email_obj.email}',
f'Business Account Password: {eset_password}',
'----------------------------------',
''
])
output_filename = 'ESET ACCOUNTS.txt'
if args['business_key']:
output_filename = 'ESET KEYS.txt'
EBK_obj = EBK(email_obj, eset_password, driver)
EBK_obj.sendRequestForKey()
license_name, license_key, license_out_date = EBK_obj.getLicenseData()
output_line = '\n'.join([
'',
'----------------------------------',
f'Business Account Email: {email_obj.email}',
f'Business Account Password: {eset_password}',
'',
f'License Name: {license_name}',
f'License Key: {license_key}',
f'License Out Date: {license_out_date}',
'----------------------------------',
''
])
# end
console_log(output_line)
date = datetime.datetime.now()
f = open(f"{str(date.day)}.{str(date.month)}.{str(date.year)} - "+output_filename, 'a')
f.write(output_line)
f.close()
driver.quit()
except Exception as E:
traceback_string = traceback.format_exc()
if str(type(E)).find('selenium') and traceback_string.find('Stacktrace:') != -1: # disabling stacktrace output
traceback_string = traceback_string.split('Stacktrace:', 1)[0]
console_log(traceback_string, ERROR)
if len(sys.argv) == 1:
input('Press Enter to exit...')
else:
time.sleep(3) # exit-delay
sys.exit()
if __name__ == '__main__':
parse_argv() # if Menu, the main function will be called in automatic mode
if len(sys.argv) > 1: # CLI
main()