Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Check if the login password matches what I have specified

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
User avatar
cylon
Posts: 19
Joined: 2014-01-01 22:08

Check if the login password matches what I have specified

#1 Post by cylon »

I'm stuck and need some help to get through this. I'm trying to create a program that will go through a list (one word at each line) from the file pwdlst.txt and try to log-in with the passwords entered in the file. When the program tries with a password that matches the current one, the program will stop and print out "The password is: %s" % password. This is what I created so far:

Code: Select all

import urllib
import urllib2
import cookielib

cj = cookielib.CookieJar()

opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))

opener.addheaders.append(('User-agent', 'Mozilla/4.0'))
opener.addheaders.append(('Referer', 'http://www.example.com/index.php'))

def pwd():
	pwd = open('pwdlst.txt', 'r')
	return pwd.readlines()

usr_name = 'alex'
usr_password = pwd()

list(enumerate(usr_password, start = 1))

login_data = urllib.urlencode({'user_name': usr_name,
				       				'user_pass': usr_password,
				       				'login':	'Login'
				       				})

resp = opener.open('http://www.example2.com/wp-admin.php', login_data)

resp.close()

print pwd()
I'm not sure how to:
  • get the error and print when the log-in attempt is denied
  • go through the list (pwdlst.txt) and try each password one at a time
  • stop the program when the password matches

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Check if the login password matches what I have specifie

#2 Post by dasein »

Sounds like you may be trying to recreate John the Ripper?

(Just askin')

If you actually imagine running this "live" (as opposed to on a shadow file), you should expect to generate a lot of attention, not all of it necessarily good.

User avatar
cylon
Posts: 19
Joined: 2014-01-01 22:08

Re: Check if the login password matches what I have specifie

#3 Post by cylon »

dasein wrote:Sounds like you may be trying to recreate John the Ripper?

(Just askin')

If you actually imagine running this "live" (as opposed to on a shadow file), you should expect to generate a lot of attention, not all of it necessarily good.
Nah, I just want some practice and improve my coding for now. There are many scripts like this, but I thought maybe try creating one for myself. Any ideas how to accomplish this?

srxfanbz
Posts: 1
Joined: 2017-04-17 08:23

Re: Check if the login password matches what I have specifie

#4 Post by srxfanbz »

cylon wrote:
I'm not sure how to:
  • get the error and print when the log-in attempt is denied
  • go through the list (pwdlst.txt) and try each password one at a time
You can get the server response code with urllib2 api. then do proper actions based the code you received.

Kamlker
Posts: 1
Joined: 2017-09-01 08:08

Re: Check if the login password matches what I have specifie

#5 Post by Kamlker »

srxfanbz wrote:
cylon wrote:
I'm not sure how to:
https://www.recoverywindowspassword.com/unlock-windows-10-8-without-password.html
  • get the error and print when the log-in attempt is denied
  • go through the list (pwdlst.txt) and try each password one at a time
  • stop the program when the password matches
You can get the server response code with urllib2 api. then do proper actions based the code you received.
Yes , i agree with you

Post Reply