Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
"Pure Python, lightweight, Pillow-based solver for the Amazon text captcha."
The motivation behind the creation of this library is taking its start from the genuinely simple idea: "I don't want to use pytesseract or some other non-amazon-specific OCR services, nor do I want to install some executables to just solve a captcha. I desire to get a solution with 2 lines of code without any heavy add-ons, using a pure Python."
Pure Python, lightweight, Pillow-based solver for Amazon's text captcha.
You can simply install the library from PyPi using pip. For more methods check the docs.
pip install amazoncaptcha
An example of the constructor usage. Scroll a bit down to see some tasty class methods. For consistency across different devices, it is highly recommended to use fromlink
class method.
from amazoncaptcha import AmazonCaptcha
captcha = AmazonCaptcha('captcha.jpg')
solution = captcha.solve()
# Or: solution = AmazonCaptcha('captcha.jpg').solve()
Browsing Amazon using selenium
and stuck on captcha? The class method below will do all the dirty work of extracting an image from the webpage for you. Practically, it takes a screenshot from your webdriver, crops the captcha and stores it into bytes array which is then used to create an AmazonCaptcha
instance. This also means avoiding any local savings. For consistency across different devices, it is highly recommended to use fromlink
class method instead of fromdriver
.
from amazoncaptcha import AmazonCaptcha
from selenium import webdriver
driver = webdriver.Chrome() # This is a simplified example
driver.get('https://www.amazon.com/errors/validateCaptcha')
captcha = AmazonCaptcha.fromdriver(driver)
solution = captcha.solve()
If you are not using selenium
or the previous method is not just the case for you, it is possible to use a captcha link directly. This class method will request the url, check the content type and store the response content into bytes array to create an instance of AmazonCaptcha
.
from amazoncaptcha import AmazonCaptcha
link = 'https://images-na.ssl-images-amazon.com/captcha/usvmgloq/Captcha_kwrrnqwkph.jpg'
captcha = AmazonCaptcha.fromlink(link)
solution = captcha.solve()
In addition, if you are a machine learning or neural network developer and are looking for some training data, check this repository, which was created to store images and other non-script data for the solver.
If you are willing to help the development, consider setting keep_logs
argument of the solve
method to True
. Here is the example, if you are using fromdriver
class method. If set to True
, all the links of the unsolved captcha will be stored so that later you can open the issue and send the logs.
from amazoncaptcha import AmazonCaptcha
from selenium import webdriver
driver = webdriver.Chrome() # This is a simplified example
driver.get('https://www.amazon.com/errors/validateCaptcha')
captcha = AmazonCaptcha.fromdriver(driver)
solution = captcha.solve(keep_logs=True)
If you have any suggestions or ideas of additional instances and methods, which you would like to see in this library, please, feel free to contact the owner via email or fork'n'pull to repository. Any contribution is highly appreciated!
FAQs
"Pure Python, lightweight, Pillow-based solver for the Amazon text captcha."
We found that amazoncaptcha demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.