Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sqlmapproject
GitHub Repository: sqlmapproject/sqlmap
Path: blob/master/extra/shutils/duplicates.py
2992 views
1
#!/usr/bin/env python
2
3
# Copyright (c) 2006-2025 sqlmap developers (https://sqlmap.org)
4
# See the file 'LICENSE' for copying permission
5
6
# Removes duplicate entries in wordlist like files
7
8
from __future__ import print_function
9
10
import sys
11
12
if __name__ == "__main__":
13
if len(sys.argv) > 1:
14
items = list()
15
16
with open(sys.argv[1], 'r') as f:
17
for item in f:
18
item = item.strip()
19
try:
20
str.encode(item)
21
if item in items:
22
if item:
23
print(item)
24
else:
25
items.append(item)
26
except:
27
pass
28
29
with open(sys.argv[1], 'w+') as f:
30
f.writelines("\n".join(items))
31
32