-
Notifications
You must be signed in to change notification settings - Fork 9
/
duplicate_remover.py
106 lines (96 loc) · 8.57 KB
/
duplicate_remover.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
from helpers import _clear,_setTitle,_printText,colors
from os.path import isfile
from os import remove
from hashlib import md5
class DuplicateRemover:
def __init__(self,configs,webhooks) -> None:
_setTitle('[OPENBULLET CONFIG TOOL] ^| [DuplicateRemover]')
_clear()
title = colors['lpurple']+"""
╔═══════════════════════════════════════════════════════════════════════╗
██████╗ ██╗ ██╗██████╗ ██╗ ██╗ ██████╗ █████╗ ████████╗███████╗
██╔══██╗██║ ██║██╔══██╗██║ ██║██╔════╝██╔══██╗╚══██╔══╝██╔════╝
██║ ██║██║ ██║██████╔╝██║ ██║██║ ███████║ ██║ █████╗
██║ ██║██║ ██║██╔═══╝ ██║ ██║██║ ██╔══██║ ██║ ██╔══╝
██████╔╝╚██████╔╝██║ ███████╗██║╚██████╗██║ ██║ ██║ ███████╗
╚═════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝
╚═══════════════════════════════════════════════════════════════════════╝
"""
print(title)
self.configs = configs
self.webhooks = webhooks
def _menu(self):
_setTitle('[OPENBULLET CONFIG TOOL] ^| [DuplicateRemover] ^| [Menu]')
_clear()
title = colors['lpurple']+"""
╔═══════════════════════════════════════════════════════════════════════╗
███╗ ███╗███████╗███╗ ██╗██╗ ██╗
████╗ ████║██╔════╝████╗ ██║██║ ██║
██╔████╔██║█████╗ ██╔██╗ ██║██║ ██║
██║╚██╔╝██║██╔══╝ ██║╚██╗██║██║ ██║
██║ ╚═╝ ██║███████╗██║ ╚████║╚██████╔╝
╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝ ╚═════╝
╚═══════════════════════════════════════════════════════════════════════╝
"""
print(title)
options = ['Remove Duplicated Webhooks','Remove Duplicated Configs']
counter = 0
for option in options:
counter+=1
_printText(colors['bcyan'],colors['lpurple'],str(counter),option)
print('')
selected = int(input(f'{colors["lpurple"]}[>] {colors["bcyan"]}Select something:{colors["lpurple"]} '))
if selected == 1:
self._duplicateWebhookRemove()
elif selected == 2:
self._duplicateConfigRemove()
else:
self._menu()
def _duplicateWebhookRemove(self):
_setTitle('[OPENBULLET CONFIG TOOL] ^| [DuplicateRemover] ^| [WebhookRemove]')
_clear()
title = colors['lpurple']+"""
╔═══════════════════════════════════════════════════════════════════════╗
██╗ ██╗███████╗██████╗ ██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗
██║ ██║██╔════╝██╔══██╗██║ ██║██╔═══██╗██╔═══██╗██║ ██╔╝
██║ █╗ ██║█████╗ ██████╔╝███████║██║ ██║██║ ██║█████╔╝
██║███╗██║██╔══╝ ██╔══██╗██╔══██║██║ ██║██║ ██║██╔═██╗
╚███╔███╔╝███████╗██████╔╝██║ ██║╚██████╔╝╚██████╔╝██║ ██╗
╚══╝╚══╝ ╚══════╝╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝
╚═══════════════════════════════════════════════════════════════════════╝
"""
print(title)
_printText(colors['bcyan'],colors['lpurple'],'BEFORE',str(len(self.webhooks)))
cleaned_file = set(self.webhooks)
open('[GetWebhooks]/webhooks.txt', 'w',encoding='utf8',errors='ignore').close()
for line in cleaned_file:
with open(f'[GetWebhooks]/webhooks.txt','a',encoding='utf8') as f:
f.write(f'{line}\n')
_printText(colors['bcyan'],colors['lpurple'],'AFTER',str(len(cleaned_file)))
print('')
_printText(colors['bcyan'],colors['lpurple'],'FINISHED','Process done!')
def _duplicateConfigRemove(self):
_setTitle('[OPENBULLET CONFIG TOOL] ^| [DuplicateRemover] ^| [ConfigRemove]')
_clear()
title = colors['lpurple']+"""
╔═══════════════════════════════════════════════════════════════════════╗
██████╗ ██████╗ ███╗ ██╗███████╗██╗ ██████╗
██╔════╝██╔═══██╗████╗ ██║██╔════╝██║██╔════╝
██║ ██║ ██║██╔██╗ ██║█████╗ ██║██║ ███╗
██║ ██║ ██║██║╚██╗██║██╔══╝ ██║██║ ██║
╚██████╗╚██████╔╝██║ ╚████║██║ ██║╚██████╔╝
╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═════╝
╚═══════════════════════════════════════════════════════════════════════╝
"""
print(title)
unique = []
for config in self.configs:
if isfile(config):
filehash = md5(open(config, 'rb').read()).hexdigest()
if filehash not in unique:
unique.append(filehash)
else:
remove(config)
_printText(colors['bcyan'],colors['lpurple'],'REMOVED',config)
print('')
_printText(colors['bcyan'],colors['lpurple'],'FINISHED','Process done!')