def query_twitter(self, query): query = urllib..parse.quote_plus(query) results = [] browser = anonomize_traffic() browser.anonomize() response = browser.open('https://search.twitter.com/search.json?q=' + query) json_objects = json.load(response) for result in json_objects['results']: new_result = {} new_result['from_user'] = result['from_user_name'] new_result['geo'] = result['geo'] new_result['tweet'] = result['tweet'] results.append(new_result) return results
def mirrorImages(url, dir): ab = anonomize_traffic() ab.anonomize() html = ab.open(url) soup = BeautifulSoup(html, 'html.parser') images = soup.findAll(name='img') for image in images: filename = image['src'].lstrip('http://') filename = os.path.join(dir, filename.replace('/', '_')) print('[+] Saving ' + str(filename)) data = ab.open(image['src']).read() ab.back() save = open(filename, 'wb') save.write(data) save.close()
def printLinks(url): ab = anonomize_traffic() ab.anonomize() 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("\n[+] Printing links from beautifulsoup") soup = BeautifulSoup(html, "html.parser") links = soup.findAll(name="a") for link in links: if link.has_attr("href"): print(link["href"]) except: pass
from anonomize_traffic import * ab = anonomize_traffic( proxies=[], user_agents=[("User-agent", "Opera/9.80 (X11; Linux i686; Ubuntu/14.10) Presto/2.12.388 Version/12.16")] ) for attempt in range(1, 5): ab.anonomize() print("Fetching page") response = ab.open("http://kittenwar.com") for cookie in ab.cookie_jar: print(cookie)
def google(search_term): ab = anonomize_traffic() ab.anonomize() search_term = urllib.quote_plus(search_term) response = ab.open('http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=' + search_term) print(response.read())