# Tutorial¶

This tutorial helps you get started using MAGIC through a walk through of several capabilities MAGIC provides.

If you haven’t yet, first go through Accessing API.

In this tutorial, we will assume that the following variables are available:

Variable Description
MAGIC_API_KEY The API key used to access the MAGIC API.
BINARY_HASH The SHA1 of a binary. 2d9035b27ce5c1cce2fb8432c76e315a1a2a8de0 in this tutorial

To start, let’s upload our binary to MAGIC. In addition to individual binaries, archives, such as zip or tar, are also supported.

curl -X POST \
-F "[email protected]/sample.exe" \
-F "filename=sample.exe" \
"https://api.magic.cythereal.com/v1/files/?key=${MAGIC_API_KEY}"  You can also use the cythereal-magic command line utility: cythereal-magic --key=${MAGIC_API_KEY} upload ./sample.exe


## Check status of Analysis¶

In order to check the status of our uploaded file, we need to know the sha1sum of this file. On linux, this can be found using the sha1sum command.

To get the result of analysis:

curl "https://api.magic.cythereal.com/v1/files/${BINARY_HASH}/info/?key=${MAGIC_API_KEY}"


This results in the following (See magic-api-format for description of communication protocol.):

{
"api_version": "1.0.0"
"success": true,
"code": 200,
"data": {
"sha1": "2d9035b27ce5c1cce2fb8432c76e315a1a2a8de0",
"sha256": "338370573c7f275161f7d08cd9a309bcf41c078bf44d4fd50be997e7b83fc856",
"sha512": "7a73805bdb8a6cf15d7b4c07b25edd17fe9fb3af7aa514497c47bdaaafa3526b929c757d26ca859a432c3295ed2ea352479f5b175eb6f72ef57c8c83d45f7f0d",
"md5": "a7fd6503d8bc6d0e61b779d968568067"
"unix_filetype": "PE32 executable (GUI) Intel 80386, for MS Windows",
"filepath": [
"./archive",
],
"parents": [
],
"object_class": "binary.pe32",
"children": [
{
"service_name": "srlUnpacker",
"status": "success",
"child": "9bbc14d35aaa53283734826ef54a4e272ae51f01"
},
{
"service_name": "srlJuice",
"status": "sucess",
},
{
"service_name": "srlSimilarity",
"status": "success",
}
],
},
}


The status of the various analyses provided by MAGIC are present in the children field. A pending analysis will not have any entry in this field, a failed analysis will have its status field set to “failure” or “failed”, and a successful analysis will have its status set to success.

This file has been successfully unpacked, the genomic information has been successfully extracted, and the magic report correlations are ready. The unpacked version of this file has a SHA1 of 6efb5c849b400af96b993284f6d39746b6bdb2e6. To get the status of the unpacked file, an additional query would have to be made.