OpenOTP - OpenOTP.Domain_Report

The OpenOTP.Domain_Report method is used to get statistics on user metadata and user settings for all users in the domain.

The only required parameter is the domain name of the LDAP domain for which you want to get the statistics.
The optional parameters are the filter and the settings. If no search filter is defined then any extended user will be included in the output. You can define the array settings with different additional OpenOTP settings to return them in the final array.
There are 5 other optional parameters, which are all boolean settings :

  • token to get the OTP token information,
  • u2f to return the U2F device information,
  • block to know the blocking information,
  • expire to have the AD password expiration information,
  • reset to reset the statistics.

This method returns an array indexed with users' DN containing the user statistics on success and false on error.


import requests
import json

# Define the method and parameters
method = 'OpenOTP.Domain_Report'
params = {
    'domain': 'RCDEVSDOCS',
    'filter': '(&(objectclass=*)(sAMAccountName=a*))',
    'settings': [
      'OpenOTP.LoginMode',
      'OpenOTP.OTPType',
      'OpenOTP.OTPPrefix'
    ],
    'token': True,
    'u2f': True,
    'block': True,
    'expire': True,
    'reset': True
}

# Create the request payload
request_payload = {
    'jsonrpc': "2.0",
    'method': method,
    'params': params,
    'id': 0
}

# Convert payload to JSON
json_payload = json.dumps(request_payload)

# Define the URL and credentials
url = "https://webadm1.rcdevsdocs.com/manag/"
auth = ("RCDEVSDOCS\\administrator", "password")

# Define the headers
headers = {
    "Content-Type": "application/json",
    "Connection": "close"
}

# Make the POST request
response = requests.post(url, data=json_payload, headers=headers, auth=auth, verify=False)

# Print the HTTP response code and response content
print(f"HTTP response code: {response.status_code}")
print(response.json())
    

<?php
$method = 'OpenOTP.Domain_Report';
$params = array(
    'domain' => 'RCDEVSDOCS',
    'filter' => '(&(objectclass=*)(sAMAccountName=a*))',
    'settings' => array(
      'OpenOTP.LoginMode',
      'OpenOTP.OTPType',
      'OpenOTP.OTPPrefix'
    ),
    'token' => true,
    'u2f' => true,
    'block' => true,
    'expire' => true,
    'reset' => true
);

$request = array(
    'jsonrpc' => "2.0",
    'method' => $method,
    'params' => $params,
    'id' => 0
);
$json = json_encode($request);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://webadm1.rcdevsdocs.com/manag/");
curl_setopt($ch, CURLOPT_USERPWD, "RCDEVSDOCS\\administrator:password");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("connection: close"));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
$out = curl_exec($ch);
curl_close($ch);

print_r(json_decode($out));
?>
    

# Define the method and parameters
$method = 'OpenOTP.Domain_Report'
$params = @{
    domain = 'RCDEVSDOCS'
    filter = '(&(objectclass=*)(sAMAccountName=a*))'
    settings = @(
      'OpenOTP.LoginMode',
      'OpenOTP.OTPType',
      'OpenOTP.OTPPrefix'
    )
    token = $true
    u2f = $true
    block = $true
    expire = $true
    reset = $true
}

# Create the request payload
$requestPayload = @{
    'jsonrpc' = '2.0'
    'method' = $method
    'params' = $params
    'id' = 0
}

# Convert the request payload to JSON
$jsonPayload = $requestPayload | ConvertTo-Json

# Define the URL and credentials
$url = "https://webadm1.rcdevsdocs.com/manag/"
$auth = "RCDEVSDOCS\administrator:password"

# Make the POST request
$response = Invoke-RestMethod -Uri $url -Method Post -Body $jsonPayload -Headers @{ "Content-Type" = "application/json" } -Credential (New-Object System.Management.Automation.PSCredential($auth, (ConvertTo-SecureString "password" -AsPlainText -Force))) -SkipCertificateCheck

# Output the response
Write-Host "HTTP Response Code: $($response.status_code)"
Write-Host $response | ConvertTo-Json