from AnonBrowser import *
from BeautifulSoup import BeautifulSoup
import os
import optparser
import re
def print_links(url):
ab = AnonBrowser()
ab.anonymize()
page = ab.open(url)
html = page.read()
try:
print("[+] Printing Links From Regex.")
link_finder = re.compile('href="(.*?)"')
links = link_finder.findall(html)
for link in links:
print(link)
except:
pass
try:
print("[+] Printing Links From BeautifulSoup.")
soup = BeautifulSoup(html)
links = soup.findAll(name='a')
for link in links:
if link.has_key('href'):
print(link["href"])
except:
pass
import urllib
from AnonBrowser import *
def google(search_term):
ab = AnonBrowser()
search_term = urllib.quote_plus(search_term)
response = ab.open("http://ajax.googleapis.com/ajax/services/searchweb?v=1.0&q={}".format(search_term))
print(response.read())
google("Boondock Saint")
import json
json.load(response)
import json
import urllib
import optparse
from AnonBrowser import *
class GoogleResult:
def __init__(self, title, text, url):
self.title = title
self.text = text
self.url = url
def __repr__(self):
return self.title
def google(search_term):
ab = AnonBrowser()
search_term = urllib.quote_plus(search_term)
response = ab.open("...")
objects = json.load(response)
results = list()
for result in objects["responseData"]["results"]:
url = result["url"]
title = result["titleNoFormatting"]
text = result["content"]
new_gr = GoogleResult(title, text, url)
results.append(new_gr)
return results