sqlmap/extra/shutils/duplicates.py

28 lines
682 B
Python
Raw Normal View History

#!/usr/bin/env python2
2013-01-18 18:07:51 +04:00
# Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
2012-06-28 01:32:16 +04:00
# See the file 'doc/COPYING' for copying permission
# Removes duplicate entries in wordlist like files
import sys
if len(sys.argv) > 0:
2012-06-28 01:32:16 +04:00
items = list()
with open(sys.argv[1], 'r') as f:
for item in f.readlines():
item = item.strip()
try:
str.encode(item)
if item in items:
if item:
print item
else:
items.append(item)
except:
pass
with open(sys.argv[1], 'w+') as f:
f.writelines("\n".join(items))