Advertisement
Guest User

Untitled

a guest
Feb 1st, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. import mechanize
  2. import cookielib
  3. from BeautifulSoup import BeautifulSoup
  4. import html2text
  5.  
  6. usr = raw_input("Username: ")
  7. pas = raw_input("Pass: ")
  8.  
  9. # Browser
  10. br = mechanize.Browser()
  11.  
  12. # Cookie Jar
  13. cj = cookielib.LWPCookieJar()
  14. br.set_cookiejar(cj)
  15.  
  16. # Browser options
  17. br.set_handle_equiv(True)
  18. br.set_handle_gzip(True)
  19. br.set_handle_redirect(True)
  20. br.set_handle_referer(True)
  21. br.set_handle_robots(False)
  22. br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
  23.  
  24. br.addheaders = [('User-agent', 'Chrome')]
  25.  
  26. # The site we will navigate into, handling it's session
  27. br.open('https://account.shodan.io/login')
  28.  
  29. # View available forms
  30. for f in br.forms():
  31. print(f)
  32.  
  33. # Select the second (index one) form (the first form is a search query box)
  34. br.select_form(nr=1)
  35.  
  36. # User credentials
  37. br.form['username'] = usr
  38. br.form['password'] = pas
  39.  
  40. # Login
  41. br.submit()
  42.  
  43. print(br.open('https://www.shodan.io/search?query=vuln%3Acve-2014-0160').read())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement