Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import mechanize
- import cookielib
- from BeautifulSoup import BeautifulSoup
- import html2text
- usr = raw_input("Username: ")
- pas = raw_input("Pass: ")
- # Browser
- br = mechanize.Browser()
- # Cookie Jar
- cj = cookielib.LWPCookieJar()
- br.set_cookiejar(cj)
- # Browser options
- br.set_handle_equiv(True)
- br.set_handle_gzip(True)
- br.set_handle_redirect(True)
- br.set_handle_referer(True)
- br.set_handle_robots(False)
- br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
- br.addheaders = [('User-agent', 'Chrome')]
- # The site we will navigate into, handling it's session
- br.open('https://account.shodan.io/login')
- # View available forms
- for f in br.forms():
- print(f)
- # Select the second (index one) form (the first form is a search query box)
- br.select_form(nr=1)
- # User credentials
- br.form['username'] = usr
- br.form['password'] = pas
- # Login
- br.submit()
- print(br.open('https://www.shodan.io/search?query=vuln%3Acve-2014-0160').read())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement