Projects STRLCPY cupp Commits 5ca77b32
🤬
  • less code duplication for ftp download

  • Loading...
  • Mebus committed 5 years ago
    5ca77b32
    1 parent c696125f
  • ■ ■ ■ ■ ■ ■
    cupp.py
    skipped 1 lines
    2 2  #
    3 3  # [Program]
    4 4  #
    5  -# CUPP 3.2.0-alpha
     5 +# CUPP 3.2.2-alpha
    6 6  # Common User Passwords Profiler
    7 7  #
    8 8  #
    skipped 134 lines
    143 143   exit()
    144 144   
    145 145  elif sys.argv[1] == "-v":
    146  - print("\r\n \033[1;31m[ cupp.py ] v3.2.1-alpha\033[1;m\r\n")
     146 + print("\r\n \033[1;31m[ cupp.py ] v3.2.2-alpha\033[1;m\r\n")
    147 147   print(" * Hacked up by j0rgan - [email protected]")
    148 148   print(" * http://www.remote-exploit.org\r\n")
    149 149   print(" Take a look ./README.md file for more info about the program\r\n")
    skipped 612 lines
    762 762   filedown = input("> Enter number: ")
    763 763   filedown = str(filedown)
    764 764   
    765  - def handleDownload(block):
    766  - file.write(block)
    767  - print(".", end=" ")
    768  - 
    769 765   def downloader():
    770 766   ftp.login(ftpuser, ftppass)
    771 767   ftp.cwd(ftppath)
    772 768   
    773  - def filequitter():
    774  - file.close()
     769 + # retrieve a file from FTP
     770 + def retr_binary_file(ftp, dire, filename):
     771 + def handleDownload(block):
     772 + f.write(block)
     773 + print(".", end="")
     774 + 
     775 + f = open(dire + filename, "wb")
     776 + print("\r\n[+] downloading " + filename + "...")
     777 + # ftp.retrbinary("RETR " + filename, f.write)
     778 + ftp.retrbinary("RETR " + filename, handleDownload)
     779 + f.close()
    775 780   print(" done.")
     781 + 
     782 + # retrieve a list of files
     783 + def retr_file_list(ftp, dire, file_list):
     784 + for f in file_list:
     785 + retr_binary_file(ftp, dire, f)
    776 786   
    777 787   if filedown == "1":
    778 788   print("\r\n[+] connecting...\r\n")
    skipped 3 lines
    782 792   if os.path.isdir("dictionaries/Moby/") == 0:
    783 793   os.mkdir("dictionaries/Moby/")
    784 794   dire = "dictionaries/Moby/"
    785  - file = open(dire + "mhyph.tar.gz", "wb")
    786  - print("\r\n[+] downloading mhyph.tar.gz...")
    787  - ftp.retrbinary("RETR " + "mhyph.tar.gz", handleDownload)
    788  - filequitter()
    789 795   
    790  - file = open(dire + "mlang.tar.gz", "wb")
    791  - print("\r\n[+] downloading mlang.tar.gz...")
    792  - ftp.retrbinary("RETR " + "mlang.tar.gz", handleDownload)
    793  - filequitter()
     796 + files_to_download = {
     797 + "mhyph.tar.gz",
     798 + "mlang.tar.gz",
     799 + "moby.tar.gz",
     800 + "mpos.tar.gz",
     801 + "mpron.tar.gz",
     802 + "mthes.tar.gz",
     803 + "mwords.tar.gz",
     804 + }
    794 805   
    795  - file = open(dire + "moby.tar.gz", "wb")
    796  - print("\r\n[+] downloading moby.tar.gz...")
    797  - ftp.retrbinary("RETR " + "moby.tar.gz", handleDownload)
    798  - filequitter()
    799  - 
    800  - file = open(dire + "mpos.tar.gz", "wb")
    801  - print("\r\n[+] downloading mpos.tar.gz...")
    802  - ftp.retrbinary("RETR " + "mpos.tar.gz", handleDownload)
    803  - filequitter()
    804  - 
    805  - file = open(dire + "mpron.tar.gz", "wb")
    806  - print("\r\n[+] downloading mpron.tar.gz...")
    807  - ftp.retrbinary("RETR " + "mpron.tar.gz", handleDownload)
    808  - filequitter()
    809  - 
    810  - file = open(dire + "mthes.tar.gz", "wb")
    811  - print("\r\n[+] downloading mthes.tar.gz...")
    812  - ftp.retrbinary("RETR " + "mthes.tar.gz", handleDownload)
    813  - filequitter()
    814  - 
    815  - file = open(dire + "mwords.tar.gz", "wb")
    816  - print("\r\n[+] downloading mwords.tar.gz...")
    817  - ftp.retrbinary("RETR " + "mwords.tar.gz", handleDownload)
    818  - filequitter()
     806 + # download the files
     807 + retr_file_list(ftp, dire, files_to_download)
    819 808   
    820 809   print("[+] files saved to " + dire)
    821 810   ftp.quit()
    822 811   exit()
    823 812   
    824  - if filedown == "2":
     813 + elif filedown == "2":
    825 814   print("[+] connecting...")
    826 815   ftp = ftplib.FTP(ftpurl)
    827 816   downloader()
    skipped 2 lines
    830 819   os.mkdir("dictionaries/afrikaans/")
    831 820   dire = "dictionaries/afrikaans/"
    832 821   
    833  - file = open(dire + "afr_dbf.zip", "wb")
    834  - print("\r\n[+] downloading afr_dbf.zip...")
    835  - ftp.retrbinary("RETR " + "afr_dbf.zip", handleDownload)
    836  - filequitter()
     822 + retr_binary_file(ftp, dire, "afr_dbf.zip")
    837 823   
    838 824   print("[+] file saved to " + dire)
    839 825   ftp.quit()
    840 826   exit()
    841 827   
    842  - if filedown == "3":
     828 + elif filedown == "3":
    843 829   print("[+] connecting...")
    844 830   ftp = ftplib.FTP(ftpurl)
    845 831   downloader()
    skipped 2 lines
    848 834   os.mkdir("dictionaries/american/")
    849 835   dire = "dictionaries/american/"
    850 836   
    851  - file = open(dire + "dic-0294.tar.gz", "wb")
    852  - print("\r\n[+] downloading dic-0294.tar.gz...")
    853  - ftp.retrbinary("RETR " + "dic-0294.tar.gz", handleDownload)
    854  - filequitter()
     837 + retr_binary_file(ftp, dire, "dic-0294.tar.gz")
    855 838   
    856 839   print("[+] file saved to " + dire)
    857 840   ftp.quit()
    858 841   exit()
    859 842   
    860  - if filedown == "4":
     843 + elif filedown == "4":
    861 844   print("[+] connecting...")
    862 845   ftp = ftplib.FTP(ftpurl)
    863 846   downloader()
    skipped 2 lines
    866 849   os.mkdir("dictionaries/aussie/")
    867 850   dire = "dictionaries/aussie/"
    868 851   
    869  - file = open(dire + "oz.gz", "wb")
    870  - print("\r\n[+] downloading oz.gz...")
    871  - ftp.retrbinary("RETR " + "oz.gz", handleDownload)
    872  - filequitter()
     852 + retr_binary_file(ftp, dire, "oz.gz")
    873 853   
    874 854   print("[+] file saved to " + dire)
    875 855   ftp.quit()
    876 856   exit()
    877 857   
    878  - if filedown == "5":
     858 + elif filedown == "5":
    879 859   print("[+] connecting...")
    880 860   ftp = ftplib.FTP(ftpurl)
    881 861   downloader()
    skipped 2 lines
    884 864   os.mkdir("dictionaries/chinese/")
    885 865   dire = "dictionaries/chinese/"
    886 866   
    887  - file = open(dire + "chinese.gz", "wb")
    888  - print("\r\n[+] downloading chinese.gz...")
    889  - ftp.retrbinary("RETR " + "chinese.gz", handleDownload)
    890  - filequitter()
     867 + retr_binary_file(ftp, dire, "chinese.gz")
    891 868   
    892 869   print("[+] file saved to " + dire)
    893 870   ftp.quit()
    894 871   exit()
    895 872   
    896  - if filedown == "6":
     873 + elif filedown == "6":
    897 874   print("[+] connecting...")
    898 875   ftp = ftplib.FTP(ftpurl)
    899 876   downloader()
    skipped 2 lines
    902 879   os.mkdir("dictionaries/computer/")
    903 880   dire = "dictionaries/computer/"
    904 881   
    905  - file = open(dire + "Domains.gz", "wb")
    906  - print("\r\n[+] downloading Domains.gz...")
    907  - ftp.retrbinary("RETR " + "Domains.gz", handleDownload)
    908  - filequitter()
     882 + files_to_download = {
     883 + "Domains.gz",
     884 + "Dosref.gz",
     885 + "Ftpsites.gz",
     886 + "Jargon.gz",
     887 + "common-passwords.txt.gz",
     888 + "etc-hosts.gz",
     889 + "foldoc.gz",
     890 + "language-list.gz",
     891 + "unix.gz",
     892 + }
    909 893   
    910  - file = open(dire + "Dosref.gz", "wb")
    911  - print("\r\n[+] downloading Dosref.gz...")
    912  - ftp.retrbinary("RETR " + "Dosref.gz", handleDownload)
    913  - filequitter()
    914  - 
    915  - file = open(dire + "Ftpsites.gz", "wb")
    916  - print("\r\n[+] downloading Ftpsites.gz...")
    917  - ftp.retrbinary("RETR " + "Ftpsites.gz", handleDownload)
    918  - filequitter()
    919  - 
    920  - file = open(dire + "Jargon.gz", "wb")
    921  - print("\r\n[+] downloading Jargon.gz...")
    922  - ftp.retrbinary("RETR " + "Jargon.gz", handleDownload)
    923  - filequitter()
    924  - 
    925  - file = open(dire + "common-passwords.txt.gz", "wb")
    926  - print("\r\n[+] downloading common-passwords.txt.gz...")
    927  - ftp.retrbinary("RETR " + "common-passwords.txt.gz", handleDownload)
    928  - filequitter()
    929  - 
    930  - file = open(dire + "etc-hosts.gz", "wb")
    931  - print("\r\n[+] downloading etc-hosts.gz...")
    932  - ftp.retrbinary("RETR " + "etc-hosts.gz", handleDownload)
    933  - filequitter()
    934  - 
    935  - file = open(dire + "foldoc.gz", "wb")
    936  - print("\r\n[+] downloading foldoc.gz...")
    937  - ftp.retrbinary("RETR " + "foldoc.gz", handleDownload)
    938  - filequitter()
    939  - 
    940  - file = open(dire + "language-list.gz", "wb")
    941  - print("\r\n[+] downloading language-list.gz...")
    942  - ftp.retrbinary("RETR " + "language-list.gz", handleDownload)
    943  - filequitter()
    944  - 
    945  - file = open(dire + "unix.gz", "wb")
    946  - print("\r\n[+] downloading unix.gz...")
    947  - ftp.retrbinary("RETR " + "unix.gz", handleDownload)
    948  - filequitter()
     894 + # download the files
     895 + retr_file_list(ftp, dire, files_to_download)
    949 896   
    950 897   print("[+] files saved to " + dire)
    951 898   ftp.quit()
    952 899   exit()
    953 900   
    954  - if filedown == "7":
     901 + elif filedown == "7":
    955 902   print("[+] connecting...")
    956 903   ftp = ftplib.FTP(ftpurl)
    957 904   downloader()
    skipped 2 lines
    960 907   os.mkdir("dictionaries/croatian/")
    961 908   dire = "dictionaries/croatian/"
    962 909   
    963  - file = open(dire + "croatian.gz", "wb")
    964  - print("\r\n[+] downloading croatian.gz...")
    965  - ftp.retrbinary("RETR " + "croatian.gz", handleDownload)
    966  - filequitter()
     910 + retr_binary_file(ftp, dire, "croatian.gz")
    967 911   
    968 912   print("[+] file saved to " + dire)
    969 913   ftp.quit()
    970 914   exit()
    971 915   
    972  - if filedown == "8":
     916 + elif filedown == "8":
    973 917   print("[+] connecting...")
    974 918   ftp = ftplib.FTP(ftpurl)
    975 919   downloader()
    skipped 2 lines
    978 922   os.mkdir("dictionaries/czech/")
    979 923   dire = "dictionaries/czech/"
    980 924   
    981  - file = open(dire + "czech-wordlist-ascii-cstug-novak.gz", "wb")
    982  - print("\r\n[+] downloading czech-wordlist-ascii-cstug-novak.gz...")
    983  - ftp.retrbinary("RETR " + "czech-wordlist-ascii-cstug-novak.gz", handleDownload)
    984  - filequitter()
     925 + retr_binary_file(ftp, dire, "czech-wordlist-ascii-cstug-novak.gz")
    985 926   
    986 927   print("[+] file saved to " + dire)
    987 928   ftp.quit()
    988 929   exit()
    989 930   
    990  - if filedown == "9":
     931 + elif filedown == "9":
    991 932   print("[+] connecting...")
    992 933   ftp = ftplib.FTP(ftpurl)
    993 934   downloader()
    skipped 2 lines
    996 937   os.mkdir("dictionaries/danish/")
    997 938   dire = "dictionaries/danish/"
    998 939   
    999  - file = open(dire + "danish.words.gz", "wb")
    1000  - print("\r\n[+] downloading danish.words.gz...")
    1001  - ftp.retrbinary("RETR " + "danish.words.gz", handleDownload)
    1002  - filequitter()
    1003  - 
    1004  - file = open(dire + "dansk.zip", "wb")
    1005  - print("\r\n[+] downloading dansk.zip...")
    1006  - ftp.retrbinary("RETR " + "dansk.zip", handleDownload)
    1007  - filequitter()
     940 + retr_binary_file(ftp, dire, "danish.words.gz")
     941 + retr_binary_file(ftp, dire, "dansk.zip")
    1008 942   
    1009 943   print("[+] files saved to " + dire)
    1010 944   ftp.quit()
    1011 945   exit()
    1012 946   
    1013  - if filedown == "10":
     947 + elif filedown == "10":
    1014 948   print("[+] connecting...")
    1015 949   ftp = ftplib.FTP(ftpurl)
    1016 950   downloader()
    skipped 2 lines
    1019 953   os.mkdir("dictionaries/databases/")
    1020 954   dire = "dictionaries/databases/"
    1021 955   
    1022  - file = open(dire + "acronyms.gz", "wb")
    1023  - print("\r\n[+] downloading acronyms.gz...")
    1024  - ftp.retrbinary("RETR " + "acronyms.gz", handleDownload)
    1025  - filequitter()
     956 + files_to_download = {
     957 + "acronyms.gz",
     958 + "att800.gz",
     959 + "computer-companies.gz",
     960 + "world_heritage.gz",
     961 + }
    1026 962   
    1027  - file = open(dire + "att800.gz", "wb")
    1028  - print("\r\n[+] downloading att800.gz...")
    1029  - ftp.retrbinary("RETR " + "att800.gz", handleDownload)
    1030  - filequitter()
    1031  - 
    1032  - file = open(dire + "computer-companies.gz", "wb")
    1033  - print("\r\n[+] downloading computer-companies.gz...")
    1034  - ftp.retrbinary("RETR " + "computer-companies.gz", handleDownload)
    1035  - filequitter()
    1036  - 
    1037  - file = open(dire + "world_heritage.gz", "wb")
    1038  - print("\r\n[+] downloading world_heritage.gz...")
    1039  - ftp.retrbinary("RETR " + "world_heritage.gz", handleDownload)
    1040  - filequitter()
     963 + # download the files
     964 + retr_file_list(ftp, dire, files_to_download)
    1041 965   
    1042 966   print("[+] files saved to " + dire)
    1043 967   ftp.quit()
    1044 968   exit()
    1045 969   
    1046  - if filedown == "11":
     970 + elif filedown == "11":
    1047 971   print("[+] connecting...")
    1048 972   ftp = ftplib.FTP(ftpurl)
    1049 973   downloader()
    skipped 2 lines
    1052 976   os.mkdir("dictionaries/dictionaries/")
    1053 977   dire = "dictionaries/dictionaries/"
    1054 978   
    1055  - file = open(dire + "Antworth.gz", "wb")
    1056  - print("\r\n[+] downloading Antworth.gz...")
    1057  - ftp.retrbinary("RETR " + "Antworth.gz", handleDownload)
    1058  - filequitter()
     979 + files_to_download = {
     980 + "Antworth.gz",
     981 + "CRL.words.gz",
     982 + "Roget.words.gz",
     983 + "Unabr.dict.gz",
     984 + "Unix.dict.gz",
     985 + "englex-dict.gz",
     986 + "knuth_britsh.gz",
     987 + "knuth_words.gz",
     988 + "pocket-dic.gz",
     989 + "shakesp-glossary.gz",
     990 + "special.eng.gz",
     991 + "words-english.gz",
     992 + }
    1059 993   
    1060  - file = open(dire + "CRL.words.gz", "wb")
    1061  - print("\r\n[+] downloading CRL.words.gz...")
    1062  - ftp.retrbinary("RETR " + "CRL.words.gz", handleDownload)
    1063  - filequitter()
    1064  - 
    1065  - file = open(dire + "Roget.words.gz", "wb")
    1066  - print("\r\n[+] downloading Roget.words.gz...")
    1067  - ftp.retrbinary("RETR " + "Roget.words.gz", handleDownload)
    1068  - filequitter()
    1069  - 
    1070  - file = open(dire + "Unabr.dict.gz", "wb")
    1071  - print("\r\n[+] downloading Unabr.dict.gz...")
    1072  - ftp.retrbinary("RETR " + "Unabr.dict.gz", handleDownload)
    1073  - filequitter()
    1074  - 
    1075  - file = open(dire + "Unix.dict.gz", "wb")
    1076  - print("\r\n[+] downloading Unix.dict.gz...")
    1077  - ftp.retrbinary("RETR " + "Unix.dict.gz", handleDownload)
    1078  - filequitter()
    1079  - 
    1080  - file = open(dire + "englex-dict.gz", "wb")
    1081  - print("\r\n[+] downloading englex-dict.gz...")
    1082  - ftp.retrbinary("RETR " + "englex-dict.gz", handleDownload)
    1083  - filequitter()
    1084  - 
    1085  - file = open(dire + "knuth_britsh.gz", "wb")
    1086  - print("\r\n[+] downloading knuth_britsh.gz...")
    1087  - ftp.retrbinary("RETR " + "knuth_britsh.gz", handleDownload)
    1088  - filequitter()
    1089  - 
    1090  - file = open(dire + "knuth_words.gz", "wb")
    1091  - print("\r\n[+] downloading knuth_words.gz...")
    1092  - ftp.retrbinary("RETR " + "knuth_words.gz", handleDownload)
    1093  - filequitter()
    1094  - 
    1095  - file = open(dire + "pocket-dic.gz", "wb")
    1096  - print("\r\n[+] downloading pocket-dic.gz...")
    1097  - ftp.retrbinary("RETR " + "pocket-dic.gz", handleDownload)
    1098  - filequitter()
    1099  - 
    1100  - file = open(dire + "shakesp-glossary.gz", "wb")
    1101  - print("\r\n[+] downloading shakesp-glossary.gz...")
    1102  - ftp.retrbinary("RETR " + "shakesp-glossary.gz", handleDownload)
    1103  - filequitter()
    1104  - 
    1105  - file = open(dire + "special.eng.gz", "wb")
    1106  - print("\r\n[+] downloading special.eng.gz...")
    1107  - ftp.retrbinary("RETR " + "special.eng.gz", handleDownload)
    1108  - filequitter()
    1109  - 
    1110  - file = open(dire + "words-english.gz", "wb")
    1111  - print("\r\n[+] downloading words-english.gz...")
    1112  - ftp.retrbinary("RETR " + "words-english.gz", handleDownload)
    1113  - filequitter()
     994 + # download the files
     995 + retr_file_list(ftp, dire, files_to_download)
    1114 996   
    1115 997   print("[+] files saved to " + dire)
    1116 998   ftp.quit()
    1117 999   exit()
    1118 1000   
    1119  - if filedown == "12":
     1001 + elif filedown == "12":
    1120 1002   print("[+] connecting...")
    1121 1003   ftp = ftplib.FTP(ftpurl)
    1122 1004   downloader()
    skipped 2 lines
    1125 1007   os.mkdir("dictionaries/dutch/")
    1126 1008   dire = "dictionaries/dutch/"
    1127 1009   
    1128  - file = open(dire + "words.dutch.gz", "wb")
    1129  - print("\r\n[+] downloading words.dutch.gz...")
    1130  - ftp.retrbinary("RETR " + "words.dutch.gz", handleDownload)
    1131  - filequitter()
     1010 + retr_binary_file(ftp, dire, "words.dutch.gz")
    1132 1011   
    1133 1012   print("[+] file saved to " + dire)
    1134 1013   ftp.quit()
    1135 1014   exit()
    1136 1015   
    1137  - if filedown == "13":
     1016 + elif filedown == "13":
    1138 1017   print("[+] connecting...")
    1139 1018   ftp = ftplib.FTP(ftpurl)
    1140 1019   downloader()
    skipped 2 lines
    1143 1022   os.mkdir("dictionaries/finnish/")
    1144 1023   dire = "dictionaries/finnish/"
    1145 1024   
    1146  - file = open(dire + "finnish.gz", "wb")
    1147  - print("\r\n[+] downloading finnish.gz...")
    1148  - ftp.retrbinary("RETR " + "finnish.gz", handleDownload)
    1149  - filequitter()
     1025 + files_to_download = {
     1026 + "finnish.gz",
     1027 + "firstnames.finnish.gz",
     1028 + "words.finnish.FAQ.gz",
     1029 + }
    1150 1030   
    1151  - file = open(dire + "firstnames.finnish.gz", "wb")
    1152  - print("\r\n[+] downloading firstnames.finnish.gz...")
    1153  - ftp.retrbinary("RETR " + "firstnames.finnish.gz", handleDownload)
    1154  - filequitter()
    1155  - 
    1156  - file = open(dire + "words.finnish.FAQ.gz", "wb")
    1157  - print("\r\n[+] downloading words.finnish.FAQ.gz...")
    1158  - ftp.retrbinary("RETR " + "words.finnish.FAQ.gz", handleDownload)
    1159  - filequitter()
     1031 + # download the files
     1032 + retr_file_list(ftp, dire, files_to_download)
    1160 1033   
    1161 1034   print("[+] files saved to " + dire)
    1162 1035   ftp.quit()
    1163 1036   exit()
    1164 1037   
    1165  - if filedown == "14":
     1038 + elif filedown == "14":
    1166 1039   print("[+] connecting...")
    1167 1040   ftp = ftplib.FTP(ftpurl)
    1168 1041   downloader()
    skipped 2 lines
    1171 1044   os.mkdir("dictionaries/french/")
    1172 1045   dire = "dictionaries/french/"
    1173 1046   
    1174  - file = open(dire + "dico.gz", "wb")
    1175  - print("\r\n[+] downloading dico.gz...")
    1176  - ftp.retrbinary("RETR " + "dico.gz", handleDownload)
    1177  - filequitter()
     1047 + retr_binary_file(ftp, dire, "dico.gz")
    1178 1048   
    1179 1049   print("[+] file saved to " + dire)
    1180 1050   ftp.quit()
    1181 1051   exit()
    1182 1052   
    1183  - if filedown == "15":
     1053 + elif filedown == "15":
    1184 1054   print("[+] connecting...")
    1185 1055   ftp = ftplib.FTP(ftpurl)
    1186 1056   downloader()
    skipped 2 lines
    1189 1059   os.mkdir("dictionaries/german/")
    1190 1060   dire = "dictionaries/german/"
    1191 1061   
    1192  - file = open(dire + "deutsch.dic.gz", "wb")
    1193  - print("\r\n[+] downloading deutsch.dic.gz...")
    1194  - ftp.retrbinary("RETR " + "deutsch.dic.gz", handleDownload)
    1195  - filequitter()
     1062 + files_to_download = {"deutsch.dic.gz", "germanl.gz", "words.german.gz"}
    1196 1063   
    1197  - file = open(dire + "germanl.gz", "wb")
    1198  - print("\r\n[+] downloading germanl.gz...")
    1199  - ftp.retrbinary("RETR " + "germanl.gz", handleDownload)
    1200  - filequitter()
    1201  - 
    1202  - file = open(dire + "words.german.gz", "wb")
    1203  - print("\r\n[+] downloading words.german.gz...")
    1204  - ftp.retrbinary("RETR " + "words.german.gz", handleDownload)
    1205  - filequitter()
     1064 + # download the files
     1065 + retr_file_list(ftp, dire, files_to_download)
    1206 1066   
    1207 1067   print("[+] files saved to " + dire)
    1208 1068   ftp.quit()
    1209 1069   exit()
    1210 1070   
    1211  - if filedown == "16":
     1071 + elif filedown == "16":
    1212 1072   print("[+] connecting...")
    1213 1073   ftp = ftplib.FTP(ftpurl)
    1214 1074   downloader()
    skipped 2 lines
    1217 1077   os.mkdir("dictionaries/hindi/")
    1218 1078   dire = "dictionaries/hindi/"
    1219 1079   
    1220  - file = open(dire + "hindu-names.gz", "wb")
    1221  - print("\r\n[+] downloading hindu-names.gz...")
    1222  - ftp.retrbinary("RETR " + "hindu-names.gz", handleDownload)
    1223  - filequitter()
     1080 + retr_binary_file(ftp, dire, "hindu-names.gz")
    1224 1081   
    1225 1082   print("[+] file saved to " + dire)
    1226 1083   ftp.quit()
    1227 1084   exit()
    1228 1085   
    1229  - if filedown == "17":
     1086 + elif filedown == "17":
    1230 1087   print("[+] connecting...")
    1231 1088   ftp = ftplib.FTP(ftpurl)
    1232 1089   downloader()
    skipped 2 lines
    1235 1092   os.mkdir("dictionaries/hungarian/")
    1236 1093   dire = "dictionaries/hungarian/"
    1237 1094   
    1238  - file = open(dire + "hungarian.gz", "wb")
    1239  - print("\r\n[+] downloading hungarian.gz...")
    1240  - ftp.retrbinary("RETR " + "hungarian.gz", handleDownload)
    1241  - filequitter()
     1095 + retr_binary_file(ftp, dire, "hungarian.gz")
    1242 1096   
    1243 1097   print("[+] file saved to " + dire)
    1244 1098   ftp.quit()
    1245 1099   exit()
    1246 1100   
    1247  - if filedown == "18":
     1101 + elif filedown == "18":
    1248 1102   print("[+] connecting...")
    1249 1103   ftp = ftplib.FTP(ftpurl)
    1250 1104   downloader()
    skipped 2 lines
    1253 1107   os.mkdir("dictionaries/italian/")
    1254 1108   dire = "dictionaries/italian/"
    1255 1109   
    1256  - file = open(dire + "words.italian.gz", "wb")
    1257  - print("\r\n[+] downloading words.italian.gz...")
    1258  - ftp.retrbinary("RETR " + "words.italian.gz", handleDownload)
    1259  - filequitter()
     1110 + retr_binary_file(ftp, dire, "words.italian.gz")
    1260 1111   
    1261 1112   print("[+] file saved to " + dire)
    1262 1113   ftp.quit()
    1263 1114   exit()
    1264 1115   
    1265  - if filedown == "19":
     1116 + elif filedown == "19":
    1266 1117   print("[+] connecting...")
    1267 1118   ftp = ftplib.FTP(ftpurl)
    1268 1119   downloader()
    skipped 2 lines
    1271 1122   os.mkdir("dictionaries/japanese/")
    1272 1123   dire = "dictionaries/japanese/"
    1273 1124   
    1274  - file = open(dire + "words.japanese.gz", "wb")
    1275  - print("\r\n[+] downloading words.japanese.gz...")
    1276  - ftp.retrbinary("RETR " + "words.japanese.gz", handleDownload)
    1277  - filequitter()
     1125 + retr_binary_file(ftp, dire, "words.japanese.gz")
    1278 1126   
    1279 1127   print("[+] file saved to " + dire)
    1280 1128   ftp.quit()
    1281 1129   exit()
    1282 1130   
    1283  - if filedown == "20":
     1131 + elif filedown == "20":
    1284 1132   print("[+] connecting...")
    1285 1133   ftp = ftplib.FTP(ftpurl)
    1286 1134   downloader()
    skipped 2 lines
    1289 1137   os.mkdir("dictionaries/latin/")
    1290 1138   dire = "dictionaries/latin/"
    1291 1139   
    1292  - file = open(dire + "wordlist.aug.gz", "wb")
    1293  - print("\r\n[+] downloading wordlist.aug.gz...")
    1294  - ftp.retrbinary("RETR " + "wordlist.aug.gz", handleDownload)
    1295  - filequitter()
     1140 + retr_binary_file(ftp, dire, "wordlist.aug.gz")
    1296 1141   
    1297 1142   print("[+] file saved to " + dire)
    1298 1143   ftp.quit()
    1299 1144   exit()
    1300 1145   
    1301  - if filedown == "21":
     1146 + elif filedown == "21":
    1302 1147   print("[+] connecting...")
    1303 1148   ftp = ftplib.FTP(ftpurl)
    1304 1149   downloader()
    skipped 2 lines
    1307 1152   os.mkdir("dictionaries/literature/")
    1308 1153   dire = "dictionaries/literature/"
    1309 1154   
    1310  - file = open(dire + "LCarrol.gz", "wb")
    1311  - print("\r\n[+] downloading LCarrol.gz...")
    1312  - ftp.retrbinary("RETR " + "LCarrol.gz", handleDownload)
    1313  - filequitter()
    1314  - 
    1315  - file = open(dire + "Paradise.Lost.gz", "wb")
    1316  - print("\r\n[+] downloading Paradise.Lost.gz...")
    1317  - ftp.retrbinary("RETR " + "Paradise.Lost.gz", handleDownload)
    1318  - filequitter()
    1319  - 
    1320  - file = open(dire + "aeneid.gz", "wb")
    1321  - print("\r\n[+] downloading aeneid.gz...")
    1322  - ftp.retrbinary("RETR " + "aeneid.gz", handleDownload)
    1323  - filequitter()
    1324  - 
    1325  - file = open(dire + "arthur.gz", "wb")
    1326  - print("\r\n[+] downloading arthur.gz...")
    1327  - ftp.retrbinary("RETR " + "arthur.gz", handleDownload)
    1328  - filequitter()
    1329  - 
    1330  - file = open(dire + "cartoon.gz", "wb")
    1331  - print("\r\n[+] downloading cartoon.gz...")
    1332  - ftp.retrbinary("RETR " + "cartoon.gz", handleDownload)
    1333  - filequitter()
    1334  - 
    1335  - file = open(dire + "cartoons-olivier.gz", "wb")
    1336  - print("\r\n[+] downloading cartoons-olivier.gz...")
    1337  - ftp.retrbinary("RETR " + "cartoons-olivier.gz", handleDownload)
    1338  - filequitter()
    1339  - 
    1340  - file = open(dire + "charlemagne.gz", "wb")
    1341  - print("\r\n[+] downloading charlemagne.gz...")
    1342  - ftp.retrbinary("RETR " + "charlemagne.gz", handleDownload)
    1343  - filequitter()
    1344  - 
    1345  - file = open(dire + "fable.gz", "wb")
    1346  - print("\r\n[+] downloading fable.gz...")
    1347  - ftp.retrbinary("RETR " + "fable.gz", handleDownload)
    1348  - filequitter()
    1349  - 
    1350  - file = open(dire + "iliad.gz", "wb")
    1351  - print("\r\n[+] downloading iliad.gz...")
    1352  - ftp.retrbinary("RETR " + "iliad.gz", handleDownload)
    1353  - filequitter()
     1155 + files_to_download = {
     1156 + "LCarrol.gz",
     1157 + "Paradise.Lost.gz",
     1158 + "aeneid.gz",
     1159 + "arthur.gz",
     1160 + "cartoon.gz",
     1161 + "cartoons-olivier.gz",
     1162 + "charlemagne.gz",
     1163 + "fable.gz",
     1164 + "iliad.gz",
     1165 + "myths-legends.gz",
     1166 + "odyssey.gz",
     1167 + "sf.gz",
     1168 + "shakespeare.gz",
     1169 + "tolkien.words.gz",
     1170 + }
    1354 1171   
    1355  - file = open(dire + "myths-legends.gz", "wb")
    1356  - print("\r\n[+] downloading myths-legends.gz...")
    1357  - ftp.retrbinary("RETR " + "myths-legends.gz", handleDownload)
    1358  - filequitter()
    1359  - 
    1360  - file = open(dire + "odyssey.gz", "wb")
    1361  - print("\r\n[+] downloading odyssey.gz...")
    1362  - ftp.retrbinary("RETR " + "odyssey.gz", handleDownload)
    1363  - filequitter()
    1364  - 
    1365  - file = open(dire + "sf.gz", "wb")
    1366  - print("\r\n[+] downloading sf.gz...")
    1367  - ftp.retrbinary("RETR " + "sf.gz", handleDownload)
    1368  - filequitter()
    1369  - 
    1370  - file = open(dire + "shakespeare.gz", "wb")
    1371  - print("\r\n[+] downloading shakespeare.gz...")
    1372  - ftp.retrbinary("RETR " + "shakespeare.gz", handleDownload)
    1373  - filequitter()
    1374  - 
    1375  - file = open(dire + "tolkien.words.gz", "wb")
    1376  - print("\r\n[+] downloading tolkien.words.gz...")
    1377  - ftp.retrbinary("RETR " + "tolkien.words.gz", handleDownload)
    1378  - filequitter()
     1172 + # download the files
     1173 + retr_file_list(ftp, dire, files_to_download)
    1379 1174   
    1380 1175   print("[+] files saved to " + dire)
    1381 1176   ftp.quit()
    1382 1177   exit()
    1383 1178   
    1384  - if filedown == "22":
     1179 + elif filedown == "22":
    1385 1180   print("[+] connecting...")
    1386 1181   ftp = ftplib.FTP(ftpurl)
    1387 1182   downloader()
    skipped 2 lines
    1390 1185   os.mkdir("dictionaries/movieTV/")
    1391 1186   dire = "dictionaries/movieTV/"
    1392 1187   
    1393  - file = open(dire + "Movies.gz", "wb")
    1394  - print("\r\n[+] downloading Movies.gz...")
    1395  - ftp.retrbinary("RETR " + "Movies.gz", handleDownload)
    1396  - filequitter()
     1188 + files_to_download = {"Movies.gz", "Python.gz", "Trek.gz"}
    1397 1189   
    1398  - file = open(dire + "Python.gz", "wb")
    1399  - print("\r\n[+] downloading Python.gz...")
    1400  - ftp.retrbinary("RETR " + "Python.gz", handleDownload)
    1401  - filequitter()
    1402  - 
    1403  - file = open(dire + "Trek.gz", "wb")
    1404  - print("\r\n[+] downloading Trek.gz...")
    1405  - ftp.retrbinary("RETR " + "Trek.gz", handleDownload)
    1406  - filequitter()
     1190 + # download the files
     1191 + retr_file_list(ftp, dire, files_to_download)
    1407 1192   
    1408 1193   print("[+] files saved to " + dire)
    1409 1194   ftp.quit()
    1410 1195   exit()
    1411 1196   
    1412  - if filedown == "23":
     1197 + elif filedown == "23":
    1413 1198   print("[+] connecting...")
    1414 1199   ftp = ftplib.FTP(ftpurl)
    1415 1200   downloader()
    skipped 2 lines
    1418 1203   os.mkdir("dictionaries/music/")
    1419 1204   dire = "dictionaries/music/"
    1420 1205   
    1421  - file = open(dire + "music-classical.gz", "wb")
    1422  - print("\r\n[+] downloading music-classical.gz...")
    1423  - ftp.retrbinary("RETR " + "music-classical.gz", handleDownload)
    1424  - filequitter()
     1206 + files_to_download = {
     1207 + "music-classical.gz",
     1208 + "music-country.gz",
     1209 + "music-jazz.gz",
     1210 + "music-other.gz",
     1211 + "music-rock.gz",
     1212 + "music-shows.gz",
     1213 + "rock-groups.gz",
     1214 + }
    1425 1215   
    1426  - file = open(dire + "music-country.gz", "wb")
    1427  - print("\r\n[+] downloading music-country.gz...")
    1428  - ftp.retrbinary("RETR " + "music-country.gz", handleDownload)
    1429  - filequitter()
    1430  - 
    1431  - file = open(dire + "music-jazz.gz", "wb")
    1432  - print("\r\n[+] downloading music-jazz.gz...")
    1433  - ftp.retrbinary("RETR " + "music-jazz.gz", handleDownload)
    1434  - filequitter()
    1435  - 
    1436  - file = open(dire + "music-other.gz", "wb")
    1437  - print("\r\n[+] downloading music-other.gz...")
    1438  - ftp.retrbinary("RETR " + "music-other.gz", handleDownload)
    1439  - filequitter()
    1440  - 
    1441  - file = open(dire + "music-rock.gz", "wb")
    1442  - print("\r\n[+] downloading music-rock.gz...")
    1443  - ftp.retrbinary("RETR " + "music-rock.gz", handleDownload)
    1444  - filequitter()
    1445  - 
    1446  - file = open(dire + "music-shows.gz", "wb")
    1447  - print("\r\n[+] downloading music-shows.gz...")
    1448  - ftp.retrbinary("RETR " + "music-shows.gz", handleDownload)
    1449  - filequitter()
    1450  - 
    1451  - file = open(dire + "rock-groups.gz", "wb")
    1452  - print("\r\n[+] downloading rock-groups.gz...")
    1453  - ftp.retrbinary("RETR " + "rock-groups.gz", handleDownload)
    1454  - filequitter()
     1216 + # download the files
     1217 + retr_file_list(ftp, dire, files_to_download)
    1455 1218   
    1456 1219   print("[+] files saved to " + dire)
    1457 1220   ftp.quit()
    1458 1221   exit()
    1459 1222   
    1460  - if filedown == "24":
     1223 + elif filedown == "24":
    1461 1224   print("[+] connecting...")
    1462 1225   ftp = ftplib.FTP(ftpurl)
    1463 1226   downloader()
    skipped 2 lines
    1466 1229   os.mkdir("dictionaries/names/")
    1467 1230   dire = "dictionaries/names/"
    1468 1231   
    1469  - file = open(dire + "ASSurnames.gz", "wb")
    1470  - print("\r\n[+] downloading ASSurnames.gz...")
    1471  - ftp.retrbinary("RETR " + "ASSurnames.gz", handleDownload)
    1472  - filequitter()
    1473  - 
    1474  - file = open(dire + "Congress.gz", "wb")
    1475  - print("\r\n[+] downloading Congress.gz...")
    1476  - ftp.retrbinary("RETR " + "Congress.gz", handleDownload)
    1477  - filequitter()
    1478  - 
    1479  - file = open(dire + "Family-Names.gz", "wb")
    1480  - print("\r\n[+] downloading Family-Names.gz...")
    1481  - ftp.retrbinary("RETR " + "Family-Names.gz", handleDownload)
    1482  - filequitter()
    1483  - 
    1484  - file = open(dire + "Given-Names.gz", "wb")
    1485  - print("\r\n[+] downloading Given-Names.gz...")
    1486  - ftp.retrbinary("RETR " + "Given-Names.gz", handleDownload)
    1487  - filequitter()
    1488  - 
    1489  - file = open(dire + "actor-givenname.gz", "wb")
    1490  - print("\r\n[+] downloading actor-givenname.gz...")
    1491  - ftp.retrbinary("RETR " + "actor-givenname.gz", handleDownload)
    1492  - filequitter()
    1493  - 
    1494  - file = open(dire + "actor-surname.gz", "wb")
    1495  - print("\r\n[+] downloading actor-surname.gz...")
    1496  - ftp.retrbinary("RETR " + "actor-surname.gz", handleDownload)
    1497  - filequitter()
    1498  - 
    1499  - file = open(dire + "cis-givenname.gz", "wb")
    1500  - print("\r\n[+] downloading cis-givenname.gz...")
    1501  - ftp.retrbinary("RETR " + "cis-givenname.gz", handleDownload)
    1502  - filequitter()
    1503  - 
    1504  - file = open(dire + "cis-surname.gz", "wb")
    1505  - print("\r\n[+] downloading cis-surname.gz...")
    1506  - ftp.retrbinary("RETR " + "cis-surname.gz", handleDownload)
    1507  - filequitter()
    1508  - 
    1509  - file = open(dire + "crl-names.gz", "wb")
    1510  - print("\r\n[+] downloading crl-names.gz...")
    1511  - ftp.retrbinary("RETR " + "crl-names.gz", handleDownload)
    1512  - filequitter()
    1513  - 
    1514  - file = open(dire + "famous.gz", "wb")
    1515  - print("\r\n[+] downloading famous.gz...")
    1516  - ftp.retrbinary("RETR " + "famous.gz", handleDownload)
    1517  - filequitter()
    1518  - 
    1519  - file = open(dire + "fast-names.gz", "wb")
    1520  - print("\r\n[+] downloading fast-names.gz...")
    1521  - ftp.retrbinary("RETR " + "fast-names.gz", handleDownload)
    1522  - filequitter()
    1523  - 
    1524  - file = open(dire + "female-names-kantr.gz", "wb")
    1525  - print("\r\n[+] downloading female-names-kantr.gz...")
    1526  - ftp.retrbinary("RETR " + "female-names-kantr.gz", handleDownload)
    1527  - filequitter()
    1528  - 
    1529  - file = open(dire + "female-names.gz", "wb")
    1530  - print("\r\n[+] downloading female-names.gz...")
    1531  - ftp.retrbinary("RETR " + "female-names.gz", handleDownload)
    1532  - filequitter()
    1533  - 
    1534  - file = open(dire + "givennames-ol.gz", "wb")
    1535  - print("\r\n[+] downloading givennames-ol.gz...")
    1536  - ftp.retrbinary("RETR " + "givennames-ol.gz", handleDownload)
    1537  - filequitter()
    1538  - 
    1539  - file = open(dire + "male-names-kantr.gz", "wb")
    1540  - print("\r\n[+] downloading male-names-kantr.gz...")
    1541  - ftp.retrbinary("RETR " + "male-names-kantr.gz", handleDownload)
    1542  - filequitter()
    1543  - 
    1544  - file = open(dire + "male-names.gz", "wb")
    1545  - print("\r\n[+] downloading male-names.gz...")
    1546  - ftp.retrbinary("RETR " + "male-names.gz", handleDownload)
    1547  - filequitter()
    1548  - 
    1549  - file = open(dire + "movie-characters.gz", "wb")
    1550  - print("\r\n[+] downloading movie-characters.gz...")
    1551  - ftp.retrbinary("RETR " + "movie-characters.gz", handleDownload)
    1552  - filequitter()
    1553  - 
    1554  - file = open(dire + "names.french.gz", "wb")
    1555  - print("\r\n[+] downloading names.french.gz...")
    1556  - ftp.retrbinary("RETR " + "names.french.gz", handleDownload)
    1557  - filequitter()
    1558  - 
    1559  - file = open(dire + "names.hp.gz", "wb")
    1560  - print("\r\n[+] downloading names.hp.gz...")
    1561  - ftp.retrbinary("RETR " + "names.hp.gz", handleDownload)
    1562  - filequitter()
    1563  - 
    1564  - file = open(dire + "other-names.gz", "wb")
    1565  - print("\r\n[+] downloading other-names.gz...")
    1566  - ftp.retrbinary("RETR " + "other-names.gz", handleDownload)
    1567  - filequitter()
    1568  - 
    1569  - file = open(dire + "shakesp-names.gz", "wb")
    1570  - print("\r\n[+] downloading shakesp-names.gz...")
    1571  - ftp.retrbinary("RETR " + "shakesp-names.gz", handleDownload)
    1572  - filequitter()
    1573  - 
    1574  - file = open(dire + "surnames-ol.gz", "wb")
    1575  - print("\r\n[+] downloading surnames-ol.gz...")
    1576  - ftp.retrbinary("RETR " + "surnames-ol.gz", handleDownload)
    1577  - filequitter()
    1578  - 
    1579  - file = open(dire + "surnames.finnish.gz", "wb")
    1580  - print("\r\n[+] downloading surnames.finnish.gz...")
    1581  - ftp.retrbinary("RETR " + "surnames.finnish.gz", handleDownload)
    1582  - filequitter()
     1232 + files_to_download = {
     1233 + "ASSurnames.gz",
     1234 + "Congress.gz",
     1235 + "Family-Names.gz",
     1236 + "Given-Names.gz",
     1237 + "actor-givenname.gz",
     1238 + "actor-surname.gz",
     1239 + "cis-givenname.gz",
     1240 + "cis-surname.gz",
     1241 + "crl-names.gz",
     1242 + "famous.gz",
     1243 + "fast-names.gz",
     1244 + "female-names-kantr.gz",
     1245 + "female-names.gz",
     1246 + "givennames-ol.gz",
     1247 + "male-names-kantr.gz",
     1248 + "male-names.gz",
     1249 + "movie-characters.gz",
     1250 + "names.french.gz",
     1251 + "names.hp.gz",
     1252 + "other-names.gz",
     1253 + "shakesp-names.gz",
     1254 + "surnames-ol.gz",
     1255 + "surnames.finnish.gz",
     1256 + "usenet-names.gz",
     1257 + }
    1583 1258   
    1584  - file = open(dire + "usenet-names.gz", "wb")
    1585  - print("\r\n[+] downloading usenet-names.gz...")
    1586  - ftp.retrbinary("RETR " + "usenet-names.gz", handleDownload)
    1587  - filequitter()
     1259 + # download the files
     1260 + retr_file_list(ftp, dire, files_to_download)
    1588 1261   
    1589 1262   print("[+] files saved to " + dire)
    1590 1263   ftp.quit()
    1591 1264   exit()
    1592 1265   
    1593  - if filedown == "25":
     1266 + elif filedown == "25":
    1594 1267   print("[+] connecting...")
    1595 1268   ftp = ftplib.FTP(ftpurl)
    1596 1269   downloader()
    skipped 2 lines
    1599 1272   os.mkdir("dictionaries/net/")
    1600 1273   dire = "dictionaries/net/"
    1601 1274   
    1602  - file = open(dire + "hosts-txt.gz", "wb")
    1603  - print("\r\n[+] downloading hosts-txt.gz...")
    1604  - ftp.retrbinary("RETR " + "hosts-txt.gz", handleDownload)
    1605  - filequitter()
     1275 + files_to_download = {
     1276 + "hosts-txt.gz",
     1277 + "inet-machines.gz",
     1278 + "usenet-loginids.gz",
     1279 + "usenet-machines.gz",
     1280 + "uunet-sites.gz",
     1281 + }
    1606 1282   
    1607  - file = open(dire + "inet-machines.gz", "wb")
    1608  - print("\r\n[+] downloading inet-machines.gz...")
    1609  - ftp.retrbinary("RETR " + "inet-machines.gz", handleDownload)
    1610  - filequitter()
    1611  - 
    1612  - file = open(dire + "usenet-loginids.gz", "wb")
    1613  - print("\r\n[+] downloading usenet-loginids.gz...")
    1614  - ftp.retrbinary("RETR " + "usenet-loginids.gz", handleDownload)
    1615  - filequitter()
    1616  - 
    1617  - file = open(dire + "usenet-machines.gz", "wb")
    1618  - print("\r\n[+] downloading usenet-machines.gz...")
    1619  - ftp.retrbinary("RETR " + "usenet-machines.gz", handleDownload)
    1620  - filequitter()
    1621  - 
    1622  - file = open(dire + "uunet-sites.gz", "wb")
    1623  - print("\r\n[+] downloading uunet-sites.gz...")
    1624  - ftp.retrbinary("RETR " + "uunet-sites.gz", handleDownload)
    1625  - filequitter()
     1283 + # download the files
     1284 + retr_file_list(ftp, dire, files_to_download)
    1626 1285   
    1627 1286   print("[+] files saved to " + dire)
    1628 1287   ftp.quit()
    1629 1288   exit()
    1630 1289   
    1631  - if filedown == "26":
     1290 + elif filedown == "26":
    1632 1291   print("[+] connecting...")
    1633 1292   ftp = ftplib.FTP(ftpurl)
    1634 1293   downloader()
    skipped 2 lines
    1637 1296   os.mkdir("dictionaries/norwegian/")
    1638 1297   dire = "dictionaries/norwegian/"
    1639 1298   
    1640  - file = open(dire + "words.norwegian.gz", "wb")
    1641  - print("\r\n[+] downloading words.norwegian.gz...")
    1642  - ftp.retrbinary("RETR " + "words.norwegian.gz", handleDownload)
    1643  - filequitter()
     1299 + retr_binary_file(ftp, dire, "words.norwegian.gz")
    1644 1300   
    1645 1301   print("[+] file saved to " + dire)
    1646 1302   ftp.quit()
    1647 1303   exit()
    1648 1304   
    1649  - if filedown == "27":
     1305 + elif filedown == "27":
    1650 1306   print("[+] connecting...")
    1651 1307   ftp = ftplib.FTP(ftpurl)
    1652 1308   downloader()
    skipped 2 lines
    1655 1311   os.mkdir("dictionaries/places/")
    1656 1312   dire = "dictionaries/places/"
    1657 1313   
    1658  - file = open(dire + "Colleges.gz", "wb")
    1659  - print("\r\n[+] downloading Colleges.gz...")
    1660  - ftp.retrbinary("RETR " + "Colleges.gz", handleDownload)
    1661  - filequitter()
     1314 + files_to_download = {
     1315 + "Colleges.gz",
     1316 + "US-counties.gz",
     1317 + "World.factbook.gz",
     1318 + "Zipcodes.gz",
     1319 + "places.gz",
     1320 + }
    1662 1321   
    1663  - file = open(dire + "US-counties.gz", "wb")
    1664  - print("\r\n[+] downloading US-counties.gz...")
    1665  - ftp.retrbinary("RETR " + "US-counties.gz", handleDownload)
    1666  - filequitter()
    1667  - 
    1668  - file = open(dire + "World.factbook.gz", "wb")
    1669  - print("\r\n[+] downloading World.factbook.gz...")
    1670  - ftp.retrbinary("RETR " + "World.factbook.gz", handleDownload)
    1671  - filequitter()
    1672  - 
    1673  - file = open(dire + "Zipcodes.gz", "wb")
    1674  - print("\r\n[+] downloading Zipcodes.gz...")
    1675  - ftp.retrbinary("RETR " + "Zipcodes.gz", handleDownload)
    1676  - filequitter()
    1677  - 
    1678  - file = open(dire + "places.gz", "wb")
    1679  - print("\r\n[+] downloading places.gz...")
    1680  - ftp.retrbinary("RETR " + "places.gz", handleDownload)
    1681  - filequitter()
     1322 + # download the files
     1323 + retr_file_list(ftp, dire, files_to_download)
    1682 1324   
    1683 1325   print("[+] files saved to " + dire)
    1684 1326   ftp.quit()
    1685 1327   exit()
    1686 1328   
    1687  - if filedown == "28":
     1329 + elif filedown == "28":
    1688 1330   print("[+] connecting...")
    1689 1331   ftp = ftplib.FTP(ftpurl)
    1690 1332   downloader()
    skipped 2 lines
    1693 1335   os.mkdir("dictionaries/polish/")
    1694 1336   dire = "dictionaries/polish/"
    1695 1337   
    1696  - file = open(dire + "words.polish.gz", "wb")
    1697  - print("\r\n[+] downloading words.polish.gz...")
    1698  - ftp.retrbinary("RETR " + "words.polish.gz", handleDownload)
    1699  - filequitter()
     1338 + retr_binary_file(ftp, dire, "words.polish.gz")
    1700 1339   
    1701 1340   print("[+] file saved to " + dire)
    1702 1341   ftp.quit()
    1703 1342   exit()
    1704 1343   
    1705  - if filedown == "29":
     1344 + elif filedown == "29":
    1706 1345   print("[+] connecting...")
    1707 1346   ftp = ftplib.FTP(ftpurl)
    1708 1347   downloader()
    skipped 2 lines
    1711 1350   os.mkdir("dictionaries/random/")
    1712 1351   dire = "dictionaries/random/"
    1713 1352   
    1714  - file = open(dire + "Ethnologue.gz", "wb")
    1715  - print("\r\n[+] downloading Ethnologue.gz...")
    1716  - ftp.retrbinary("RETR " + "Ethnologue.gz", handleDownload)
    1717  - filequitter()
    1718  - 
    1719  - file = open(dire + "abbr.gz", "wb")
    1720  - print("\r\n[+] downloading abbr.gz...")
    1721  - ftp.retrbinary("RETR " + "abbr.gz", handleDownload)
    1722  - filequitter()
    1723  - 
    1724  - file = open(dire + "chars.gz", "wb")
    1725  - print("\r\n[+] downloading chars.gz...")
    1726  - ftp.retrbinary("RETR " + "chars.gz", handleDownload)
    1727  - filequitter()
    1728  - 
    1729  - file = open(dire + "dogs.gz", "wb")
    1730  - print("\r\n[+] downloading dogs.gz...")
    1731  - ftp.retrbinary("RETR " + "dogs.gz", handleDownload)
    1732  - filequitter()
     1353 + files_to_download = {
     1354 + "Ethnologue.gz",
     1355 + "abbr.gz",
     1356 + "chars.gz",
     1357 + "dogs.gz",
     1358 + "drugs.gz",
     1359 + "junk.gz",
     1360 + "numbers.gz",
     1361 + "phrases.gz",
     1362 + "sports.gz",
     1363 + "statistics.gz",
     1364 + }
    1733 1365   
    1734  - file = open(dire + "drugs.gz", "wb")
    1735  - print("\r\n[+] downloading drugs.gz...")
    1736  - ftp.retrbinary("RETR " + "drugs.gz", handleDownload)
    1737  - filequitter()
    1738  - 
    1739  - file = open(dire + "junk.gz", "wb")
    1740  - print("\r\n[+] downloading junk.gz...")
    1741  - ftp.retrbinary("RETR " + "junk.gz", handleDownload)
    1742  - filequitter()
    1743  - 
    1744  - file = open(dire + "numbers.gz", "wb")
    1745  - print("\r\n[+] downloading numbers.gz...")
    1746  - ftp.retrbinary("RETR " + "numbers.gz", handleDownload)
    1747  - filequitter()
    1748  - 
    1749  - file = open(dire + "phrases.gz", "wb")
    1750  - print("\r\n[+] downloading phrases.gz...")
    1751  - ftp.retrbinary("RETR " + "phrases.gz", handleDownload)
    1752  - filequitter()
    1753  - 
    1754  - file = open(dire + "sports.gz", "wb")
    1755  - print("\r\n[+] downloading sports.gz...")
    1756  - ftp.retrbinary("RETR " + "sports.gz", handleDownload)
    1757  - filequitter()
    1758  - 
    1759  - file = open(dire + "statistics.gz", "wb")
    1760  - print("\r\n[+] downloading statistics.gz...")
    1761  - ftp.retrbinary("RETR " + "statistics.gz", handleDownload)
    1762  - filequitter()
     1366 + # download the files
     1367 + retr_file_list(ftp, dire, files_to_download)
    1763 1368   
    1764 1369   print("[+] files saved to " + dire)
    1765 1370   ftp.quit()
    1766 1371   exit()
    1767 1372   
    1768  - if filedown == "30":
     1373 + elif filedown == "30":
    1769 1374   print("[+] connecting...")
    1770 1375   ftp = ftplib.FTP(ftpurl)
    1771 1376   downloader()
    skipped 2 lines
    1774 1379   os.mkdir("dictionaries/religion/")
    1775 1380   dire = "dictionaries/religion/"
    1776 1381   
    1777  - file = open(dire + "Koran.gz", "wb")
    1778  - print("\r\n[+] downloading Koran.gz...")
    1779  - ftp.retrbinary("RETR " + "Koran.gz", handleDownload)
    1780  - filequitter()
     1382 + files_to_download = {"Koran.gz", "kjbible.gz", "norse.gz"}
    1781 1383   
    1782  - file = open(dire + "kjbible.gz", "wb")
    1783  - print("\r\n[+] downloading kjbible.gz...")
    1784  - ftp.retrbinary("RETR " + "kjbible.gz", handleDownload)
    1785  - filequitter()
    1786  - 
    1787  - file = open(dire + "norse.gz", "wb")
    1788  - print("\r\n[+] downloading norse.gz...")
    1789  - ftp.retrbinary("RETR " + "norse.gz", handleDownload)
    1790  - filequitter()
     1384 + # download the files
     1385 + retr_file_list(ftp, dire, files_to_download)
    1791 1386   
    1792 1387   print("[+] files saved to " + dire)
    1793 1388   ftp.quit()
    1794 1389   exit()
    1795 1390   
    1796  - if filedown == "31":
     1391 + elif filedown == "31":
    1797 1392   print("[+] connecting...")
    1798 1393   ftp = ftplib.FTP(ftpurl)
    1799 1394   downloader()
    skipped 2 lines
    1802 1397   os.mkdir("dictionaries/russian/")
    1803 1398   dire = "dictionaries/russian/"
    1804 1399   
    1805  - file = open(dire + "russian.lst.gz", "wb")
    1806  - print("\r\n[+] downloading russian.lst.gz...")
    1807  - ftp.retrbinary("RETR " + "russian.lst.gz", handleDownload)
    1808  - filequitter()
    1809  - 
    1810  - file = open(dire + "russian_words.koi8.gz", "wb")
    1811  - print("\r\n[+] downloading russian_words.koi8.gz...")
    1812  - ftp.retrbinary("RETR " + "russian_words.koi8.gz", handleDownload)
    1813  - filequitter()
     1400 + retr_binary_file(ftp, dire, "russian.lst.gz")
     1401 + retr_binary_file(ftp, dire, "russian_words.koi8.gz")
    1814 1402   
    1815 1403   print("[+] files saved to " + dire)
    1816 1404   ftp.quit()
    1817 1405   exit()
    1818 1406   
    1819  - if filedown == "32":
     1407 + elif filedown == "32":
    1820 1408   print("[+] connecting...")
    1821 1409   ftp = ftplib.FTP(ftpurl)
    1822 1410   downloader()
    skipped 2 lines
    1825 1413   os.mkdir("dictionaries/science/")
    1826 1414   dire = "dictionaries/science/"
    1827 1415   
    1828  - file = open(dire + "Acr-diagnosis.gz", "wb")
    1829  - print("\r\n[+] downloading Acr-diagnosis.gz...")
    1830  - ftp.retrbinary("RETR " + "Acr-diagnosis.gz", handleDownload)
    1831  - filequitter()
    1832  - 
    1833  - file = open(dire + "Algae.gz", "wb")
    1834  - print("\r\n[+] downloading Algae.gz...")
    1835  - ftp.retrbinary("RETR " + "Algae.gz", handleDownload)
    1836  - filequitter()
    1837  - 
    1838  - file = open(dire + "Bacteria.gz", "wb")
    1839  - print("\r\n[+] downloading Bacteria.gz...")
    1840  - ftp.retrbinary("RETR " + "Bacteria.gz", handleDownload)
    1841  - filequitter()
    1842  - 
    1843  - file = open(dire + "Fungi.gz", "wb")
    1844  - print("\r\n[+] downloading Fungi.gz...")
    1845  - ftp.retrbinary("RETR " + "Fungi.gz", handleDownload)
    1846  - filequitter()
    1847  - 
    1848  - file = open(dire + "Microalgae.gz", "wb")
    1849  - print("\r\n[+] downloading Microalgae.gz...")
    1850  - ftp.retrbinary("RETR " + "Microalgae.gz", handleDownload)
    1851  - filequitter()
    1852  - 
    1853  - file = open(dire + "Viruses.gz", "wb")
    1854  - print("\r\n[+] downloading Viruses.gz...")
    1855  - ftp.retrbinary("RETR " + "Viruses.gz", handleDownload)
    1856  - filequitter()
    1857  - 
    1858  - file = open(dire + "asteroids.gz", "wb")
    1859  - print("\r\n[+] downloading asteroids.gz...")
    1860  - ftp.retrbinary("RETR " + "asteroids.gz", handleDownload)
    1861  - filequitter()
    1862  - 
    1863  - file = open(dire + "biology.gz", "wb")
    1864  - print("\r\n[+] downloading biology.gz...")
    1865  - ftp.retrbinary("RETR " + "biology.gz", handleDownload)
    1866  - filequitter()
     1416 + files_to_download = {
     1417 + "Acr-diagnosis.gz",
     1418 + "Algae.gz",
     1419 + "Bacteria.gz",
     1420 + "Fungi.gz",
     1421 + "Microalgae.gz",
     1422 + "Viruses.gz",
     1423 + "asteroids.gz",
     1424 + "biology.gz",
     1425 + "tech.gz",
     1426 + }
    1867 1427   
    1868  - file = open(dire + "tech.gz", "wb")
    1869  - print("\r\n[+] downloading tech.gz...")
    1870  - ftp.retrbinary("RETR " + "tech.gz", handleDownload)
    1871  - filequitter()
     1428 + # download the files
     1429 + retr_file_list(ftp, dire, files_to_download)
    1872 1430   
    1873 1431   print("[+] files saved to " + dire)
    1874 1432   ftp.quit()
    1875 1433   exit()
    1876 1434   
    1877  - if filedown == "33":
     1435 + elif filedown == "33":
    1878 1436   print("[+] connecting...")
    1879 1437   ftp = ftplib.FTP(ftpurl)
    1880 1438   downloader()
    skipped 2 lines
    1883 1441   os.mkdir("dictionaries/spanish/")
    1884 1442   dire = "dictionaries/spanish/"
    1885 1443   
    1886  - file = open(dire + "words.spanish.gz", "wb")
    1887  - print("\r\n[+] downloading words.spanish.gz...")
    1888  - ftp.retrbinary("RETR " + "words.spanish.gz", handleDownload)
    1889  - filequitter()
     1444 + retr_binary_file(ftp, dire, "words.spanish.gz")
    1890 1445   
    1891 1446   print("[+] file saved to " + dire)
    1892 1447   ftp.quit()
    1893 1448   exit()
    1894 1449   
    1895  - if filedown == "34":
     1450 + elif filedown == "34":
    1896 1451   print("[+] connecting...")
    1897 1452   ftp = ftplib.FTP(ftpurl)
    1898 1453   downloader()
    skipped 2 lines
    1901 1456   os.mkdir("dictionaries/swahili/")
    1902 1457   dire = "dictionaries/swahili/"
    1903 1458   
    1904  - file = open(dire + "swahili.gz", "wb")
    1905  - print("\r\n[+] downloading swahili.gz...")
    1906  - ftp.retrbinary("RETR " + "swahili.gz", handleDownload)
    1907  - filequitter()
     1459 + retr_binary_file(ftp, dire, "swahili.gz")
    1908 1460   
    1909 1461   print("[+] file saved to " + dire)
    1910 1462   ftp.quit()
    1911 1463   exit()
    1912 1464   
    1913  - if filedown == "35":
     1465 + elif filedown == "35":
    1914 1466   print("[+] connecting...")
    1915 1467   ftp = ftplib.FTP(ftpurl)
    1916 1468   downloader()
    skipped 2 lines
    1919 1471   os.mkdir("dictionaries/swedish/")
    1920 1472   dire = "dictionaries/swedish/"
    1921 1473   
    1922  - file = open(dire + "words.swedish.gz", "wb")
    1923  - print("\r\n[+] downloading words.swedish.gz...")
    1924  - ftp.retrbinary("RETR " + "words.swedish.gz", handleDownload)
    1925  - filequitter()
     1474 + retr_binary_file(ftp, dire, "words.swedish.gz")
    1926 1475   
    1927 1476   print("[+] file saved to " + dire)
    1928 1477   ftp.quit()
    1929 1478   exit()
    1930 1479   
    1931  - if filedown == "36":
     1480 + elif filedown == "36":
    1932 1481   print("[+] connecting...")
    1933 1482   ftp = ftplib.FTP(ftpurl)
    1934 1483   downloader()
    skipped 2 lines
    1937 1486   os.mkdir("dictionaries/turkish/")
    1938 1487   dire = "dictionaries/turkish/"
    1939 1488   
    1940  - file = open(dire + "turkish.dict.gz", "wb")
    1941  - print("\r\n[+] downloading turkish.dict.gz...")
    1942  - ftp.retrbinary("RETR " + "turkish.dict.gz", handleDownload)
    1943  - filequitter()
     1489 + retr_binary_file(ftp, dire, "turkish.dict.gz")
    1944 1490   
    1945 1491   print("[+] file saved to " + dire)
    1946 1492   ftp.quit()
    1947 1493   exit()
    1948 1494   
    1949  - if filedown == "37":
     1495 + elif filedown == "37":
    1950 1496   print("[+] connecting...")
    1951 1497   ftp = ftplib.FTP(ftpurl)
    1952 1498   downloader()
    skipped 2 lines
    1955 1501   os.mkdir("dictionaries/yiddish/")
    1956 1502   dire = "dictionaries/yiddish/"
    1957 1503   
    1958  - file = open(dire + "yiddish.gz", "wb")
    1959  - print("\r\n[+] downloading yiddish.gz...")
    1960  - ftp.retrbinary("RETR " + "yiddish.gz", handleDownload)
    1961  - filequitter()
     1504 + retr_binary_file(ftp, dire, "yiddish.gz")
    1962 1505   
    1963 1506   print("[+] file saved to " + dire)
    1964 1507   ftp.quit()
    skipped 12 lines
Please wait...
Page is in error, reload to recover