File: duplicates.py

package info (click to toggle)
sqlmap 1.7.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 12,652 kB
  • sloc: python: 51,128; xml: 13,698; ansic: 989; sh: 299; makefile: 62; sql: 61; perl: 30; cpp: 27; asm: 7
file content (30 lines) | stat: -rwxr-xr-x 797 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-2023 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))