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库.
可以实现格式化一些中文带有时间的字符串,格式化后将数字结果返回.
即:【中文时间】 > 【数字时间】
Python 3.x
pip3 install datetimex
import datetimex
test = datetimex.gettime('明天早上七点半')
test2 = datetimex.gettime('两天前的晚上十一点四十五分')
print(test)
print(test2)
结果如下:
('20181214495PM045543', '20181215496AM073000')
('20181214495PM045543', '20181212493PM114500')
gettime方法返回值为一个元组,其中第一项为当前时间,第二项为格式化后的时间.
两个字符串长度均为19,其中:
1~4位代表年份,5~6位代表月份,7~8位代表日,
9~10位代表周数(一年内所在的第几周),
11位代表星期几(星期天为一周的第一天,为0),
12~13位代表上下午
14~15位代表时,16~17位代表分,18~19位代表秒
上面两句代码得到的结果,表示:
在2018年12月14日,也是该年第49周的星期五的下午四点五十五分四十三秒执行的程序,分别传入“明天早上七点半”和“两天前的晚上十一点四十五分”,
执行结果分别返回的是:
2018年12月15日,也是该年的第49周星期六的早上7点30分,
2018年12月12日,该年的第49周星期三的晚上11点45分
FAQs
A Python library that formats strings with date and time.
We found that datetimex 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.