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.
It's a simple package for you to customize the console printing color.
pypi: https://pypi.org/project/colorprt/
We add some default color config in our package.
from colorprt.default import warn_color, success_color, error_color
warn_color.print("Print a warn message")
success_color.print("Print a success message")
error_color.print("Print an error message")
We found that some people use this package on linux server, so that there is no auto completions. It will trouble users.
Therefore, we add a feature that
You don't need to type: mode=
; foreground=
; background=
just call functions or class like this:
In old versions:
from colorprt import colorprt, Back, Fore
# CAUTION: Do not use this after version: 3.0.0
colorprt("Hello World", backgound=Back.RED)
Use new features:
from colorprt import colorprt, Back, Fore
colorprt("Hello World", Back.RED, Fore.YELLOW)
pip install colorprt
Function colorprt
is a print
funtion extention. You can customize the printing style.
from colorprt import colorprt, Back, Fore
hello_else = "Hello Michael"
colorprt("Hello World",hello_else, Back.RED, Fore.BLUE end="x100 times\n")
Also, you can use ColorprtConfig
class to set colored strings.
from colorprt import ColorprtConfig, Mode, Back, Fore
pycolor_config = ColorprtConfig(Mode.BOLD, Back.DEFAULT, Fore.RED)
# You can use ColorprtConfig to set a color string configuration
colored_formatted_str = pycolor_config("I love You!!")
print(colored_formatted_str)
# or just use print method
pycolor_config.print("I love you!!", end="x10086\n")
If you just want the ansi colored formatted strings, you can use colorstr
class.
from colorprt import colorstr, Mode, Back, Fore, ColorprtConfig
hate_print_config = ColorprtConfig(Mode.UNDER_LINE, Back.DEFAULT, Fore.YELLOW)
print(colorstr("I love You!!", Mode.BOLD, Back.DEFAULT, Fore.RED)
+ colorstr("I hate you", hate_print_config))
if you use str() to force change to string. You will get
>>> str(colorstr("I love You!!", Mode.BOLD, Back.DEFAULT, Fore.RED)
+ colorstr("I hate you", hate_print_config))
>>> '\x1b[0m\x1b[1;31mI love You!!\x1b[0m\x1b[4;33mI hate you\x1b[0m\x1b[0m'
from colorprt import colorstr, Mode, Back, Fore, ColorprtConfig
hate_print_config = ColorprtConfig(Mode.UNDER_LINE, Back.DEFAULT, Fore.YELLOW)
output = str(colorstr('I hate You', hate_print_config))
FAQs
It's a simple tools to print colorfully. Easy to use
We found that colorprt 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.