Exemple #1
0
        public static void Execute(Job job, Agent implant)
        {
            Task task = job.Task;

            NetLocalGroupArguments args = JsonConvert.DeserializeObject <NetLocalGroupArguments>(task.parameters);

            if (string.IsNullOrEmpty(args.group))
            {
                job.SetError("Missing required parameter: group");
                return;
            }
            if (string.IsNullOrEmpty(args.computer))
            {
                args.computer = Environment.GetEnvironmentVariable("COMPUTERNAME");
            }
            try
            {
                var results = ADUtils.GetLocalGroupMembers(args.computer, args.group);
                job.SetComplete(results);
            } catch (Exception ex)
            {
                job.SetError($"Error fetching members of {args.group}. LastWin32Error: {Marshal.GetLastWin32Error()}");
            }
        }