Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading