python - Input to a web page and retrieve the output -
I am trying to enter a password in the "howsecureismypassword" website and am recovering the output using webscraping. It is possible that here is the HTML from the web page and the code below which I have done so far, any help would be appreciated.
& lt; Div role = "main" & gt; & Lt; Div class = "input" & gt; & Lt; Input type = "password" id = "password" ng-model = "password" ng-change = "password (replace)" placeholder = "enter password" class = "password" autofocus & gt; & Lt; / Div & gt; & Lt; Div class = "phishing" ng-hide = "password" & gt; & Lt; P & gt; This site can steal your password ... is not it, but it can easily be & lt; Em> Can & lt; / Em> & Lt; Br / & gt; Be careful where you write your password. & Lt; / P & gt; & Lt; / Div & gt; & Lt; Div ng-show = "password" & gt; & Lt; Ul ng-show = "display.config" & gt; & Lt; Li & gt; & Lt; Label & gt; & Lt; Input type = "checkbox" ng model = "config.namedNumbers" ng-change = "config.changeNamedNumbers ()" /> Use Named Number & lt; / Labels & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Label & gt; Returns per second & lt; / Label & gt; & Lt; Input type = "text" ng-model = "config.calculations" ng-change = "config.changeCalculations ()" /> & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; Div class = "result" & gt; & Lt; Span class = "toggle" ng-click = "display.toggleConfig ()" & gt; {{Display.configText}} & lt; / Span & gt; & Lt; P ng-hide = "unsafe" & gt; It will take & lt; Span ng-show = "config.calculationsOriginal" & gt; A desktop PC & lt; / Span & gt; About & lt; Period class = "main" & gt; {{Time}} & lt; / Span & gt; To sort your password, click & lt; / P & gt; & Lt; A class = "tweet-me" ng-hide = "unsafe" href = "http://twitter.com/home/?status= This is a desktop PC about {{time}} to correct my password Will!% 0d% 0dhttp: //hsim.pw "& gt; [Tweet result] & lt; / A & gt; & Lt; P ng-show = "unsafe" & gt; Your password will be almost broken & lt; Span class = "main" & gt; Instantly & lt; / Span & gt; & Lt; / P & gt; ! & Lt; A class = "tweet-me" ng show = "unsafe" href = "http://twitter.com/home/?status= My password will be cracked almost immediately% 0d% 0dhttp: // hsim.pw" & Gt; [Chile results] & lt; / A & gt; & Lt; Span class = "toggle" ng-click = "display.toggleDetails ()" & gt; {{Display.detailsText}} & lt; / Span & gt; & Lt; / Div & gt;
The URL of the webpage to urlib.parse import urlencode # httplib2 import to use a webpage httplib2 using Http # Create the program web object = http ( ) # Set url = 'https://howsecureismypassword.net/' password = input ('enter') # a data dictionary {'placeholder'}: password} data = create # encode local web to web_data = urlencode (data) # Connect server 192.168.26.10 response, content = h.request (url, 'POST', web_data) if response.status == 200: # Contents of the display web page GE returned to TEXT_CONTENT = content.decode () print ('content:') print (TEXT_CONTENT) # "Beautiful soup" BS4 import BeautifulSoup soup = BeautifulSoup (content) Turn it in print (soup.get_text ()) and print: 'Error Web Page')
I will use it for beautiful soup scrapings Good for, not to interact with pages. Browse browser with browser as browser (browser): # url = "" Visit browser.visit (url) browser. Find the 'Search button' button and click it = Browser.Find_by_name ('BTNG') #Presenting the button with Elements Button ('q', 'splinter - Python Approval Test for Web Applications'). Click () if browser.is_text_present ('Splinter.cobrateam.info'): Print "Yes, official website was found!" Other: Print "No, it was not found ... We need to improve our SEO techniques"
You can customize something like this to meet your needs. You can.
Comments
Post a Comment