Retrieves file detection results in batches by HashKey.
Operation description
You can retrieve detection results only for files that have been submitted for detection. Detection results are retained for 5 hours and can be queried repeatedly within this period. To submit files for detection, refer to CreateFileDetect.
File unique identifier
All file detection-related operations include the HashKey parameter, which represents the unique identifier of the file being detected and is used to query detection results. Only the MD5 or SHA-256 hash of the complete file content is supported.
Query detection results
You can filter file properties by using the FileLabel field in the Ext extension field. For example, you can combine the encrypted and Zip properties to filter encrypted archives. Supported file labels for compressed file types: Zip, RAR, 7-Zip, XAR, ZLib, GZip, and tar. You can use the Highlight field in the Ext extension field to locate malicious code segments in web shell files. The Highlight field is a list type. Each element in the list corresponds to a code range, and the numbers represent the offset in characters from the beginning of the file.
Before querying file detection results, complete the following steps in order:
Call CreateFileDetectUploadUrl to obtain OSS upload parameters.
Use the returned signature information to upload the file to OSS by using a form. For more information about the upload method, see OSS PostObject form upload documentation.
Call CreateFileDetect to submit a file detection task.
Call GetFileDetectResult to query the detection result.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
yundun-sas:GetFileDetectResult |
get |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| SourceIp |
string |
No |
The source IP address of the request. |
183.46.XX.XX |
| HashKeyList |
array |
Yes |
The list of file identifiers. A maximum of 200 elements can be specified. |
|
|
string |
No |
The unique identifier of the file. |
0a212417e65c26ff133cfff28f9c**** |
|
| Type |
integer |
Yes |
The type of file to detect. Valid values:
|
0 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| RequestId |
string |
The request ID, which is a unique identifier generated by Alibaba Cloud for this request. You can use it to troubleshoot issues. |
24A20733-10A0-4AF6-BE6B-E3322413BB68 |
| ResultList |
array<object> |
The list of detection results. |
|
|
object |
The file detection result information. |
||
| HashKey |
string |
The file identifier. |
0a212417e65c26ff133cfff28f6c**** |
| Result |
integer |
The file detection result. Valid values:
|
0 |
| Score |
integer |
The file detection score. The mapping between score ranges and risk levels is as follows:
Important A higher score indicates a more suspicious file. This field is returned only when Result is 1 (suspicious file). This field is not returned when Result is 0 or 3. |
100 |
| VirusType |
string |
The virus type. Valid values:
Note
This parameter is not supported when Result is 0 or 3. This field is returned only when Result is 1 (suspicious file). This field is not returned when Result is 0 or 3. |
WebShell |
| Code |
string |
The result code. A value of 200 indicates success. Any other value indicates failure. You can use this field to determine the cause of the failure. |
200 |
| Message |
string |
The detailed information about the error code. |
successful |
| Ext |
string |
The extended information of the detection result. |
{ "HighLight": [ [ 23245, 23212 ] ], "FileLabel": [ "PE32", "Zip", "SFX", "encrypted" ] } |
| Compress |
boolean |
Indicates whether the file is identified as a compressed archive.
Note
This parameter is not supported when Type is 6. |
false |
The following example shows a single result in the detection result list. Other response fields are omitted.
Safe file (Result is 0). Score and VirusType are not returned:
{"Result": 0}
Suspicious file (Result is 1). Score and VirusType are returned:
{"Result": 1, "Score": 100, "VirusType": "WebShell"}
Examples
Success response
JSON format
{
"RequestId": "24A20733-10A0-4AF6-BE6B-E3322413BB68",
"ResultList": [
{
"HashKey": "0a212417e65c26ff133cfff28f6c****",
"Result": 0,
"Score": 100,
"VirusType": "WebShell",
"Code": "200",
"Message": "successful",
"Ext": "{\n \"HighLight\":\n [\n [\n 23245,\n 23212\n ]\n ],\n \"FileLabel\":\n [\n \"PE32\",\n \"Zip\",\n \"SFX\",\n \"encrypted\"\n ]\n}",
"Compress": false
}
]
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | RequestTooFrequently | Request too frequently, please try again later | |
| 400 | GetResultFail | Get result fail, found no detect record for this file or result has been expired | |
| 400 | InvalidApiDetectType | Unsupported Api Detect Type. | The file type is not supported. |
| 500 | ServerError | ServerError | |
| 500 | SystemBusy | System busy, please try again later. | |
| 403 | NoPermission | caller has no permission | You are not authorized to do this operation. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.