do bruteforcing with python

I would like to do bruteforcing with python but with special parameters.
So far I got

import os
##########################

#########algarithm#########
x=0
for x in range(10,21):
 char=itertools.product("0123546798ABCDEFGHIJKLMNOPQRSTUVWXYZ#$qwertyuiopasdfghjklzxcvbnm",repeat=x)
 for pin in char:
  pinready=''.join(pin)
  print(pinready)

The problem is that it goes through each one and it takes too long.

I’d like for the first three characters to be either @,#,$ or A-Z

The next three to be A-Z,a-z

And the last 4 to be numbers

Is there a way I can customize the bruteforcing basically, please.

>Solution :

from random import choices
from string import ascii_lowercase, ascii_uppercase

letters = ascii_lowercase + ascii_uppercase
symbols = "@#$" # Add more here if required
numbers = "0123456789"

no_of_pins = 10

def generate_pin():
  a = choices(letters + symbols, k=3)
  b = choices(letters, k=3)
  c = choices(numbers, k=4)

  return "".join(a + b + c)

for i in range(no_of_pins):
  pin = generate_pin()
  print(pin)

Example output:

wPRgne7054
ijZdJl5401
NCLneF2148
fxMEKV4586
RBBeSH7274
GHwfuB4891
bcjKXj3297
DDGIZe0561
NYtLXj7352
$LOYCl4773

Leave a Reply