Last active
December 3, 2019 20:38
-
-
Save anmolj7/7cba2135cc7c0c3ec3e1f52cca8f43e0 to your computer and use it in GitHub Desktop.
The google search isn't working :(
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
from fake_useragent import UserAgent | |
ua = UserAgent().random | |
def bing_search(string): | |
urls = [] | |
payload = { | |
'q': string | |
} | |
headers = { | |
'User-agent': ua | |
} | |
req = requests.get( 'https://www.bing.com/search',payload, headers = headers ) | |
soup = BeautifulSoup( req.text, 'html.parser' ) | |
h3tags = soup.find_all( 'li', class_='b_algo' ) | |
for h3 in h3tags: | |
try: | |
urls.append(h3.find('a').attrs['href']) | |
except: | |
continue | |
return urls | |
def google_search(string): | |
urls = [] | |
payload = {'q':string, 'start':0} | |
headers = { | |
'User-agent': ua | |
} | |
req = requests.get( 'http://www.google.com/search',payload, headers = headers ) | |
soup = BeautifulSoup( req.text, 'html.parser' ) | |
h3tags = soup.findAll('cite',attrs={'class':'iUh30'}) | |
for h3 in h3tags: | |
try: | |
urls.append(h3.text) | |
except: | |
continue | |
return urls | |
search = int(input("Enter the search engine you wanna use (1 for Bing, 2 for Google): ")) | |
if search == 1: | |
print("The possible vulnerable sites: ") | |
print(*bing_search("inurl:php?=id"), sep="\n") | |
if search == 2: | |
print("The possible vulnerable sites: ") | |
print(*google_search("inurl:php?=id"), sep="\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment