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

refactor: remove global variables for all commands #572

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aymene01
Copy link

What does this PR do?

This PR refactors the detonate_cmd.go file by removing the use of global variables, which improves code maintainability and readability.

Motivation

This is my first contribution to a Datadog repository, and I'm eager to get started on security in the cloud and security in general.

Checklist

  • The attack technique emulates a single attack step, not a full attack chain
  • We have factual evidence & references that the attack technique was used by real malware, pentesters, or attackers
  • The attack technique makes no assumption about the state of the environment prior to warming it up

@christophetd
Copy link
Contributor

Thanks for the contribution, this makes a lot of sense! Do you know if we have the same problem for other commands? If yes it would make sense to fix it for others as well

@aymene01 aymene01 closed this Sep 23, 2024
@aymene01 aymene01 reopened this Sep 23, 2024
@aymene01
Copy link
Author

Thanks for the contribution, this makes a lot of sense! Do you know if we have the same problem for other commands? If yes it would make sense to fix it for others as well

Yes, I see this in other commands. I can refactor them as well

@aymene01 aymene01 changed the title refactor: remove global variables for detonate command refactor: remove global variables for all commands Sep 23, 2024
@aymene01
Copy link
Author

Accidentally closed the PR with a misclick 😑, done for all commands you can have a look and give me your feedback :)

return errors.New("pass the ID of the technique to clean up, or --all")
}
return nil
if len(args) == 0 && !flagCleanupAll {
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be flagCleanupAll like before?

}

// Ensure the technique IDs are valid
_, err := resolveTechniques(args)
if len(args) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need this check? (it wasn'tthere before)

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.

2 participants