Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - Manage schedules with cron (1/3) #3025

Merged

Conversation

sasirven
Copy link
Contributor

@sasirven sasirven commented Jul 26, 2024

This is the part of the schedule management that replaces cron.

Linked Merge Requests:
#3026
mitre/magma#61

  • Manage schedules with cron:
    • Replace time management with cron syntax for better control.
  • Add conversion from old format to new one:
    • Replace the old date with the new cron syntax to create a new operation each day at the same hour and minute as before.

@elegantmoose
Copy link
Contributor

@sasirven picking this up now. Sorry for delay.

requirements.txt Outdated Show resolved Hide resolved
requirements.txt Outdated Show resolved Hide resolved
@uruwhy
Copy link
Contributor

uruwhy commented Sep 9, 2024

Tested using both the proposed and latest version (3.0.3) of croniter and confirmed scheduled operations are still kicking off as expected:

curl -H "KEY: ADMIN123" -H "Content-Type: application/json" -X POST http://192.168.56.7:8888/api/v2/schedules --data '{
    "schedule": "13:17:00.000000",
    "id": "123456",
    "task": {
        "id": "234567",
        "name": "testop",
        "adversary": {
            "adversary_id": "01d77744-2515-401a-a497-d9f7241aac3c"
        },
        "planner": {
            "id": "aaa7c857-37a0-4c4a-85f7-4e9f7f30e31a"
        },
        "autonomous": 1,
        "use_learning_parsers": true,
        "group": "red",
        "source": {
            "id": "ed32b9c3-9593-4c33-b0db-e2007315096b"
        }
    }
}' | jq

app/service/app_svc.py Outdated Show resolved Hide resolved
Copy link
Contributor

@uruwhy uruwhy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some suggestions and comments (see above)

@sasirven sasirven force-pushed the feature/manage-schedules-with-cron branch from 949668a to d690351 Compare September 24, 2024 11:32
guillaume-duong-bib and others added 5 commits September 24, 2024 17:45
- Check if schedules syntax is a valid cron syntax
- Log warn if schedules not a valid cron syntax
Improve conversion with regex group
@sasirven sasirven force-pushed the feature/manage-schedules-with-cron branch from d690351 to 27b47d1 Compare September 24, 2024 15:45
@clenk clenk enabled auto-merge (squash) September 24, 2024 19:16
@elegantmoose
Copy link
Contributor

Thank you @guillaume-duong-bib and @sasirven !

@elegantmoose elegantmoose merged commit 7889b79 into mitre:master Sep 25, 2024
1 of 6 checks passed
@sasirven sasirven deleted the feature/manage-schedules-with-cron branch October 15, 2024 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants