Skip to main content

File Intel | Python SDK

The File Intel service enables you to submit a file's hash and get the file's attributes back - giving you insight into the disposition of the file.

Initializes a new Pangea service client.

FileIntel(token, config, logger_name)

str

Pangea API token.

PangeaConfig | None

Configuration.

str

Logger name.

Download file

FileIntel.download_file(url, filename)

Download a file from the specified URL and save it with the given filename.

str

URL of the file to download

str | None

Name to save the downloaded file as. If not provided, the filename will be determined from the Content-Disposition header or the URL.

Reputation, from filepath

FileIntel.filepath_reputation(filepath, provider, verbose, raw)

Retrieve a reputation score for a file hash from a provider, including an optional detailed report. This function calculates a hash from the file at a given filepath and makes a request to the service.

str

The path to the file to be looked up

str

Use reputation data from these providers: "reversinglabs" or "crowdstrike"

bool

Echo the API parameters in the response

bool

Include raw data from this provider

A PangeaResponse where the sanctioned source(s) are in the response.result field. Available response fields can be found in our API documentation.

response = file_intel.filepath_reputation(
    filepath="./myfile.exe",
    provider="reversinglabs",
)

Reputation, from filepath V2

FileIntel.filepath_reputation_bulk(filepaths, provider, verbose, raw)

Retrieve reputation scores for a list of file hashes from a provider, including an optional detailed report. This function calculates hashes from the files at the given filepaths and makes a request to the service.

List[str]

The path list to the files to be looked up

str

Use reputation data from these providers: "reversinglabs" or "crowdstrike"

bool

Echo the API parameters in the response

bool

Include raw data from this provider

A PangeaResponse where the sanctioned source(s) are in the response.result field. Available response fields can be found in our API documentation.

response = file_intel.filepath_reputation_bulk(
    filepaths=["./myfile.exe"],
    provider="reversinglabs",
)

Reputation check

FileIntel.hash_reputation(hash, hash_type, provider, verbose, raw)

Retrieve a reputation score for a file hash from a provider, including an optional detailed report.

str

The hash of the file to be looked up

str

One of "sha256", "sha", "md5"

str

Use reputation data from these providers: "reversinglabs" or "crowdstrike"

bool

Echo the API parameters in the response

bool

Include raw data from this provider

A PangeaResponse where the sanctioned source(s) are in the response.result field. Available response fields can be found in our API documentation.

response = file_intel.hash_reputation(
    hash="179e2b8a4162372cd9344b81793cbf74a9513a002eda3324e6331243f3137a63",
    hash_type="sha256",
    provider="reversinglabs",
)

Reputation check V2

FileIntel.hash_reputation_bulk(hashes, hash_type, provider, verbose, raw)

Retrieve reputation scores for a set of file hashes from a provider, including an optional detailed report.

List[str]

The hash of each file to be looked up

str

One of "sha256", "sha", "md5"

str

Use reputation data from these providers: "reversinglabs" or "crowdstrike"

bool

Echo the API parameters in the response

bool

Include raw data from this provider

A PangeaResponse where the sanctioned source(s) are in the response.result field. Available response fields can be found in our API documentation.

response = file_intel.hash_reputation_bulk(
    hashes=["179e2b8a4162372cd9344b81793cbf74a9513a002eda3324e6331243f3137a63"],
    hash_type="sha256",
    provider="reversinglabs",
)

Poll result

FileIntel.poll_result(exception)

Returns request's result that has been accepted by the server

Optional[AcceptedRequestException]

Exception that was previously raised by the SDK on a call that is being processed.

PangeaResponse

response = service.poll_result(exception)