File: duplicates.py

package info (click to toggle)
sqlmap 1.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,492 kB
  • sloc: python: 52,942; xml: 13,974; ansic: 989; sh: 302; makefile: 62; sql: 61; perl: 30; cpp: 27; asm: 7
file content (30 lines) | stat: -rwxr-xr-x 796 bytes parent folder | download
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
#!/usr/bin/env python

# Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
# See the file 'LICENSE' for copying permission

# Removes duplicate entries in wordlist like files

from __future__ import print_function

import sys

if __name__ == "__main__":
    if len(sys.argv) > 1:
        items = list()

        with open(sys.argv[1], 'r') as f:
            for item in f:
                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))