Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from selenium import webdriver
- from selenium.webdriver.common.by import By
- from selenium.webdriver.support.ui import WebDriverWait
- from selenium.webdriver.support import expected_conditions as EC
- from selenium.webdriver.support.ui import Select
- from selenium.common.exceptions import NoSuchElementException
- from selenium.webdriver.support.wait import WebDriverWait
- import requests
- from bs4 import BeautifulSoup
- import string
- import re
- import requests
- import sys
- import time
- import random
- def func1():
- # usernameStr = raw_input("Username: ")
- # passwordStr = raw_input("Password: ")
- ch1 = ['country:"GB"', 'country:"US"', 'country:"CA"', 'country:"AU"', 'country:"NZ"']
- ch2 = [' kerio']
- ch1 = random.choice(ch1)
- ch2 = random.choice(ch2)
- usernameStr = 'stupidcatface'
- passwordStr = 'likewhatthefuck2'
- browser = webdriver.Chrome('/home/catface/Desktop/chrome/chromedriver')
- browser.get(('https://account.shodan.io/login'))
- username = browser.find_element_by_name('bofh')
- username.send_keys(usernameStr)
- password = browser.find_element_by_name('isgay')
- password.send_keys(passwordStr)
- nextButton = browser.find_element_by_name('login_submit')
- nextButton.click()
- #searchStr = ('vuln:cve-2014-0160' ,ch1,ch2,ch3')
- searchStr = ('vuln:cve-2014-0160 ' , str(ch1), str(ch2))
- srch = browser.find_element_by_id('search_input')
- srch.send_keys(searchStr)
- srch.submit()
- source = browser.page_source
- soup = BeautifulSoup(source, 'html5lib')
- soup = re.findall(r'[0-9]+(?:\.[0-9]+){3}:\d{1,5}', str(soup), flags=re.MULTILINE)
- soup = re.sub(r'[\']', "", str(soup), flags=re.MULTILINE)
- soup = re.sub(r'[\,]',"", str(soup), flags=re.MULTILINE)
- soup = re.sub(r'[\ ]',"\n", str(soup), flags=re.MULTILINE)
- soup = re.sub(r'\[|\]',"", str(soup), flags=re.MULTILINE)
- #soup = re.sub(r'\:',' -p ', str(soup), flags=re.MULTILINE)
- print soup
- ###########################################################################
- #nextpage = browser.find_element_by_link_text("Next")
- # if browser.is_element_present_by_xpath(By.LINK, contains(text(),"Next")):
- nextpage = browser.is_element_present(By.LINK_TEXT, "Next")
- if nextpage.is_displayed():
- print("Element Found")
- nextpage.click()
- else:
- nextpage.is_not_displayed()
- browser.quit()
- # else:
- # browser.quit()
- ################################################################################
- page2 = browser.find_element_by_link_text("Next")
- page2.click()
- soup = BeautifulSoup(source, 'html5lib')
- soup = re.findall(r'[0-9]+(?:\.[0-9]+){3}:\d{1,5}', str(soup), flags=re.MULTILINE)
- soup = re.sub(r'[\']', "", str(soup), flags=re.MULTILINE)
- soup = re.sub(r'[\,]',"", str(soup), flags=re.MULTILINE)
- soup = re.sub(r'[\ ]',"\n", str(soup), flags=re.MULTILINE)
- soup = re.sub(r'\[|\]',"", str(soup), flags=re.MULTILINE)
- #soup = re.sub(r'\:',' -p ', str(soup), flags=re.MULTILINE)
- print soup
- page3 = browser.find_element_by_link_text("Next")
- page3.click()
- soup = BeautifulSoup(source, 'html5lib')
- soup = re.findall(r'[0-9]+(?:\.[0-9]+){3}:\d{1,5}', str(soup), flags=re.MULTILINE)
- soup = re.sub(r'[\']', "", str(soup), flags=re.MULTILINE)
- soup = re.sub(r'[\,]',"", str(soup), flags=re.MULTILINE)
- soup = re.sub(r'[\ ]',"\n", str(soup), flags=re.MULTILINE)
- soup = re.sub(r'\[|\]',"", str(soup), flags=re.MULTILINE)
- #soup = re.sub(r'\:',' -p ', str(soup), flags=re.MULTILINE)
- print soup
- page4 = browser.find_element_by_link_text("Next")
- page4.click()
- soup = BeautifulSoup(source, 'html5lib')
- soup = re.findall(r'[0-9]+(?:\.[0-9]+){3}:\d{1,5}', str(soup), flags=re.MULTILINE)
- soup = re.sub(r'[\']', "", str(soup), flags=re.MULTILINE)
- soup = re.sub(r'[\,]',"", str(soup), flags=re.MULTILINE)
- soup = re.sub(r'[\ ]',"\n", str(soup), flags=re.MULTILINE)
- soup = re.sub(r'\[|\]',"", str(soup), flags=re.MULTILINE)
- #soup = re.sub(r'\:',' -p ', str(soup), flags=re.MULTILINE)
- print soup
- page5 = browser.find_element_by_link_text("Next")
- page5.click()
- soup = BeautifulSoup(source, 'html5lib')
- soup = re.findall(r'[0-9]+(?:\.[0-9]+){3}:\d{1,5}', str(soup), flags=re.MULTILINE)
- soup = re.sub(r'[\']', "", str(soup), flags=re.MULTILINE)
- soup = re.sub(r'[\,]',"", str(soup), flags=re.MULTILINE)
- soup = re.sub(r'[\ ]',"\n", str(soup), flags=re.MULTILINE)
- soup = re.sub(r'\[|\]',"", str(soup), flags=re.MULTILINE)
- #soup = re.sub(r'\:',' -p ', str(soup), flags=re.MULTILINE)
- print soup
- browser.close()
- var = 1
- while var == 1 :
- func1()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement