def __get_captcha_answer(self, referer_url, page): soup = BeautifulSoup.BeautifulSoup(page) for tag in soup.findAll("img"): if "mode=confirm" not in tag["src"]: continue image_url = tag["src"] if not image_url.startswith("http"): image_url = urlparse.urljoin(referer_url, image_url) image_file_name = "%s.jpg" % random_sequence(10) image_file_path = os.path.join(images_path, image_file_name) if not os.path.exists(images_path): os.mkdir(images_path) image_data = self.__session.get(image_url).content image_file = open(image_file_path, "wb") image_file.write(image_data) image_file.close() if dc_username: d = decaptcher.decaptcher("jamespenguin", dc_password) captcha_answer = d.solve_image(image_file_path) else: captcha_answer = self.__get_captcha_answer_from_GUI( image_file_path) os.remove(image_file_path) return captcha_answer
def __get_captcha_answer(self, referer_url, page): soup = BeautifulSoup.BeautifulSoup(page) for tag in soup.findAll("img"): if "mode=confirm" not in tag["src"]: continue image_url = tag["src"] if not image_url.startswith("http"): image_url = urlparse.urljoin(referer_url, image_url) image_file_name = "%s.jpg" % random_sequence(10) image_file_path = os.path.join(images_path, image_file_name) if not os.path.exists(images_path): os.mkdir(images_path) image_data = self.__session.get(image_url).content image_file = open(image_file_path, "wb") image_file.write(image_data) image_file.close() if dc_username: d = decaptcher.decaptcher("jamespenguin", dc_password) captcha_answer = d.solve_image(image_file_path) else: captcha_answer = self.__get_captcha_answer_from_GUI(image_file_path) os.remove(image_file_path) return captcha_answer
import decaptcher ### # Config ### images_path = "captchas" adjectives_path = "adjectives.txt" nouns_path = "nouns.txt" # Decaptcher Stuff dc_username = "" # To enable decaptcher, just put in your username and password here dc_password = "" # Print DC balance if dc_username: d = decaptcher.decaptcher(dc_username, dc_password) print "[+] Decaptcher balance is $%.2f" % d.get_balance() print #!# End Config #!# def random_sequence(length): chars = map(chr, range(48, 58) + range(97, 123)) big_chars = map(chr, range(65, 91)) return "".join(map(lambda x: random.choice(chars), range(length))) + random.choice(big_chars) def random_noun(): nouns = open(nouns_path, "r").read().split("\n")
import decaptcher ### # Config ### images_path = "captchas" adjectives_path = "adjectives.txt" nouns_path = "nouns.txt" # Decaptcher Stuff dc_username = "" # To enable decaptcher, just put in your username and password here dc_password = "" # Print DC balance if dc_username: d = decaptcher.decaptcher(dc_username, dc_password) print "[+] Decaptcher balance is $%.2f" % d.get_balance() print #!# End Config #!# def random_sequence(length): chars = map(chr, range(48, 58) + range(97, 123)) big_chars = map(chr, range(65, 91)) return "".join(map(lambda x: random.choice(chars), range(length))) + random.choice(big_chars) def random_noun(): nouns = open(nouns_path, "r").read().split("\n") return random.choice(nouns) def random_adjective():