API

This is the inlyse-python modules API documentation.

inlyse.cli — INLYSE API client module

The module bundles all available clients for the INLYSE API.

class inlyse.cli.InlyseResponse(endpoint, status, rate_limit, content_type, content)[source]

A response of the INLYSE API

Parameters:
  • endpoint (str) – The API endpoint

  • status (int) – The HTTP status code of the response

  • rate_limit (dict or None) – The rate limit status. Which includes the time for the next renewal and the remaining number of requests.

  • content_type (tuple) – The MIME type of the content. In example: application/json.

  • content (Any) – The content of the response.

class inlyse.cli.TimeoutHTTPAdapter(*args, **kwargs)[source]
send(request, **kwargs)[source]

Sends PreparedRequest object. Returns Response object.

Parameters:
  • request – The PreparedRequest being sent.

  • stream – (optional) Whether to stream the request content.

  • timeout (float or tuple or urllib3 Timeout object) – (optional) How long to wait for the server to send data before giving up, as a float, or a (connect timeout, read timeout) tuple.

  • verify – (optional) Either a boolean, in which case it controls whether we verify the server’s TLS certificate, or a string, in which case it must be a path to a CA bundle to use

  • cert – (optional) Any user-provided SSL certificate to be trusted.

  • proxies – (optional) The proxies dictionary to apply to the request.

Return type:

requests.Response

class inlyse.cli.WebClient(license_key, url='https://malware.ai', timeout=(5, 60))[source]

INLYSE API web client

Parameters:
  • license_key (str) – A license key for the INLYSE API

  • url (str) – (optional) The URL of the INLYSE API. (Default: https://malware.ai)

  • timeout (float or tuple) – (optional) How long to wait for the server to send data before giving up, as a float, or a (connect timeout, read timeout) tuple. The excat same behavior like for python requests. (Default: (5, 60))

Example:

>>> from inlyse import WebClient
>>> with WebClient("<your license key>") as client:
...    client.ping()

It is also possible to use the raw API GET or POST requests like this:

>>> from inlyse import WebClient
>>> with WebClient("<your license key>") as client:
...    client.api.get("/ping")
...    response = client.api.get("/api/stats")
...    print(response.status_code)
...    print(response.json())
200
{'AnalysedFiles': 293, 'Traffic': 266161837}

These methods will return a requests.Response object.

check(analysis_id)[source]

Get an analysis by ID

Parameters:

analysis_id (str) – The UUID of the analysis.

  • API endpoint: /api/analysis/<id>

  • HTTP Method: GET

  • Response CONTENT-TYPE: application/json

HTTP Response Codes

Status Code

Explaination

200 - OK

If the request was successful, it returns the HTTP status code 200 and the result of the analysis.

202 - Accepted

If the the analysis is not ready yet, it returns the HTTP status code 202.

404 - Not Found

If the analysis with the given UUID does not exist the API returns the status code 404 and a short explaination about the error.

401 - Unauthorized

If the request was not authorized. In example if the license key is not valid anymore.

429 - Too Many Requests

If the quota is exceed, it returns the HTTP status 429.

Example:

>>> from inlyse import WebClient
>>> client = WebClient(<your license key>)
>>> response = client.check("1a13ba09-8487-4621-b2a3-b0ff460f7a9e")
>>> response
InlyseResponse(
    endpoint='/api/analysis/1a13ba09-8487-4621-b2a3-b0ff460f7a9e',
    status=200,
    rate_limit={
        'remaining': '14997',
        'reset': datetime.datetime(
            2023, 3, 20, 22, 16, 47, tzinfo=datetime.timezone.utc
        )
    },
    content_type=('application/json', {'charset': 'UTF-8'}),
    content={
        'ID': '1a13ba09-8487-4621-b2a3-b0ff460f7a9e',
        'MD5': '7cdba4461284f8e5b5646ee0b502ec55',
        'SHA1': 'e7ccdd6706a1ec8ac8d21e5b7d152d3e60acfe7c',
        'SHA256': '55e2e5b4752c3c0626c70efa86041c7429a3322beed516bb35d96fa4edd9948b',
        'SHA512': 'f068074c5b24133fc97febf5d534961a11cecbf0f17ac46246bdc4cb45d60b84d01ff2df77860d1db69cd37d198331fd9fbc7237e49f74a55af3672e532f6d45',
        'Filename': '2004.14471.pdf',
        'Size': 1354850,
        'FileType': 'application/pdf',
        'Label': 'benign',
        'ScoreBenign': '0.9507668964520833',
        'ScoreMalicious': '0.04923310354791669'
    }
)
>>> client.close()
Returns:

Returns an inlyse.cli.InlyseResponse object.

Return type:

InlyseResponse

close()[source]

Close the HTTP session

disarm_analysis(analysis_id)[source]

Disarm a file of a previous analysis.

Parameters:

analysis_id (str) – The UUID of an analysis.

Warning

Maybe the file has been already deleted. The file gets deleted after 30 seconds when the analysis has been completed. INLYSE saves only the analysis result permanently.

  • API endpoint: /api/analysis/<id>/disarm

  • HTTP Method: GET

  • Response CONTENT-TYPE: application/pdf

HTTP Response Codes

Status Code

Explaination

200 - OK

If the request was successful, it returns the HTTP status code 200 and the disarmed PDF document. Microsoft Office documents get converted into PDF documents.

404 - Not Found

If the analysis with the given UUID does not exist or the corresponding file of the analysis has already been deleted the API returns the status code 404 and a short explaination about the error.

401 - Unauthorized

If the request was not authorized. In example if the license key is not valid anymore.

429 - Too Many Requests

If the quota is exceed, it returns the HTTP status 429.

Example:

>>> from inlyse import WebClient
>>> client = WebClient(<your license key>)
>>> response = client.disarm_analysis("0ef3822b-481d-4368-88ea-6a2417bb2dac")
>>> response
InlyseResponse(
    endpoint='/api/analysis/0ef3822b-481d-4368-88ea-6a2417bb2dac/disarm',
    status=200,
    rate_limit={
        'remaining': '14999',
        'reset': datetime.datetime(
            2023, 3, 21, 19, 44, 12, tzinfo=datetime.timezone.utc
        )
    },
    content_type=('application/pdf', {}),
    content=b'%PDF-1.7...%%EOF'
)
>>> client.close()
Returns:

Returns an inlyse.cli.InlyseResponse object.

Return type:

InlyseResponse

disarm_file(filename, content)[source]

Disarm a local file.

Parameters:
  • filename (str) – The name of the file.

  • content (bytes) – The content of the file.

  • API endpoint: /api/files/disarm

  • HTTP Method: POST

  • Response CONTENT-TYPE: application/json

HTTP Response Codes

Status Code

Explaination

200 - OK

If the request was successful, it returns the HTTP status code 200 and the disarmed PDF document. Microsoft Office documents get converted into PDF documents.

401 - Unauthorized

If the request was not authorized. In example if the license key is not valid anymore.

429 - Too Many Requests

If the quota is exceed, it returns the HTTP status 429.

Example:

>>> from inlyse import WebClient
>>> client = WebClient(<your license key>)
>>> with open("/tmp/javascript.pdf", "rb") as fp:
...     response = client.disarm_file(os.path.basename(fp.name), fp.read())
>>> response
InlyseResponse(
    endpoint='/api/files/disarm',
    status=200,
    rate_limit={
        'remaining': '14999',
        'reset': datetime.datetime(
            2023, 3, 21, 19, 44, 12, tzinfo=datetime.timezone.utc
        )
    },
    content_type=('application/pdf', {}),
    content=b'%PDF-1.7...%%EOF'
)
>>> client.close()
Returns:

Returns an inlyse.cli.InlyseResponse object.

Return type:

InlyseResponse

download(analysis_id)[source]

Download a file of a previous analysis.

Parameters:

analysis_id (str) – The UUID of an analysis.

Warning

Maybe the file has been already deleted. The file gets deleted after 30 seconds when the analysis has been completed. INLYSE saves only the analysis result permanently.

  • API endpoint: /api/analysis/<id>/download

  • HTTP Method: GET

  • Response CONTENT-TYPE: application/pdf, application/msexcel, ..

HTTP Response Codes

Status Code

Explaination

200 - OK

If the request was successful, it returns the HTTP status code 200 and the requested file.

404 - Not Found

If the analysis with the given UUID does not exist or the corresponding file of the analysis has already been deleted the API returns the status code 404 and a short explaination about the error.

401 - Unauthorized

If the request was not authorized. In example if the license key is not valid anymore.

429 - Too Many Requests

If the quota is exceed, it returns the HTTP status 429.

Example:

>>> from inlyse import WebClient
>>> client = WebClient(<your license key>)
>>> download = client.download("0ef3822b-481d-4368-88ea-6a2417bb2dac")
>>> download
InlyseResponse(
    endpoint='/api/analysis/0ef3822b-481d-4368-88ea-6a2417bb2dac/download'
    status=200,
    rate_limit={
        'remaining': '14980',
        'reset': datetime.datetime(
            2023, 3, 20, 19, 45, 38, tzinfo=datetime.timezone.utc
            )
        },
    content_type=('application/pdf', {}),
    conent=b'%PDF-1.4...%%EOF'
)
>>> client.close()
Returns:

Returns an inlyse.cli.InlyseResponse object.

Return type:

InlyseResponse

Create a download link for a previous analysis.

Parameters:

analysis_id (str) – The UUID of an analysis.

Warning

The UUID of the analysis gets not validated.

Example:

>>> from inlyse import WebClient
>>> client = WebClient(<your license key>)
>>> link = client.download_link("0ef3822b-481d-4368-88ea-6a2417bb2dac")
>>> link
'https://malware.ai/api/analysis/0ef3822b-481d-4368-88ea-6a2417bb2dac/download'
>>> client.close()
Returns:

Returns a download link for the file of the specified analysis.

Return type:

str

get_analysis(analysis_id, estimated_time=5.83675, max_retries=3)[source]

Fetch an analysis after uploading a file

Parameters:
  • analysis_id (str) – The UUID of the analysis.

  • estimated_time (float) – (optional) The estimated time for the analysis. (Default: 5.83675)

  • max_retries (int) – (optional) The maxium number of retries to fetch the analysis. (Default: 3)

Raises:

Example:

>>> from inlyse import WebClient
>>> client = WebClient(<your license key>)
>>> response = client.get_analysis("1a13ba09-8487-4621-b2a3-b0ff460f7a9e", 5.83675, 2)
>>> response
InlyseResponse(
    endpoint='/api/analysis/1a13ba09-8487-4621-b2a3-b0ff460f7a9e',
    status=200,
    rate_limit={
        'remaining': '14995',
        'reset': datetime.datetime(
            2023, 3, 20, 22, 16, 47, tzinfo=datetime.timezone.utc
        )
    },
    content_type=('application/json', {'charset': 'UTF-8'}),
    content={
        'ID': '1a13ba09-8487-4621-b2a3-b0ff460f7a9e',
        'MD5': '7cdba4461284f8e5b5646ee0b502ec55',
        'SHA1': 'e7ccdd6706a1ec8ac8d21e5b7d152d3e60acfe7c',
        'SHA256': '55e2e5b4752c3c0626c70efa86041c7429a3322beed516bb35d96fa4edd9948b',
        'SHA512': 'f068074c5b24133fc97febf5d534961a11cecbf0f17ac46246bdc4cb45d60b84d01ff2df77860d1db69cd37d198331fd9fbc7237e49f74a55af3672e532f6d45',
        'Filename': '2004.14471.pdf',
        'Size': 1354850,
        'FileType': 'application/pdf',
        'Label': 'benign',
        'ScoreBenign': '0.9507668964520833',
        'ScoreMalicious': '0.04923310354791669'
    }
)
>>> client.close()
Returns:

Returns an inlyse.cli.InlyseResponse object.

Return type:

InlyseResponse

list_analyses(filter)[source]

Get all analyses.

Parameters:

filter (str, optional) – Filter the analyses by finished, unfinished, error or all.

  • API endpoint: /api/analysis

  • HTTP Method: GET

  • Response CONTENT-TYPE: application/json

HTTP Response Codes

Status Code

Explaination

200 - OK

If the request was successful, it returns the HTTP status code 200 and a list of analysis UUIDs.

404 - Not Found

No analysis found

401 - Unauthorized

If the request was not authorized. In example if the license key is not valid anymore.

429 - Too Many Requests

If the quota is exceed, it returns the HTTP status 429.

It’s possible to filter the analyses by:

  • finished

  • unfinished

  • error

  • all [DEFAULT]

If no filter is applied, you will get all analyses.

Example:

>>> from inlyse import WebClient
>>> client = WebClient(<your license key>)
>>> response = client.list_analyses()
>>> response
InlyseResponse(
    endpoint='/api/analysis',
    status=200,
    rate_limit={
        'remaining': '14998',
        'reset': datetime.datetime(
            2023, 3, 20, 22, 16, 47, tzinfo=datetime.timezone.utc
        )
    },
    content_type=('application/json', {'charset': 'UTF-8'}),
    conent=[
        '079211f4-c401-44fc-a846-01f7ff26e47f',
        '177a9179-c2d2-4d4a-976f-a8e1e4f496a0',
        '2f02e53e-5722-4fb1-b0a2-5ae053b2f00c',
        ...
        '36adec8e-d54f-401b-bc2f-1dd22ea9b099',
    ]
)
>>> client.close()
Returns:

Returns an inlyse.cli.InlyseResponse object.

Return type:

InlyseResponse

ping()[source]

Ping the INLYSE API

  • API endpoint: /ping

  • HTTP Method: GET

  • Response CONTENT-TYPE: application/json

HTTP Response Codes

Status Code

Explaination

200 - OK

If the ping request was successful it returns the HTTP status code 200 and the string Pong.

Example:

>>> from inlyse import WebClient
>>> client = WebClient(<your license key>)
>>> response = client.ping()
>>> response
InlyseResponse(
    endpoint='/ping',
    status=200,
    rate_limit=None,
    content_type=('application/json', {'charset': 'UTF-8'}),
    content='Pong'
)
>>> client.close()
Returns:

Returns an inlyse.cli.InlyseResponse object.

Return type:

InlyseResponse

scan_file(filename, content, max_retries=15)[source]

Uploads a local file and tries to fetch the result.

Parameters:
  • filename (str) – The name of the file.

  • content – The content of the file.

  • max_retries (int) – (optional) The maxium number of retries to fetch the analysis. (Default: 15)

Raises:

Example:

>>> from inlyse import WebClient
>>> client = WebClient(<your license key>)
>>> with open("/tmp/javascript.pdf", "rb") as fp:
...     response = client.scan_file(os.path.basename(fp.name), fp.read())
>>> response
InlyseResponse(
    endpoint='/api/analysis/8f238204-8540-4424-9872-822c46e39c05',
    status=200,
    rate_limit={
        'remaining': '14992',
        'reset': datetime.datetime(
            2023, 3, 20, 22, 16, 47, tzinfo=datetime.timezone.utc
        )
    },
    content_type=('application/json', {'charset': 'UTF-8'}),
    content={
        'ID': '8f238204-8540-4424-9872-822c46e39c05',
        'MD5': '55b47515feeeb8dae78763d662923787',
        'SHA1': '5af3f43e3169e1e678e06b6372a60d9df22dc6d0',
        'SHA256': '1fede472c1e339272f2ea27496ea059e86d6594b1ae93cbb6a486eeb118527e1',
        'SHA512': 'a2fff650ba010c56b51ff4e9f3ee77292651428ad41d467f8c471b4c9091060a3dc64acea22ee875ec6f14abd3e018f944a92e87f4567b71fae05b2d80566880',
        'Filename': 'javascript.pdf',
        'Size': 990,
        'FileType': 'application/pdf',
        'Label': 'malicious',
        'ScoreBenign': '0.0008773440468863303',
        'ScoreMalicious': '0.9991226559531137',
        'Action': 'DELETE;DISARM'
    }
)
>>> client.close()
Returns:

Returns an inlyse.cli.InlyseResponse object.

Return type:

InlyseResponse

scan_owa(url, token, max_retries=15)[source]

Uploads a outlook attachment and tries to fetch the result.

Parameters:
  • url (str) – The download URL of the file.

  • max_retries (int) – (optional) The maxium number of retries to fetch the analysis. (Default: 15)

Raises:

Example:

>>> from inlyse import WebClient
>>> client = WebClient(<your license key>)
>>> response = client.scan_owa(
...     "https://attachments.office.net/owa/Max.Mustermann%40test.com/...",
...     "iMWFWf1EZh8WM27tqXFlIa1QoNDfmjaZT0Xz7IyaDASBCUamUKcMKUSTVYJTOUm5..."
... )
>>> response
InlyseResponse(
    endpoint='/api/analysis/98e56af3-0f17-470b-bfcb-5ef7d4c83e07',
    status=200,
    rate_limit={
        'remaining': '14988',
        'reset': datetime.datetime(
            2023, 3, 20, 22, 16, 47, tzinfo=datetime.timezone.utc
        )
    },
    content_type=('application/json', {'charset': 'UTF-8'}),
    content={
        'ID': '98e56af3-0f17-470b-bfcb-5ef7d4c83e07',
        'MD5': '7cdba4461284f8e5b5646ee0b502ec55',
        'SHA1': 'e7ccdd6706a1ec8ac8d21e5b7d152d3e60acfe7c',
        'SHA256': '55e2e5b4752c3c0626c70efa86041c7429a3322beed516bb35d96fa4edd9948b',
        'SHA512': 'f068074c5b24133fc97febf5d534961a11cecbf0f17ac46246bdc4cb45d60b84d01ff2df77860d1db69cd37d198331fd9fbc7237e49f74a55af3672e532f6d45',
        'Filename': '2004.14471.pdf',
        'Size': 1354850,
        'FileType': 'application/pdf',
        'Label': 'benign',
        'ScoreBenign': '0.9507668964520833',
        'ScoreMalicious': '0.04923310354791669'
    }
)
>>> client.close()
Returns:

Returns an inlyse.cli.InlyseResponse object.

Return type:

InlyseResponse

scan_url(url, max_retries=15)[source]

Uploads a remote file and tries to fetch the result.

Parameters:
  • url (str) – The download URL of the file.

  • max_retries (int) – (optional) The maxium number of retries to fetch the analysis. (Default: 15)

Raises:

Example:

>>> from inlyse import WebClient
>>> client = WebClient(<your license key>)
>>> response = client.scan_url("https://arxiv.org/pdf/2004.14471.pdf")
>>> response
InlyseResponse(
    endpoint='/api/analysis/98e56af3-0f17-470b-bfcb-5ef7d4c83e07',
    status=200,
    rate_limit={
        'remaining': '14988',
        'reset': datetime.datetime(
            2023, 3, 20, 22, 16, 47, tzinfo=datetime.timezone.utc
        )
    },
    content_type=('application/json', {'charset': 'UTF-8'}),
    content={
        'ID': '98e56af3-0f17-470b-bfcb-5ef7d4c83e07',
        'MD5': '7cdba4461284f8e5b5646ee0b502ec55',
        'SHA1': 'e7ccdd6706a1ec8ac8d21e5b7d152d3e60acfe7c',
        'SHA256': '55e2e5b4752c3c0626c70efa86041c7429a3322beed516bb35d96fa4edd9948b',
        'SHA512': 'f068074c5b24133fc97febf5d534961a11cecbf0f17ac46246bdc4cb45d60b84d01ff2df77860d1db69cd37d198331fd9fbc7237e49f74a55af3672e532f6d45',
        'Filename': '2004.14471.pdf',
        'Size': 1354850,
        'FileType': 'application/pdf',
        'Label': 'benign',
        'ScoreBenign': '0.9507668964520833',
        'ScoreMalicious': '0.04923310354791669'
    }
)
>>> client.close()
Returns:

Returns an inlyse.cli.InlyseResponse object.

Return type:

InlyseResponse

stats()[source]

Get the statistics of the used license key. It shows you how many files you have analysed and the traffic in Bytes.

  • API endpoint: /api/stats

  • HTTP Method: GET

  • Response CONTENT-TYPE: application/json

HTTP Response Codes

Status Code

Explaination

200 - OK

If the request was successful it returns the HTTP status code 200 and a dictionary with the number of analyzed files and the produced trafficfor the configured license key.

401 - Unauthorized

If the request was not authorized. In example if the license key is not valid anymore.

429 - Too Many Requests

If the quota is exceed, it returns the HTTP status 429.

Example:

>>> from inlyse import WebClient
>>> client = WebClient(<your license key>)
>>> response = client.stats()
>>> response
InlyseResponse(
    endpoint='/api/stats'
    status=200,
    rate_limit={
        'remaining': '14993',
        'reset': datetime.datetime(
            2023, 3, 20, 19, 45, 38, tzinfo=datetime.timezone.utc
        )
    },
    content_type=('application/json', {'charset': 'UTF-8'}),
    content={'AnalysedFiles': 201, 'Traffic': 205581688}
)
>>> client.close()
Returns:

Returns an inlyse.cli.InlyseResponse object.

Return type:

InlyseResponse

upload_file(filename, content, *, path)[source]

upload(filename, content) Upload a local file.

Parameters:
  • filename (str) – The name of the file.

  • content (bytes) – The content of the file.

  • API endpoint: /api/files/

  • HTTP Method: POST

  • Response CONTENT-TYPE: application/json

Allowed file types: * Microsoft Office documents * PDF documents * ZIP files with exactly 1 Microsoft Office document or PDF document

HTTP Response Codes

Status Code

Explaination

200 - OK

If the request was successful, it returns the HTTP status code 200, the UUID of the analysis and an estimated time till the analysis is ready.

401 - Unauthorized

If the request was not authorized. In example if the license key is not valid anymore.

429 - Too Many Requests

If the quota is exceed, it returns the HTTP status 429.

Example:

>>> from inlyse import WebClient
>>> client = WebClient(<your license key>)
>>> with open("/tmp/javascript.pdf", "rb") as fp:
...     response = client.upload_file(os.path.basename(fp.name), fp.read())
>>> response
InlyseResponse(
    endpoint='/api/files/'
    status=200,
    rate_limit={
        'remaining': '14977',
        'reset': datetime.datetime(
            2023, 3, 20, 19, 45, 38, tzinfo=datetime.timezone.utc
        )
    },
    content_type=('application/json', {'charset': 'UTF-8'}),
    content={
        'id': '4e1ae479-583b-4d52-a080-88adf6502364',
        'EstimatedAnalysisTime': 5.83675
    }
)
>>> client.close()
Returns:

Returns an inlyse.cli.InlyseResponse object.

Return type:

InlyseResponse

upload_owa(url, token)[source]

Upload an outlook attachment.

Parameters:
  • url (str) – The download URL of the file.

  • token (str) – The token

  • API endpoint: /api/files/owa

  • HTTP Method: POST

  • Response CONTENT-TYPE: application/json

Allowed file types: * Microsoft Office documents * PDF documents * ZIP files with exactly 1 Microsoft Office document or PDF document

HTTP Response Codes

Status Code

Explaination

200 - OK

If the request was successful, it returns the HTTP status code 200, the UUID of the analysis and an estimated time till the analysis is ready.

401 - Unauthorized

If the request was not authorized. In example if the license key is not valid anymore.

429 - Too Many Requests

If the quota is exceed, it returns the HTTP status 429.

Example:

>>> from inlyse import WebClient
>>> client = WebClient(<your license key>)
>>> response = client.upload_owa(
... "https://attachments.office.net/owa/Max.Mustermann%40test.com/...",
... "iMWFWf1EZh8WM27tqXFlIa1QoNDfmjaZT0Xz7IyaDASBCUamUKcMKUSTVYJTOUm5...")
>>> response
InlyseResponse(
    endpoint='/api/files/owa',
    status=200,
    rate_limit={
        'remaining': '14988',
        'reset': datetime.datetime(
            2023, 3, 20, 20, 47, 35, tzinfo=datetime.timezone.utc
        )
    },
    content_type=('application/json', {'charset': 'UTF-8'}),
    content={
        'id': '1a13ba09-8487-4621-b2a3-b0ff460f7a9e',
        'EstimatedAnalysisTime': 5.83675
    }
)
>>> client.close()
Returns:

Returns an inlyse.cli.InlyseResponse object.

Return type:

InlyseResponse

upload_url(url)[source]

Upload a remote file. At the moment we only support http URLs.

Parameters:

url (str) – The download URL of the file.

Warning

The URL needs to be public. It’s not possible to send URLs which need authentication.

  • API endpoint: /api/files/url

  • HTTP Method: POST

  • Response CONTENT-TYPE: application/json

Allowed file types: * Microsoft Office documents * PDF documents * ZIP files with exactly 1 Microsoft Office document or PDF document

HTTP Response Codes

Status Code

Explaination

200 - OK

If the request was successful, it returns the HTTP status code 200, the UUID of the analysis and an estimated time till the analysis is ready.

401 - Unauthorized

If the request was not authorized. In example if the license key is not valid anymore.

429 - Too Many Requests

If the quota is exceed, it returns the HTTP status 429.

Example:

>>> from inlyse import WebClient
>>> client = WebClient(<your license key>)
>>> response = client.upload_url("https://arxiv.org/pdf/2004.14471.pdf")
>>> response
InlyseResponse(
    endpoint='/api/files/url'
    status=200,
    rate_limit={
        'remaining': '14988',
        'reset': datetime.datetime(
            2023, 3, 20, 20, 47, 35, tzinfo=datetime.timezone.utc
        )
    },
    content_type=('application/json', {'charset': 'UTF-8'}),
    content={
        'id': '1a13ba09-8487-4621-b2a3-b0ff460f7a9e',
        'EstimatedAnalysisTime': 5.83675
    }
)
>>> client.close()
Returns:

Returns an inlyse.cli.InlyseResponse object.

Return type:

InlyseResponse

version()[source]

Get the version of the API

  • API endpoint: /version

  • HTTP Method: GET

  • Response CONTENT-TYPE: application/json

HTTP Response Codes

Status Code

Explaination

200 - OK

If the version request was successful it returns the HTTP status code 200 and the current version.

Example:

>>> from inlyse import WebClient
>>> client = WebClient(<your license key>)
>>> response = client.version()
>>> response
InlyseResponse(
    endpoint='/version',
    status=200,
    rate_limit=None,
    content_type=('application/json', {'charset': 'UTF-8'}),
    content='1.7.4'
)
>>> client.close()
Returns:

Returns an inlyse.cli.InlyseResponse object.

Return type:

InlyseResponse

inlyse.exceptions — INLYSE API exceptions

Module for all exceptions

exception inlyse.exceptions.InlyseApiError(*args, **kwargs)[source]

The INLYSE API returned an error

exception inlyse.exceptions.MaxRetriesExceeded[source]

The maximal retries exceeded

exception inlyse.exceptions.RateLimitExceeded[source]

The rate limit for this license key exceeded

inlyse.app — INLYSE API console application

inlyse-scanner

inlyse-scanner [OPTIONS] COMMAND [ARGS]...

Options

--version

Show the version and exit.

-l, --license-key <license_key>

Required The license key for the INLYSE API.

-u, --url <url>

The URL of the INLYSE API.

Default:

https://malware.ai

-t, --threads <threads>

The number of threads.

Default:

4

--timeout <timeout>

The HTTP request timeout.

Default:

5.0

-v, --verbose

disarm

Disarm files

inlyse-scanner disarm [OPTIONS] [FILENAMES]...

Options

-o, --output-folder <output_folder>

The output folder for the disarmed documents.

Default:

.

Arguments

FILENAMES

Optional argument(s)

get

Get the analyses result(s)

inlyse-scanner get [OPTIONS] [ANALYSIS_IDS]...

Arguments

ANALYSIS_IDS

Optional argument(s)

list

List all analyses

inlyse-scanner list [OPTIONS]

Options

-f, --filter <analyses_filter>

Filter for the list of analyses.

Default:

all

Options:

all | finished | unfinished | error

scan

Scan files or URLs

inlyse-scanner scan [OPTIONS] COMMAND [ARGS]...
file

Scan files

inlyse-scanner scan file [OPTIONS] [FILENAMES]...

Arguments

FILENAMES

Optional argument(s)

url

Scan URLs

inlyse-scanner scan url [OPTIONS] [URLS]...

Arguments

URLS

Optional argument(s)

stats

Get some stats

inlyse-scanner stats [OPTIONS]