Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please help me!!!
#1
I have tried to create a simple password cracker in my own.I am new to programming.Here is the python code.My aim was to make the user to specify a wordlist that contain random passwords.Here is the my python code :-

******************************************************************************************************
jackpot=("linux")
name = input("Enter your name:- ")
wordlist = input("Enter wordlist file:- ")
wordlist = open(wordlist,"r")
for word in wordlist:
	if word==jackpot:
		print("[+]password found",name,":-",word)

	else:
		print("[!]incorrect password:-",word)
******************************************************************************************************

My wordlist.txt file consist of the following:-

hat
cat
dog
bot
banana
leaf
linux
bob
rat

My problem:-Python is showing me that all the password are incorrect.But still the real password is there in the wordlist.txt that's"linux"...Please help me Idea Idea Idea

Sorry guys in the above python code I forgot to indent. I corrected that mistake:-

jackpot=("linux")
name = input("Enter your name:- ")
wordlist = input("Enter wordlist file:- ")
wordlist = open(wordlist,"r")
for word in wordlist:
     if word==jackpot:
          print("[+]password found",name,":-",word)

     else:
          print("[!]incorrect password:-",word)
someone please help me....
Reply
#2
Quote:Sorry guys in the above python code I forgot to indent. I corrected that mistake:-

Use Python code tags for proper code formatting (help page link).

Most probable cause for this is that each line of the text in your file ends with endline character, which is '\n'.
To find out simply add a print statement in your loop to see each "word" read from the file.
If that is the problem, solution is to use the rstrip('\'), rstrip being the string method.
Reply
#3
j.crater could you show me the code where I made the mistake.It keeps on printing "incorrect password" for every password in wordlist.txt file...
Reply
#4
I recommend you to try the suggestion with printing the "word" variable when you scan the file.
That way you will also gain insight in your code and learn the simplest and most commonly used debugging technique.
Afterall, we don't see the value of your "word" variable and thus can't tell you why the comparison fails.
Reply


Forum Jump:

User Panel Messages

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