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

Adding an attribute to run the command on specific targets #5

Open
michiiii opened this issue Dec 21, 2023 · 1 comment
Open

Adding an attribute to run the command on specific targets #5

michiiii opened this issue Dec 21, 2023 · 1 comment

Comments

@michiiii
Copy link

Hello,

Fantastic job on your current project!

I suggest incorporating an additional flag when setting up a command for systems linked to specific target Group Policy Objects (GPOs). This would help narrow down the host range on which the command operates. Consider utilizing a straightforward conditional check.

For instance, if a command is scheduled to run across 1000+ systems via a particular GPO, it's likely that some systems should remain unaffected. By integrating an 'if' statement, the command would execute only if the system's hostname matches one within a predefined list.

Here's an enhanced example of how the PowerShell script might look when embedded into the GPO:

# Get the current hostname
$hostname = $env:COMPUTERNAME

# Define the hostnames to check against
$targetHostnames = @("host2424", "host2329")

# Check if the current hostname is in the list of target hostnames
if ($targetHostnames -contains $hostname) {
    # Execute the command if the hostname matches
    whoami
}

This method effectively narrows down the scope of impacted systems, providing a more controlled and secure execution environment.

P.S.: While it's possible to include these conditions directly within the command, this approach offers clarity and flexibility, which might prove beneficial.

@michiiii michiiii changed the title Adding an attribute to run the command Adding an attribute to run the command on specific targets Dec 21, 2023
@q-roland
Copy link
Collaborator

q-roland commented Sep 21, 2024

Hi,

Very sorry for the delay. Thank you for your suggestion. It has been on my TODO list for quite some months now, but I could not find the time to implement it, and will probably not be able to do so in the near future.

As you noted, restricting payload execution to certain target hosts can be performed in the payload logic itself, although it may be interesting to have an option performing this action for the user (by simply wrapping the payload in a condition such as the one you proposed in your issue).

If you are willing to implement it, please submit a pull request and I'Il gladly have a look at it and merge it :)

Thanks again!

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

No branches or pull requests

2 participants