| skipped 27 lines |
28 | 28 | | # along with this program; if not, write to the Free Software |
29 | 29 | | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
30 | 30 | | # |
31 | | - | # See 'docs/LICENSE' for more information. |
| 31 | + | # See 'LICENSE' for more information. |
32 | 32 | | |
33 | | - | import sys |
34 | | - | import os |
| 33 | + | import argparse |
| 34 | + | import configparser |
| 35 | + | import csv |
35 | 36 | | import ftplib |
36 | 37 | | import functools |
37 | | - | import configparser |
38 | | - | import urllib.request, urllib.parse, urllib.error |
39 | 38 | | import gzip |
40 | | - | import csv |
41 | | - | import argparse |
| 39 | + | import os |
| 40 | + | import sys |
| 41 | + | import urllib.error |
| 42 | + | import urllib.parse |
| 43 | + | import urllib.request |
42 | 44 | | |
43 | 45 | | __author__ = "Muris Kurgas" |
44 | 46 | | __license__ = "GPL" |
| skipped 73 lines |
118 | 120 | | f = open(filename, "w") |
119 | 121 | | unique_list_finished.sort() |
120 | 122 | | f.write(os.linesep.join(unique_list_finished)) |
| 123 | + | f.close() |
121 | 124 | | f = open(filename, "r") |
122 | 125 | | lines = 0 |
123 | 126 | | for line in f: |
| skipped 617 lines |
741 | 744 | | """Implementation of -l switch. Download wordlists from ftp repository as |
742 | 745 | | defined in the configuration file.""" |
743 | 746 | | |
744 | | - | ftpname = CONFIG["FTP"]["name"] |
745 | | - | ftpurl = CONFIG["FTP"]["url"] |
746 | | - | ftppath = CONFIG["FTP"]["path"] |
747 | | - | ftpuser = CONFIG["FTP"]["user"] |
748 | | - | ftppass = CONFIG["FTP"]["password"] |
749 | | - | |
750 | | - | if os.path.isdir("dictionaries") == 0: |
751 | | - | os.mkdir("dictionaries") |
752 | | - | |
753 | 747 | | print(" \r\n Choose the section you want to download:\r\n") |
754 | 748 | | |
755 | 749 | | print(" 1 Moby 14 french 27 places") |
| skipped 9 lines |
765 | 759 | | print(" 11 dictionaries 24 names 37 yiddish") |
766 | 760 | | print(" 12 dutch 25 net 38 exit program") |
767 | 761 | | print(" 13 finnish 26 norwegian \r\n") |
768 | | - | print(" \r\n Files will be downloaded from " + ftpname + " repository") |
| 762 | + | print( |
| 763 | + | " \r\n Files will be downloaded from " + CONFIG["FTP"]["name"] + " repository" |
| 764 | + | ) |
769 | 765 | | print( |
770 | 766 | | " \r\n Tip: After downloading wordlist, you can improve it with -w option\r\n" |
771 | 767 | | ) |
| 768 | + | |
| 769 | + | filedown = input("> Enter number: ") |
| 770 | + | filedown.isdigit() |
| 771 | + | while filedown.isdigit() == 0: |
| 772 | + | print("\r\n[-] Wrong choice. ") |
| 773 | + | filedown = input("> Enter number: ") |
| 774 | + | filedown = str(filedown) |
| 775 | + | while int(filedown) > 38 or int(filedown) < 0: |
| 776 | + | print("\r\n[-] Wrong choice. ") |
| 777 | + | filedown = input("> Enter number: ") |
| 778 | + | filedown = str(filedown) |
| 779 | + | |
| 780 | + | download_wordlist_ftp(filedown) |
| 781 | + | return filedown |
| 782 | + | |
| 783 | + | |
| 784 | + | def download_wordlist_ftp(filedown): |
| 785 | + | """ do the FTP download of a wordlist """ |
| 786 | + | |
| 787 | + | ftpname = CONFIG["FTP"]["name"] |
| 788 | + | ftpurl = CONFIG["FTP"]["url"] |
| 789 | + | ftppath = CONFIG["FTP"]["path"] |
| 790 | + | ftpuser = CONFIG["FTP"]["user"] |
| 791 | + | ftppass = CONFIG["FTP"]["password"] |
| 792 | + | |
| 793 | + | if os.path.isdir("dictionaries") == 0: |
| 794 | + | os.mkdir("dictionaries") |
772 | 795 | | |
773 | 796 | | # List of files to download: |
774 | 797 | | arguments = { |
| skipped 183 lines |
958 | 981 | | 36: ("turkish", ("turkish.dict.gz",)), |
959 | 982 | | 37: ("yiddish", ("yiddish.gz",)), |
960 | 983 | | } |
961 | | - | |
962 | | - | filedown = input("> Enter number: ") |
963 | | - | filedown.isdigit() |
964 | | - | while filedown.isdigit() == 0: |
965 | | - | print("\r\n[-] Wrong choice. ") |
966 | | - | filedown = input("> Enter number: ") |
967 | | - | filedown = str(filedown) |
968 | | - | while int(filedown) > 38 or int(filedown) < 0: |
969 | | - | print("\r\n[-] Wrong choice. ") |
970 | | - | filedown = input("> Enter number: ") |
971 | | - | filedown = str(filedown) |
972 | 984 | | |
973 | 985 | | def downloader(): |
974 | 986 | | ftp.login(ftpuser, ftppass) |
| skipped 125 lines |