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.
logging-actions
For easy configuration of logging.Logger
s with argparse.Action
s.
Use it like this:
>>> from logging_actions import log_level_action
>>> from argparse import ArgumentParser
>>> import logging
>>> logger = logging.getLogger("foo") # Create your script's logger
>>> logger.addHandler(logging.StreamHandler()) # Don't forget to add a handler!
>>> parser = ArgumentParser()
>>> _ = parser.add_argument("--log-level", action=log_level_action(logger)) # create an action for your module's logger
>>> args = parser.parse_args() # Your logger's level will be set for you when parsing
foo.py --help
usage: foo.py [-h] [--log-level {critical,fatal,error,warn,warning,info,debug,notset}]
optional arguments:
-h, --help show this help message and exit
--log-level {critical,fatal,error,warn,warning,info,debug,notset}
Set the logging level for foo.
parser.add_argument("-l", "--log-level", action=log_level_action(logger), default="info")
logging.addLevelName(5, "TRACE")
parser.add_argument("-l", action=log_level_action(logger), default="trace")
This replaces the following pattern for setting script log levels
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument(
"--log-level",
default=logging.INFO,
type=lambda x: getattr(logging, x)),
help="Configure the logging level.",
)
args = parser.parse_args()
logging.basicConfig(level=args.log_level)
parser.add_argment("--foo-log-level", action=log_level_action(foo_logger))
parser.add_argment("--bar-log-level", action=log_level_action(bar_logger))
FAQs
For easy configuration of `logging.Logger`s with `argparse.Action`s.
We found that logging-actions 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.