Python Forum
Brute Force Pad Lock Guesser
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Brute Force Pad Lock Guesser
#1
I'm trying to learn how to have more control over increments, but I have a delema (see comments in following code):

#!/usr/bin/env python3
#PadLockGuesser.py

lockCombo = 1080

#brute force pad lock guesser with while loop:
guess = 0
while guess != lockCombo:
    #guess += 1#placing the guess incrementor here causes 0 to not be one of the guesses
    if guess == lockCombo:
        print("After " + str(guess) + " guesses, the correct combo is " + str(guess))
        break
    else:
        print(str(guess) + " is not the correct combo. Trying next guess.")
        guess += 1#placing the guess incrementor here causes the program to stop guessing at 1079
        continue

#brute force pad lock guesser with for loop:
guessAgain = 0
for i in range(0000,9999):
    if guessAgain == lockCombo:
        print("After " + str(guessAgain) + " guesses, the correct combo is " + str(guessAgain))
        break
    else:
        print(str(guessAgain) + " is not the correct combo. Trying next guess.")
        guessAgain += 1
The output of the for loop, however, is correct:
Output:
0 is not the correct combo. Trying next guess. 1 is not the correct combo. Trying next guess. 2 is not the correct combo. Trying next guess. 3 is not the correct combo. Trying next guess. ... 1077 is not the correct combo. Trying next guess. 1078 is not the correct combo. Trying next guess. 1079 is not the correct combo. Trying next guess. After 1080 guesses, the correct combo is 1080
How do I get the while loop to produce the same output?
Reply


Messages In This Thread
Brute Force Pad Lock Guesser - by RedSkeleton007 - Feb-25-2018, 06:23 AM
RE: Brute Force Pad Lock Guesser - by ka06059 - Feb-26-2018, 06:48 AM
RE: Brute Force Pad Lock Guesser - by buran - Feb-28-2018, 11:53 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need an alternative to brute force optimization loop jmbonni 5 1,289 Dec-07-2023, 12:28 PM
Last Post: RockBlok
  Solving an equation by brute force within a range alexfrol86 3 2,883 Aug-09-2022, 09:44 AM
Last Post: Gribouillis
  force a program to exit ? Armandito 3 2,618 May-12-2022, 04:03 PM
Last Post: Gribouillis
  How to use scipy.optimization.brute for multivariable function Shiladitya 9 6,385 Oct-28-2020, 10:40 PM
Last Post: scidam
  best way to force an exception Skaperen 2 2,104 Oct-21-2020, 05:59 AM
Last Post: Gribouillis
  I need advise with developing a brute forcing script fatjuicypython 11 5,237 Aug-21-2020, 09:20 PM
Last Post: Marbelous
  Cant find root cause of thread.lock error burlyboys 0 1,578 May-18-2020, 12:51 PM
Last Post: burlyboys
  Force calculation result as decimal vercetty92 4 2,929 Mar-20-2019, 02:27 PM
Last Post: vercetty92
  Password Brute Force 2skywalkers 9 5,471 Oct-18-2018, 02:35 PM
Last Post: buran
  Brute Force Password Guesser 2skywalkers 1 3,233 Oct-05-2018, 08:04 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020