| skipped 155 lines |
156 | 156 | | """Implementation of the -w option. Improve a dictionary by |
157 | 157 | | interactively questioning the user.""" |
158 | 158 | | |
| 159 | + | kombinacija = {} |
| 160 | + | komb_unique = {} |
| 161 | + | |
159 | 162 | | if not os.path.isfile(file_to_open): |
160 | 163 | | exit("Error: file " + file_to_open + " does not exist.") |
161 | 164 | | |
| skipped 1 lines |
163 | 166 | | years = CONFIG["global"]["years"] |
164 | 167 | | numfrom = CONFIG["global"]["numfrom"] |
165 | 168 | | numto = CONFIG["global"]["numto"] |
166 | | - | wcto = CONFIG["global"]["wcto"] |
167 | | - | wcfrom = CONFIG["global"]["wcfrom"] |
168 | | - | threshold = CONFIG["global"]["threshold"] |
169 | 169 | | |
170 | 170 | | fajl = open(file_to_open, "r") |
171 | 171 | | listic = fajl.readlines() |
172 | | - | linije = 0 |
173 | | - | for line in listic: |
174 | | - | linije += 1 |
175 | | - | |
176 | 172 | | listica = [] |
177 | 173 | | for x in listic: |
178 | 174 | | listica += x.split() |
| skipped 8 lines |
187 | 183 | | "> Do you want to concatenate all words from wordlist? Y/[N]: " |
188 | 184 | | ).lower() |
189 | 185 | | |
190 | | - | if conts == "y" and linije > threshold: |
191 | | - | print("\r\n[-] Maximum number of words for concatenation is " + str(threshold)) |
| 186 | + | if conts == "y" and len(listic) > CONFIG["global"]["threshold"]: |
| 187 | + | print( |
| 188 | + | "\r\n[-] Maximum number of words for concatenation is " |
| 189 | + | + str(CONFIG["global"]["threshold"]) |
| 190 | + | ) |
192 | 191 | | print("[-] Check configuration file for increasing this number.\r\n") |
193 | 192 | | conts = input( |
194 | 193 | | "> Do you want to concatenate all words from wordlist? Y/[N]: " |
| skipped 23 lines |
218 | 217 | | ).lower() |
219 | 218 | | leetmode = input("> Leet mode? (i.e. leet = 1337) Y/[N]: ").lower() |
220 | 219 | | |
221 | | - | kombinacija1 = list(komb(listica, years)) |
222 | | - | kombinacija2 = [""] |
| 220 | + | # init |
| 221 | + | for i in range(6): |
| 222 | + | kombinacija[i] = [""] |
| 223 | + | |
| 224 | + | kombinacija[0] = list(komb(listica, years)) |
223 | 225 | | if conts == "y": |
224 | | - | kombinacija2 = list(komb(cont, years)) |
225 | | - | kombinacija3 = [""] |
226 | | - | kombinacija4 = [""] |
| 226 | + | kombinacija[1] = list(komb(cont, years)) |
227 | 227 | | if spechars1 == "y": |
228 | | - | kombinacija3 = list(komb(listica, spechars)) |
| 228 | + | kombinacija[2] = list(komb(listica, spechars)) |
229 | 229 | | if conts == "y": |
230 | | - | kombinacija4 = list(komb(cont, spechars)) |
231 | | - | kombinacija5 = [""] |
232 | | - | kombinacija6 = [""] |
| 230 | + | kombinacija[3] = list(komb(cont, spechars)) |
233 | 231 | | if randnum == "y": |
234 | | - | kombinacija5 = list(concats(listica, numfrom, numto)) |
| 232 | + | kombinacija[4] = list(concats(listica, numfrom, numto)) |
235 | 233 | | if conts == "y": |
236 | | - | kombinacija6 = list(concats(cont, numfrom, numto)) |
| 234 | + | kombinacija[5] = list(concats(cont, numfrom, numto)) |
237 | 235 | | |
238 | 236 | | print("\r\n[+] Now making a dictionary...") |
239 | 237 | | |
240 | 238 | | print("[+] Sorting list and removing duplicates...") |
241 | 239 | | |
242 | | - | komb_unique1 = list(dict.fromkeys(kombinacija1).keys()) |
243 | | - | komb_unique2 = list(dict.fromkeys(kombinacija2).keys()) |
244 | | - | komb_unique3 = list(dict.fromkeys(kombinacija3).keys()) |
245 | | - | komb_unique4 = list(dict.fromkeys(kombinacija4).keys()) |
246 | | - | komb_unique5 = list(dict.fromkeys(kombinacija5).keys()) |
247 | | - | komb_unique6 = list(dict.fromkeys(kombinacija6).keys()) |
248 | | - | komb_unique7 = list(dict.fromkeys(listica).keys()) |
249 | | - | komb_unique8 = list(dict.fromkeys(cont).keys()) |
| 240 | + | for i in range(6): |
| 241 | + | komb_unique[i] = list(dict.fromkeys(kombinacija[i]).keys()) |
250 | 242 | | |
251 | | - | uniqlist = ( |
252 | | - | komb_unique1 |
253 | | - | + komb_unique2 |
254 | | - | + komb_unique3 |
255 | | - | + komb_unique4 |
256 | | - | + komb_unique5 |
257 | | - | + komb_unique6 |
258 | | - | + komb_unique7 |
259 | | - | + komb_unique8 |
260 | | - | ) |
| 243 | + | komb_unique[6] = list(dict.fromkeys(listica).keys()) |
| 244 | + | komb_unique[7] = list(dict.fromkeys(cont).keys()) |
| 245 | + | |
| 246 | + | # join the lists |
| 247 | + | uniqlist = [] |
| 248 | + | for i in range(8): |
| 249 | + | uniqlist += komb_unique[i] |
261 | 250 | | |
262 | 251 | | unique_lista = list(dict.fromkeys(uniqlist).keys()) |
263 | 252 | | unique_leet = [] |
| skipped 10 lines |
274 | 263 | | |
275 | 264 | | unique_list_finished = [] |
276 | 265 | | |
277 | | - | unique_list_finished = [x for x in unique_list if len(x) > wcfrom and len(x) < wcto] |
| 266 | + | unique_list_finished = [ |
| 267 | + | x |
| 268 | + | for x in unique_list |
| 269 | + | if len(x) > CONFIG["global"]["wcfrom"] and len(x) < CONFIG["global"]["wcto"] |
| 270 | + | ] |
278 | 271 | | |
279 | 272 | | print_to_file(file_to_open + ".cupp.txt", unique_list_finished) |
280 | 273 | | |
| skipped 79 lines |
360 | 353 | | years = CONFIG["global"]["years"] |
361 | 354 | | numfrom = CONFIG["global"]["numfrom"] |
362 | 355 | | numto = CONFIG["global"]["numto"] |
363 | | - | wcto = CONFIG["global"]["wcto"] |
364 | | - | wcfrom = CONFIG["global"]["wcfrom"] |
365 | 356 | | |
366 | 357 | | profile["spechars"] = [] |
367 | 358 | | |
| skipped 313 lines |
681 | 672 | | unique_list = unique_lista + unique_leet |
682 | 673 | | |
683 | 674 | | unique_list_finished = [] |
684 | | - | unique_list_finished = [x for x in unique_list if len(x) < wcto and len(x) > wcfrom] |
| 675 | + | unique_list_finished = [ |
| 676 | + | x |
| 677 | + | for x in unique_list |
| 678 | + | if len(x) < CONFIG["global"]["wcto"] and len(x) > CONFIG["global"]["wcfrom"] |
| 679 | + | ] |
685 | 680 | | |
686 | 681 | | print_to_file(profile["name"] + ".txt", unique_list_finished) |
687 | 682 | | |
| skipped 387 lines |