Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Dynamically generated, AI-resistant captcha images.
Can you tell what time it is? AI can't.
Color-captcha uses higher-order shapes to hide the information from AI. AI can recognize that the image is made up of triangles, squares and circles. However, it cannot recognize that these shapes form more complex higher-order shapes, in this case numbers. The numbers, therefore, remain hidden in plain sight. The human eye, on the other hand, should be able to see the numbers with little effort.
Features:
ClockCaptcha
and DigitsCaptcha
generators.pip install color-captcha
from color_captcha import ClockCaptcha
captcha = ClockCaptcha(clock_mode=12, color_mode='rgb')
# 12 or 24-hour mode
# rgb or grayscale color_mode
# current captcha value
print(captcha.value)
captcha.save_image('my_captcha.png')
# if no extension, set format explicitly
captcha.save_image('my_captcha', format='png')
# verify the guessed value
captcha.verify('0645')
# returns True/False
# create new captcha
captcha.generate_new()
captcha.save_image('new_captcha.png')
Same usage as ClockCaptcha except it generates captcha with arbitrary number of digits, and is not in the clock format, just plain digits.
from color_captcha import DigitsCaptcha
captcha = DigitsCaptcha(digits=5)
captcha.save_image('digits.png')
captcha.verify('12345')
captcha.generate_new()
Both ClockCaptcha and DigitsCaptcha have the size
parameter, which changes the size of the image.
Below relative values in pixels for the ClockCaptcha image.
DigitsCaptcha images vary in width depending on the number of digits.
ClockCaptcha sizes:
size | width (pixels) | height (pixels) |
---|---|---|
1 | 190 | 65 |
2 | 380 | 130 |
3 (default) | 570 | 195 |
4 | 760 | 260 |
... | ... | ... |
Configuration changes are applied globally.
colors
: list of base colors in hex format (full 6 characters required).base_variation_percent
: max *variation of the color in the background.content_variation_percent
: max *variation of colors of the numbers.*Percent increase of non-dominant colors in a pixel. To turn off color variation set these parameters to 0.
from color_captcha.config import Config
Config.colors = ['#ec7063', '...']
Config.base_variation_percent = 0.30
Config.content_variation_percent = 0.15
⚠️ Important to consider: Difference in color variation between background and numbers can make the numbers stand out more. If this difference is too great the AI may pick up on that and be able to detect numbers. The default values of 0.15 and 0.30 should be good for now, but may need to change in the future.
FAQs
Dynamically generated, AI-resistant captcha images
We found that color-captcha 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.