sqlmap/extra/shutils/duplicates.py

31 lines
797 B
Python
Raw Permalink Normal View History

2019-03-28 18:04:38 +03:00
#!/usr/bin/env python
2023-01-03 01:24:59 +03:00
# Copyright (c) 2006-2023 sqlmap developers (https://sqlmap.org/)
2017-10-11 15:50:46 +03:00
# See the file 'LICENSE' for copying permission
# Removes duplicate entries in wordlist like files
2019-01-22 03:20:27 +03:00
from __future__ import print_function
import sys
2019-03-28 17:14:16 +03:00
if __name__ == "__main__":
2019-03-28 18:04:38 +03:00
if len(sys.argv) > 1:
2019-03-28 17:14:16 +03:00
items = list()
2012-06-28 01:32:16 +04:00
2019-03-28 17:14:16 +03:00
with open(sys.argv[1], 'r') as f:
2019-05-08 03:32:49 +03:00
for item in f:
2019-03-28 17:14:16 +03:00
item = item.strip()
try:
str.encode(item)
if item in items:
if item:
print(item)
else:
items.append(item)
except:
pass
2012-06-28 01:32:16 +04:00
2019-03-28 17:14:16 +03:00
with open(sys.argv[1], 'w+') as f:
f.writelines("\n".join(items))