Fetch List of Scripts from Library API
This API lets you fetch the list of scripts from script library.
Input ParametersInput Parameters
| Parameter | Mandatory/Optional | Data Type | Description |
|---|---|---|---|
| filter | Optional | String | Filter the API results based on module code, script meta data and QID custom script meta data. |
| includeScriptContent | Optional | String | Use to include the script content in list result. |
| pageNumber | Optional | Integer | The page to be returned. Starts from zero. |
| pageSize | Optional | Number | The number of records per page to be included in the response. Default is 10. |
| sort | Optional | String | Sort the results using a Qualys token. For example - [{"title":"asc"}] |
API Request
curl -X POST 'https://<qualys_base_url> /sm/v1/script-library/search' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <authToken>' \
--data '{"filter":"moduleCode:CAR ","includeScriptContent":true}'
Response
{
"body": {
"totalCount": 1,
"list": [
{
"scriptLanguage": {
"name": "PowerShell-Script",
"id": 4
},
"scriptContent": "IyEvYmluL3NoCiMgVGhpcyBpcyBiYXNoIHByb2dyYW0gdG8gZGlzcGxheSBIZWxsbyBXb3JZAplY2hvICIgSGVsbG8gV29ybGQgaW4gc2NyaXB0IDMiCg==",
"lastCommittedDatetime": 1764248892000,
"displayName": "Adjust Event Log Size.ps1",
"description": "If the event log size is insufficient, overwrites may occur before relevant data exported from the Windows Event Log. To prevent overwrites, you can increase the maximum size of these event logs.The script will set a custom log size for the events logs.",
"threshold": 0,
"title": "Adjust Event Log Size.ps1",
"type": {
"name": "Custom Script",
"id": 1
},
"patchScriptsMetadata": null,
"platform": "WINDOWS",
"categoryDescription": "Contains scripts to manage Windows Event Viewer Log on the host.",
"mode": "Standard",
"autorScriptsMetadata": null,
"vmdrScriptMetadata": null,
"customScriptsMetadata": {
"severity": "3",
"qids": null,
"hasParameters": false,
"softwarePackageMetadata": null,
"name": "Adjust Event Log Size.ps1",
"description": "If the event log size is insufficient, overwrites may occur before relevant data exported from the Windows Event Log. To prevent overwrites, you can increase the maximum size of these event logs.The script will set a custom log size for the events logs.",
"subType": "Response",
"threshold": "500",
"params": null,
"thresholdTimeUnit": "SECOND",
"disclaimer": "THIS SCRIPT IS PROVIDED TO YOU \"AS IS.\" TO THE EXTENT PERMITTED BY LAW, QUALYS HEREBY DISCLAIMS ALL WARRANTIES AND LIABILITY FOR THE PROVISION OR USE OF THIS SCRIPT. IN NO EVENT SHALL THESE SCRIPTS BE DEEMED TO BE CLOUD SERVICES AS PROVIDED BY QUALYS",
"qidCveMapping": null
},
"id": "278042",
"disclaimer": "THIS SCRIPT IS PROVIDED TO YOU \"AS IS.\" TO THE EXTENT PERMITTED BY LAW, QUALYS HEREBY DISCLAIMS ALL WARRANTIES AND LIABILITY FOR THE PROVISION OR USE OF THIS SCRIPT. IN NO EVENT SHALL THESE SCRIPTS BE DEEMED TO BE CLOUD SERVICES AS PROVIDED BY QUALYS",
"severity": 0,
"ispmScriptsMetadata": null,
"moduleCode": "CAR",
"created": {
"dateTime": 1774509849741,
"user": null
},
"iconClass": "qx qx-remediation",
"scriptLibraryId": 219348637,
"versions": [
{
"fullPath": "CAR/Windows Event Viewer/Custom Script/Windows/PowerShell-Script/1/Adjust Event Log Size/Adjust Event Log Size.ps1",
"path": "CAR/Windows Event Viewer/Custom Script/Windows/PowerShell-Script/1/Adjust Event Log Size/Adjust Event Log Size.ps1",
"version": "1",
"sha": "d81723c780a0c862f917eddf583b0276652e1df0"
}
],
"customQidMetadata": null,
"systemCategory": false,
"lastUpdatedDateTime": 1774509849741,
"category": {
"name": "Windows Event Viewer",
"id": 0
},
"status": null,
"isEnable": true,
"scriptContent": ""
}
]
}
}
API Request
curl --location '<qualys_base_url>/sm/v1/script-library/search' \
--request POST \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <YOUR_BEARER_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"filter": "moduleCode:CAR and category:Osquery and platform:WINDOWS and language:PowerShell-Script",
"sort": "[{\"title\":\"asc\"}]",
"pageNumber": 0,
"pageSize": 3,
"includeScriptContent": true
}'
Response
[
{
"body": {
"totalCount": 1,
"list": [
{
"severity": 0,
"scriptContent": "IyEvYmluL3NoCiMgVGhpcyBpcyBiYXNoIHByb2dyYW0gdG8gZGlzcGxheSBIZGxsbyBXb3JZAplY2hvICIgSGVsbG8gV29ybGQgaW4gc2NyaXB0IDMiCg==",
"customScriptMetadata": null,
"moduleCode": "AUTOR",
"scriptLanguage": {
"name": "Shell",
"id": 6
},
"created": {
"dateTime": 1681122311775,
"user": null
},
"description": null,
"threshold": 0,
"title": "script4.sh",
"type": {
"name": "Custom Script",
"id": 1
},
"platform": "LINUX",
"autorScriptsMetadata": {
"tech": [
"Windows 10",
"CentOS 7.x"
],
"name": "script4.sh",
"policies": [
"cis redhat 8 linux enterprise v3.1.0"
],
"benchmarkType": "CIS",
"cid": "7988"
}
},
{
"severity": 0,
"scriptContent": "LS0tLS0tLS0tLS0tIEVPUyBDSUQgMTA1MiAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0K",
"customScriptMetadata": null,
"moduleCode": "AUTOR",
"scriptLanguage": {
"name": "PowerShell-Script",
"id": 4
},
"created": {
"dateTime": 1681736085425,
"user": null
},
"description": null,
"threshold": 0,
"title": "1052.ps1",
"type": {
"name": "Custom Script",
"id": 1
},
"platform": "WINDOWS",
"autorScriptsMetadata": {
"tech": [
"Red Hat Linux 7.0",
"Windows 10"
],
"name": "1052.ps1",
"policies": [
"CIS Benchmark for Microsoft Windows 10 Enterprise RTM (Release 1511), v1.1.0 [Scored, Level 1+ BitLocker and Level 2+ BitLocker] v.2.0"
],
"benchmarkType": "CIS",
"cid": "7337"
},
"versions": [
{
"path": "AUTOR/Remediation/Custom Script/Windows/PowerShell-Script/v1/CIS/1052.ps1",
"version": "v1",
"sha": "d697ad836009ea29f86abf01d0bf1573e2ad563b"
}
],
"vmdrScriptMetadata": null,
"id": "1039",
"lastUpdatedDateTime": 1681736085425,
"category": {
"name": "Remediation",
"id": 7
},
"disclaimer": null,
"status": null
}
]
}
}
]
To know the details of the response codes, refer to Appendix.