Back to File Analyzer API

Static File Analysis

Try this endpoint in the playground →
POST/v1/file/analyze

Submit a script file for heuristic static analysis. Detects malicious patterns, extracts indicators of compromise, identifies obfuscation techniques, maps findings to MITRE ATT&CK, and produces a confidence-scored verdict — all without executing the file.

Permission

file:read

Credits

5 per request

Plans

All plans

Max Size

5 MB

Request

Send the file as multipart/form-data. Do not set Content-Type manually — let your HTTP client set the correct boundary.

# Multipart form-data upload
# Field: file (required) — the script file to analyze
FieldTypeRequiredDescription
fileFileYesThe script file to analyze. Maximum size: 5 MB. See supported file types below.

Supported File Types

The static analyzer accepts text-based script files only. Binary files are rejected.

ExtensionType
.ps1PowerShell scripts
.vbs / .vbeVBScript (plain and encoded)
.js / .jseJScript / JavaScript (plain and encoded)
.htaHTML Applications
.wsf / .wshWindows Script Files
.bat / .cmdBatch files
.sctWindows Scriptlet / COM Scriptlet
.txtPlain text (script content)

Response

{
  "data": {
    "file_name": "suspicious.ps1",
    "file_size": 4312,
    "file_type": "ps1",
    "mime_type": "text/x-powershell",
    "sha256": "e3b0c44298fc1c149afbf4c8996fb924...",
    "entropy": 4.87,
    "entropy_assessment": "moderate — consistent with obfuscated script",
    "verdict": {
      "level": "malicious",
      "score": 82,
      "summary": "PowerShell script with high-confidence malicious indicators including encoded payload download, credential access, and persistence via registry.",
      "recommended_actions": [
        "Quarantine immediately",
        "Investigate process execution history",
        "Check for registry persistence keys"
      ]
    },
    "findings": [
      {
        "id": "ps1-encoded-download",
        "category": "payload_delivery",
        "severity": "critical",
        "title": "Encoded Download Cradle",
        "description": "Script uses IEX with encoded command to download and execute remote payload.",
        "evidence": "IEX ([System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String(...)))",
        "line": 14,
        "mitre_technique": "T1059.001"
      },
      {
        "id": "ps1-registry-persistence",
        "category": "persistence",
        "severity": "danger",
        "title": "Registry Run Key Persistence",
        "description": "Writes to HKCU\\Run to establish persistence on user login.",
        "evidence": "Set-ItemProperty -Path 'HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Run'",
        "line": 31,
        "mitre_technique": "T1547.001"
      }
    ],
    "extracted_scripts": [
      {
        "language": "powershell",
        "content": "...",
        "start_line": 1,
        "end_line": 45
      }
    ],
    "iocs": [
      {
        "type": "url",
        "value": "https://evil[.]example[.]com/payload.bin",
        "defanged": "https://evil[.]example[.]com/payload.bin",
        "context": "Download cradle at line 14"
      },
      {
        "type": "domain",
        "value": "evil[.]example[.]com",
        "defanged": "evil[.]example[.]com",
        "context": "C2 domain extracted from download URL"
      }
    ],
    "obfuscation": {
      "score": 71,
      "indicators": [
        "Base64-encoded payload",
        "String concatenation to hide keywords",
        "Variable name randomization"
      ]
    },
    "metadata": {
      "script_languages": ["powershell"],
      "has_embedded_scripts": false,
      "uses_activex": false,
      "uses_wmi": false,
      "uses_powershell": true,
      "uses_network": true,
      "uses_filesystem": true,
      "uses_registry": true,
      "attempts_persistence": true,
      "attempts_evasion": true
    }
  },
  "meta": {
    "request_id": "req_a1b2c3d4-...",
    "credits_used": 5,
    "credits_remaining": 495,
    "processing_time_ms": 312
  }
}
FieldTypeDescription
data.file_namestringOriginal filename as submitted
data.file_sizenumberFile size in bytes
data.file_typestringDetected script type (e.g. ps1, vbs, js)
data.mime_typestringMIME type of the file
data.sha256stringSHA-256 hash of the file content
data.entropynumberShannon entropy score (0–8); higher values may indicate obfuscation or packing
data.entropy_assessmentstringHuman-readable interpretation of the entropy value
data.verdict.levelstring"clean", "suspicious", "malicious", or "highly_malicious"
data.verdict.scorenumberAggregate risk score from 0 (safe) to 100 (critical)
data.verdict.summarystringHuman-readable summary of the verdict and detected behaviors
data.verdict.recommended_actionsstring[]List of recommended analyst actions based on findings
data.findingsarrayIndividual detection findings with id, category, severity, title, description, evidence, optional line number, and optional MITRE technique
data.extracted_scriptsarrayEmbedded script blocks with language, content, and line range
data.iocsarrayExtracted indicators: type, value, defanged form, and context
data.obfuscation.scorenumberObfuscation severity score from 0 (none) to 100 (heavy)
data.obfuscation.indicatorsstring[]List of detected obfuscation techniques
data.metadataobjectBoolean flags for script capabilities: network, filesystem, registry, ActiveX, WMI, PowerShell, persistence, evasion
meta.request_idstringUnique request identifier for support and debugging
meta.credits_usednumberCredits consumed (always 5)
meta.credits_remainingnumberRemaining credit balance after this request
meta.processing_time_msnumberServer-side processing time in milliseconds

Code Examples

cURL
curl -X POST https://api.dfir-lab.ch/v1/file/analyze \
  -H "Authorization: Bearer sk-dfir-your-key-here" \
  -F "file=@suspicious.ps1"
Python
import requests

with open("suspicious.ps1", "rb") as f:
    response = requests.post(
        "https://api.dfir-lab.ch/v1/file/analyze",
        headers={"Authorization": "Bearer sk-dfir-your-key-here"},
        files={"file": ("suspicious.ps1", f, "application/octet-stream")},
    )

data = response.json()
result = data["data"]
verdict = result["verdict"]

print(f"Verdict: {verdict['level']} (score: {verdict['score']}/100)")
print(f"SHA-256: {result['sha256']}")
print(f"Entropy: {result['entropy']:.2f} ({result['entropy_assessment']})")
print(f"Findings: {len(result['findings'])}")
print(f"IOCs extracted: {len(result['iocs'])}")

for finding in result["findings"]:
    print(f"  [{finding['severity'].upper()}] {finding['title']}")
    if finding["mitre_technique"]:
        print(f"    MITRE: {finding['mitre_technique']}")

print(f"Credits used: {data['meta']['credits_used']}")

Important Notes

  • Static analysis does not execute the file. It uses heuristic pattern matching against known malicious constructs. For execution-based analysis, use the Deep Analysis endpoint with analysis_type: "dynamic".
  • Binary files are rejected with 400 binary_file. Only text-based script files are accepted.
  • Results are returned synchronously. The endpoint blocks until analysis is complete (typically under 500 ms for files under 5 MB).
  • IOC values in the response are defanged (brackets inserted in domains and URLs) to prevent accidental navigation.