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.
cron-schedule-triggers
Advanced tools
Cron Schedule Triggers ~ A library for determining Quartz Cron schedule trigger dates.
Cron Schedule Triggers (CSTriggers) is a Python library enabling the ability to determine the next execution of a live schedule. Its syntax is that of Quartz Job Scheduler. This library is not a scheduling app or a task queue, there are plenty of those in the wild to choose from. When you need advanced customisation of triggers for tasks, and a common and conventional syntax for schedule notation, CSTriggers comes to your aid.
Initialize a schedule object with a cron notation string, a start date, and an optional end date. Call .next_trigger()
for a new date. Notice that when an end_date is given, The schedule terminates at 2022-10-13T00:00:00
and not 2030-03-01T00:00:00
as it would naturally.
from cstriggers.core.trigger import QuartzCron
schedule_string = "0 0 0 1 JAN-MAR ? 2010-2030"
start_date = "2019-10-13T00:00:00"
end_date = "2022-10-13T00:00:00"
cron_obj = QuartzCron(schedule_string=schedule_string, start_date=start_date, end_date=end_date)
print(cron_obj.next_trigger(isoformat=True))
>> 2020-01-01T00:00:00
For multiple sequential dates call either .next_trigger()
multiple times.
from cstriggers.core.trigger import QuartzCron
schedule_string = "0 0 0 1 JAN-MAR ? 2010-2030"
start_date = "2019-10-13T00:00:00"
end_date = "2022-10-13T00:00:00"
cron_obj = QuartzCron(schedule_string=schedule_string, start_date=start_date, end_date=end_date)
print(cron_obj.next_trigger(isoformat=True))
print(cron_obj.next_trigger(isoformat=True))
>> 2020-01-01T00:00:00
>> 2020-02-01T00:00:00
Or call .next_triggers()
with the number of triggers needed.
from cstriggers.core.trigger import QuartzCron
schedule_string = "0 0 0 1 JAN-MAR ? 2010-2030"
start_date = "2019-10-13T00:00:00"
end_date = "2022-10-13T00:00:00"
cron_obj = QuartzCron(schedule_string=schedule_string, start_date=start_date, end_date=end_date)
print(cron_obj.next_triggers(number_of_triggers=10, isoformat=True))
>> [
'2020-01-01T00:00:00',
'2020-02-01T00:00:00',
'2020-03-01T00:00:00',
'2021-01-01T00:00:00',
'2021-02-01T00:00:00',
'2021-03-01T00:00:00',
'2022-01-01T00:00:00',
'2022-02-01T00:00:00',
'2022-03-01T00:00:00',
'2023-01-01T00:00:00'
]
FAQs
Cron Schedule Triggers ~ A library for determining Quartz Cron schedule trigger dates.
We found that cron-schedule-triggers 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.