Implementation of the -w option. Improve a dictionary by interactively questioning the user.
(file_to_open)
| 175 | |
| 176 | |
| 177 | def improve_dictionary(file_to_open): |
| 178 | """Implementation of the -w option. Improve a dictionary by |
| 179 | interactively questioning the user.""" |
| 180 | |
| 181 | kombinacija = {} |
| 182 | komb_unique = {} |
| 183 | |
| 184 | if not os.path.isfile(file_to_open): |
| 185 | exit("Error: file " + file_to_open + " does not exist.") |
| 186 | |
| 187 | chars = CONFIG["global"]["chars"] |
| 188 | years = CONFIG["global"]["years"] |
| 189 | numfrom = CONFIG["global"]["numfrom"] |
| 190 | numto = CONFIG["global"]["numto"] |
| 191 | |
| 192 | fajl = open(file_to_open, "r") |
| 193 | listic = fajl.readlines() |
| 194 | listica = [] |
| 195 | for x in listic: |
| 196 | listica += x.split() |
| 197 | |
| 198 | print("\r\n *************************************************") |
| 199 | print(" * \033[1;31mWARNING!!!\033[1;m *") |
| 200 | print(" * Using large wordlists in some *") |
| 201 | print(" * options bellow is NOT recommended! *") |
| 202 | print(" *************************************************\r\n") |
| 203 | |
| 204 | conts = input( |
| 205 | "> Do you want to concatenate all words from wordlist? Y/[N]: " |
| 206 | ).lower() |
| 207 | |
| 208 | if conts == "y" and len(listic) > CONFIG["global"]["threshold"]: |
| 209 | print( |
| 210 | "\r\n[-] Maximum number of words for concatenation is " |
| 211 | + str(CONFIG["global"]["threshold"]) |
| 212 | ) |
| 213 | print("[-] Check configuration file for increasing this number.\r\n") |
| 214 | conts = input( |
| 215 | "> Do you want to concatenate all words from wordlist? Y/[N]: " |
| 216 | ).lower() |
| 217 | |
| 218 | cont = [""] |
| 219 | if conts == "y": |
| 220 | for cont1 in listica: |
| 221 | for cont2 in listica: |
| 222 | if listica.index(cont1) != listica.index(cont2): |
| 223 | cont.append(cont1 + cont2) |
| 224 | |
| 225 | spechars = [""] |
| 226 | spechars1 = input( |
| 227 | "> Do you want to add special chars at the end of words? Y/[N]: " |
| 228 | ).lower() |
| 229 | if spechars1 == "y": |
| 230 | for spec1 in chars: |
| 231 | spechars.append(spec1) |
| 232 | for spec2 in chars: |
| 233 | spechars.append(spec1 + spec2) |
| 234 | for spec3 in chars: |