
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
github.com/jaytaylor/cron2sysdtimer
Advanced tools
Automatically transform crontab jobs into systemd timers
go install jaytaylor/cron2sysdtimer@latest
cron2sysdtimer reads crontab file at /etc/crontab by default. You can specify crontab file with -f FILE flag.
systemd unit file are saved at /run/systemd/system by default. You can specify save directory with -o OUTDIR flag.
$ cron2sysdtimer
$ cron2sysdtimer -f sample.cron -o unitfiles
ubuntu@ubuntu-jovial:~/src/jaytaylor.com/cron2sysdtimer$ sudo cron2sysdtimer -f sample.cron --reload
ubuntu@ubuntu-jovial:~/src/jaytaylor.com/cron2sysdtimer$ systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Fri 2017-01-20 07:50:00 UTC 4min 16s left n/a n/a cron-77e2fb273c45.timer cron-77e2fb273c45.service
Fri 2017-01-20 07:56:01 UTC 10min left n/a n/a systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
Fri 2017-01-20 08:00:00 UTC 14min left n/a n/a cron-1b33d99b7dda.timer cron-1b33d99b7dda.service
Fri 2017-01-20 10:00:00 UTC 2h 14min left n/a n/a cron-b60fe106ef63.timer cron-b60fe106ef63.service
Fri 2017-01-20 12:16:09 UTC 4h 30min left n/a n/a snapd.refresh.timer snapd.refresh.service
Fri 2017-01-20 19:11:59 UTC 11h left n/a n/a apt-daily.timer apt-daily.service
Wed 2017-02-01 00:00:00 UTC 1 weeks 4 days left n/a n/a cron-fcd6d8377d9d.timer cron-fcd6d8377d9d.service
Sat 2017-12-02 01:23:00 UTC 10 months 11 days left n/a n/a cron-d3c507cb2439.timer cron-d3c507cb2439.service
8 timers listed.
Pass --all to see loaded but inactive timers, too.
If --reload is provided, cron2sysdtimer reloads systemd unit files (= systemctl daemon-reload) and starts all generated timers (= systemctl start foo.timer). Maybe sudo is required to execute.
$ sudo cron2sysdtimer -f sample.cron --reload
Crontab does not have the concept of "task name", and a task name is required to identify each systemd unit.
cron2sysdtimer supports automatically generating the task name from the original command using a regular expression- Use the --name-regexp REGEXP flag.
The regex must have one capturing group.
If a regular expression is not provided or command does not match to the given regular expression, a hash value is automatically calculated and used as the unit name.
$ cron2sysdtimer -f sample.cron --name-regexp '--name ([a-zA-Z0-9_-]+)'
If --delete is provided, cron2sysdtimer deletes unit files which are no longer written in the given crontab file.
$ cron2sysdtimer -f tmp/scheduler -o /run/systemd/system --delete
Deleted: /run/systemd/system/cron-19fb9c164fe8.service
Deleted: /run/systemd/system/cron-19fb9c164fe8.timer
Deleted: /run/systemd/system/cron-4f76a3902132.service
Deleted: /run/systemd/system/cron-4f76a3902132.timer
You can specify unit dependencies (After=) with --after AFTER flag.
$ cron2sysdtimer -f sample.crom --after docker.service
go get -u github.com/jteeuwen/go-bindata/...
Standard:
cd $GOPATH/src/jaytaylor.com/cron2sysdtimer
go test -v ./...; echo $?
cd $GOPATH/src/jaytaylor.com/cron2sysdtimer
go generate ./...
Forked from @dtan4's ct2stimer.git.
FAQs
Unknown package
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 researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.