Raw File Analysis
Initiates a fresh analysis on the uploaded code file.
POST /analyzer/raw/
CURL Command Examples
Below are examples to demonstrate the diverse ways you can interact with our API using CURL commands.
1. Direct File Upload
Scenario: Directly upload a C file for analysis.
curl -s -X POST --data-binary @file.c \
-H "Authorization: Token Y2KSEC_API_KEY" \
https://api.y2ksecurity.com/v1/analyzer/raw/ | jq '.'
2. Piping File Content
Scenario: Pipe the content of a PHP file and upload it for analysis. The analysis result will be saved into file_vuln_result.txt.
cat file.php | curl -s -X POST --data-binary @- \
-H "Authorization: Token Y2KSEC_API_KEY" \
https://api.y2ksecurity.com/v1/analyzer/raw/ | \
jq -r '.result_base64' | base64 --decode | tee file_vuln_result.txt
3. Batch Upload
Scenario: When you want to send several files at once. Here, we're using a delimiter (---END---) to separate the content of two Java files.
(echo "---END---"; cat file1.java; echo "---END---"; cat file2.java) | \
curl -s -X POST --data-binary @- \
-H "Authorization: Token Y2KSEC_API_KEY" \
https://api.y2ksecurity.com/v1/analyzer/raw/ | \
jq -r '.result_base64' | base64 --decode | tee batch_vuln_result.txt
4. Upload from an Online Source
Scenario: To analyze a file directly from an online source, such as a GitHub repository.
curl -sL [RAW_GITHUB_LINK] | \
curl -s -X POST --data-binary @- \
-H "Authorization: Token Y2KSEC_API_KEY" \
https://api.y2ksecurity.com/v1/analyzer/raw/ | \
jq -r '.result_base64' | base64 --decode | tee online_vuln_result.txt
Responses
200 OK
Example Content:
{
"result_base64": "encoded_analysis_result",
"vulnerabilities": {
"vulnerability_1": "Description of vulnerability_1",
"vulnerability_2": "Description of vulnerability_2"
}
}
400 BAD REQUEST
Condition: If the uploaded file exceeds the size or line count constraints.
Example Content:
{
"message": "The maximum file size is 5MB."
}