File: duplicates.py

package info (click to toggle)
sqlmap 1.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 12,544 kB
  • sloc: python: 50,308; xml: 15,575; ansic: 989; sh: 284; makefile: 60; sql: 57; perl: 30; cpp: 27; asm: 7
file content (29 lines) | stat: -rwxr-xr-x 717 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
#!/usr/bin/env python

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

# Removes duplicate entries in wordlist like files

from __future__ import print_function

import sys

if len(sys.argv) > 0:
    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))