1
votes

I have a HTTP demonstration website with a login page that I need to write a script to find the correct password for the login which is located within a dictionary file I created of 500 words.

So far I just have the script where it opens my dictionary file and reads each line and have implemented a request.get also to if it matches the password it will print the word to the console basically saying I found the password

I need it to go through each word in the dictionary that has a single string on each line until it matches with the correct password that will return a string that contains 'Login' in, instead of it returning 'Wrong Username/password' which it has done when executing

import requests

with open("dictionary_500_words", 'r') as f:
    words = f.readlines()

for word in words:
  output = requests.get(f'http://p2.ditdemo.net/checklogin.php?myusername=usr&mypassword=${words }&Submit=Login')
  if "Login" in output.text:
    break
print(word)
print(output.text)

Screenshot of what is returned to the log.

1
1. Provide text, not screenshots. 2. Look very carefully what you set mypassword toDeepSpace
Okay and is it because of the $ infront of words? Even when removing it still displays the same thingAlex Ronde

1 Answers

0
votes

if you know what the "right" password should be and you can test it with the right outcome you can eliminate the possibility of it being the site

you can convert the url you are creating to a variable and print that and see if there are any issues with it, it looks like you're using ${words } (you dont need $ or the space) when all you need is {words}