Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.46 KB | None | 0 0
  1. #program to search for content containing "hidden" or "password"
  2.  
  3. # copy and past the urls for both isihack and dmva into \burplinks.txt
  4. import requests
  5.  
  6. #open file for reading containing the url links from Burp spider
  7. myinputfile = open ("burplinks.txt","r")
  8.  
  9. #open a file for writing information related to passwords found in the url links.
  10. mypasswordfile = open("passwordtext.txt","w")
  11.  
  12. #to do
  13. # - Use a for loop and readlines to read each url link from burplinks.txt.  
  14. # - Examine the string content returned by the url for the text "password". Your program must NOT be case sensitive when searching for "password" content.
  15. # - If the text "password" is found in the response text, write "password found" plus the url link and password text to passwordtext.txt
  16. # - Use new line "\n" in your passwordtext.txt file to write the url links and content to output separate lines.
  17. # - fyi - The answer key solution is five lines of code inlcuding the for loop.  Your solution may vary.
  18.  
  19.  
  20. ####################
  21.  
  22. # Loop through each URL in the file
  23. for line in myinputfile:
  24.    # Download the contents of the URL
  25.    res = requests.get(line)
  26.    # Store text and search
  27.    response = res.text
  28.    # Search for lower 'password' in all lower case response
  29.    lower = response.lower()
  30.    if lower.find('password') != -1:
  31.       mypasswordfile.write('password found: ' + line + ' ' + response + '\'')
  32.  
  33. #close open files
  34. myinputfile.close()
  35. mypasswordfile.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement