check_falconctl_registration

in chef/cookbooks/cpe_crowdstrike_falcon_sensor/resources/cpe_crowdstrike_falcon_sensor.rb [557:581]


  def check_falconctl_registration(falconctl_path = falcon_agent_prefs['falconctl_path'])
    
    status = ''

    return status if (debian? || macos?) && !::File.exists?(falconctl_path)

    if macos?
      cmd = shell_out("#{falconctl_path} stats").stdout.to_s
      if cmd.nil? || cmd.empty?
        return status
      else
        
        status = cmd[/State: (.*?)(?=\s)/, 1]
      end
    elsif debian?
      cmd = shell_out("#{falconctl_path} -g --cid").stdout.to_s
      if cmd.nil? || cmd.empty?
        return status
      else
        status = cmd[/cid..(\w+)/, 1] 
      end
    end
    status
  end