0

I'm writing some python code to test a link with a bunch of different permutations of the possible characters heres my code:

from selenium import webdriver
driver = webdriver.chrome()
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
numatts = int(input("How Many Times To Attempt? >> "))

for i in range(numatts):
    driver.open("LINKHERE" + "/" + "Each permutation")
    #Code Stuff....

For Example, If LINKHERE is 'google.com', and numatts = 27, I want the output:

google.com/A
google.com/B
google.com/C
google.com/D
google.com/E
google.com/F
google.com/G
google.com/H
google.com/I
google.com/J
google.com/K
google.com/L
google.com/M
google.com/N
google.com/O
google.com/P
google.com/Q
google.com/R
google.com/S
google.com/T
google.com/U
google.com/V
google.com/W
google.com/X
google.com/Y
google.com/Z
google.com/AA
.
.
.

and for longer strings, like "test".

google.com/t
google.com/et
google.com/est
google.com/tset

(and more) would all be a part of the output

TullyYT
  • 9
  • 5
  • Loop over the lengths. So first get all the permutations of length 1, then all the permutations of length 2, and so on. – Barmar Nov 16 '22 at 22:53
  • 1
    If you want permutations, have a look at `itertools.permutations`. – John Gordon Nov 16 '22 at 22:53
  • I believe the thing you are looking for is a powerset. Please, [see here](https://stackoverflow.com/questions/1482308/how-to-get-all-subsets-of-a-set-powerset) – Nazar Nintendo Nov 16 '22 at 22:55
  • I wasn't able to effectively implement powersets, but I found someone else who wrote code that has the same idea as mine, just executed differently (the idea of the code doesn't matter, this matter has been resolved, for my case at least, someone else might need this) – TullyYT Nov 16 '22 at 23:26

0 Answers0