From f495cfa139902b06f46993a999a3df27d8bf0dea Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 27 Jun 2012 23:32:16 +0200 Subject: [PATCH] minor update --- extra/shutils/blanks.sh | 2 +- extra/shutils/duplicates.py | 41 +++++++++++++++---------------------- extra/shutils/id.sh | 2 +- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/extra/shutils/blanks.sh b/extra/shutils/blanks.sh index 98c1b93a3..43aaee77a 100755 --- a/extra/shutils/blanks.sh +++ b/extra/shutils/blanks.sh @@ -1,6 +1,6 @@ #!/bin/bash -# # Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) +# Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) # See the file 'doc/COPYING' for copying permission # Removes trailing spaces from blank lines inside project files diff --git a/extra/shutils/duplicates.py b/extra/shutils/duplicates.py index 54e2fa135..e78a43ef1 100644 --- a/extra/shutils/duplicates.py +++ b/extra/shutils/duplicates.py @@ -1,34 +1,27 @@ #!/usr/bin/env python - -""" -Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) -See the file 'doc/COPYING' for copying permission +# Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) +# See the file 'doc/COPYING' for copying permission # Removes duplicate entries in wordlist like files import sys if len(sys.argv) > 0: + items = list() -items = list() -f = open(sys.argv[1], 'r') + 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 -for item in f.readlines(): -item = item.strip() -try: -str.encode(item) -if item in items: -if item: -print item -else: -items.append(item) - -if not item: -items.append('') -except: -pass -f.close() - -f = open(sys.argv[1], 'w+') -f.writelines("\n".join(items)) \ No newline at end of file + with open(sys.argv[1], 'w+') as f: + f.writelines("\n".join(items)) diff --git a/extra/shutils/id.sh b/extra/shutils/id.sh index 5d6b8a45a..dfae9c027 100755 --- a/extra/shutils/id.sh +++ b/extra/shutils/id.sh @@ -1,6 +1,6 @@ #!/bin/bash -# # Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) +# Copyright (c) 2006-2012 sqlmap developers (http://www.sqlmap.org/) # See the file 'doc/COPYING' for copying permission # Adds SVN property 'Id' to project files