🙋‍♂️ CRON jobs in Kali

This actually applies to any Linux distribution, it’s exactly the same as a scheduled task in windows which would be sent via the task scheduler.

This basically controls automated tasks, for this to work you essentially have a CRON file that can automate Monday and tasks that you’d otherwise have to manually run.

First, you need to understand what it is you wish to automate based on a time or a date or a combination of the two, so in this example, we will automate sending a heartbeat to an external website for monitoring purposes, in this example, that means delivering a specially crafted URL on HTTPS.

CRON in Linux

First you need to ensure you have none, to check that use this command

crontab -l

This should return this to confirm its empty, that means you can create a new one.....


Then you want this command to create a file

crontab -e

This will then ask you wish editor you would like to use, for this example I am using "nano" or option 1.....



This will then open the editor that will look something like this:



Then scroll down until you see the whitespace (or in this case black space) then you can enter your commands in the red box area as below:


So then you need your command, this for an example will send a GET request to https://a6n.co.uk every 30 minutes, which is defined at the start of the task as you can see below, then you have the command, which in this case is CURL as a GET to the website.....

*/30 * * * * curl --request GET 'https://a6n.co.uk'

However you if wanted something to to run at 08:10 on day-of-month 1 and on Tuesday in October

10 8 1 10 02 curl --request GET 'https://a6n.co.uk'

Then finally if you want something that runs at minute 10 past every 2nd hour from 0 through 20 in the days of the month then you can use this

10 0-20/2 * * * curl --request GET 'https://a6n.co.uk'

If you wish to make you own, you can use this website for schedules here

Task Scheduler in Windows

First you need to know the command here, the command for the same request is this,

Note : If you are using Server Core, then you will need the -UseBasicParsing on the end!

powershell wget -uri https://a6n.co.uk 

Then you need to add that to a Scheduled task, for that open Task Scheduler



Then you want a "Basic Task" as below:



Then give it a relevant name:


We will then choose Daily at 08:00 starting today in this time zone, recurring every one day.....



We then wish to "Start a Program" and use the detail below:

Program : powershell.exe
Arguments : wget -uri https://a6n.co.uk -Use BasicParsing


That should look like this:



I am fine with this task being used when I am using the device, but if you wish to have it run when you are not logged into the device, then you need the red box, for this you will need to provide the username and password.......


Previous Post Next Post

نموذج الاتصال