#🔒 Help me to improve my code
36 messages · Page 1 of 1 (latest)
@left salmon
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
import time
Liste de tous les caractères possibles
all_characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ '
Fonction pour générer des combinaisons
def generate_combinations():
output = ''
length = 0
while True:
for char1 in all_characters:
for char2 in all_characters:
for char3 in all_characters:
for char4 in all_characters:
for char5 in all_characters:
for char6 in all_characters:
for char7 in all_characters:
for char8 in all_characters:
for char9 in all_characters:
for char10 in all_characters:
output += char1 + char2 + char3 + char4 + char5 + char6 + char7 + char8 + char9 + char10
length += 10
if length >= 10:
print(output)
output = ''
length = 0
time.sleep(0) # Attendre 2 secondes
Appel de la fonction pour générer des combinaisons infinies
generate_combinations()
this is my code
!code
brute force
yes
i want he show me the password
and be faster
This isn't for real work use right?
no
Brute force attacks are by nature very slow
i will usit for randomatation
looks like you want a cartesian product
use itertools.product
/itertools.product
!d itertools.product
itertools.product(*iterables, repeat=1)```
Cartesian product of input iterables.
Roughly equivalent to nested for-loops in a generator expression. For example, `product(A, B)` returns the same as `((x,y) for x in A for y in B)`.
The nested loops cycle like an odometer with the rightmost element advancing on every iteration. This pattern creates a lexicographic ordering so that if the input’s iterables are sorted, the product tuples are emitted in sorted order.
To compute the product of an iterable with itself, specify the number of repetitions with the optional *repeat* keyword argument. For example, `product(A, repeat=4)` means the same as `product(A, A, A, A)`.
how i usit
!e
from itertools import product
chars = "abc"
for char1, char2, char3 in product(chars, repeat=3):
print(char1, char2, char3)
@shut blade :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | a a a
002 | a a b
003 | a a c
004 | a b a
005 | a b b
006 | a b c
007 | a c a
008 | a c b
009 | a c c
010 | b a a
011 | b a b
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/OTSRO6ONWWOCDHAWJ4MXGCZKTQ
if C is the input set, then this returns the cartesian product set C^n where n is the repeat
you used an library
oh i will test it
its worked
i wanna creat an machine learning it s OBLIGATORY to use an library
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.