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.
Python-Fire-like, ask for function args by Terminal UI / GUI, ensuring the type annotation. Read more: https://github.com/ClericPy/ask4args.
Ask for function args by Terminal UI / GUI, ensuring the type annotation. Inspired by python-fire, and it maybe need a human-friendly interactive UI.
pip install ask4args -U
python3 -m ask4args module:function
from ask4args.core import Ask4Args, Ask4ArgsGUI, Ask4ArgsWeb
from typing import List, Dict
def test_normal_function(a: int, b: int = 2, **args_dict: Dict[str, int]):
# first a value=1, args_dict['c']=3, others use default.
# press 1, enter, enter, enter, c, enter, 3, enter, enter
assert a == 1
assert b == 2
assert args_dict['c'] == 3
return ('success', vars())
def test_keyword_only_function(a: float,
b: int = 2,
*,
c: bool = False,
d: str = 'string',
e: int = None,
f: List[int] = None,
**args_dict: Dict[str, int]):
"""Read the doc, and test kw-only args.
:param a: one float num
:type a: float
:param b: one int num, defaults to 4
:type b: int, optional
:param c: boolen arg, defaults to False
:type c: bool, optional
:param d: string arg, defaults to 'string'
:type d: str, optional
:return: return the args_dict
:rtype: Dict[str, list]
"""
assert a == 1.1
assert b == 2
assert c is False
assert d == 'string'
assert e == 1
assert f == [1, 2, 3]
assert args_dict['h'] == 3
return ('success', vars())
class TestClass(object):
def test_method(self, a: str, b: int = 1):
assert a == ''
assert b == 1
return ('success', vars())
@classmethod
def test_class_method(cls, a: str, b: int = 1):
assert a == ''
assert b == 1
return ('success', vars())
def test_defaults(a: int):
assert a == 1
return ('success', vars())
if __name__ == "__main__":
# cls = Ask4ArgsWeb
cls = Ask4Args
# cls = Ask4ArgsGUI
# =====================
# =====================
# ('success', {'a': 1, 'b': 2, 'args_dict': {'c': 3}})
# cls(test_normal_function).run()
# =====================
# ('success', {'a': 1.1, 'b': 2, 'c': False, 'd': 'string', 'e': 1, 'f': [1, 2, 3], 'args_dict': {'h': 3}})
# cls(test_keyword_only_function,
# choices={
# 'e': [1, 2, 3, 4, 5]
# },
# checkboxes={
# 'f': [1, 2, 3, 4, 5]
# }).run()
# =====================
# cls(TestClass().test_method).run()
# =====================
# cls(TestClass().test_class_method).run()
# =====================
# cls(test_defaults, defaults={'a': 1}).run()
pass
FAQs
Python-Fire-like, ask for function args by Terminal UI / GUI, ensuring the type annotation. Read more: https://github.com/ClericPy/ask4args.
We found that ask4args 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.