1.0.1 • Published 5 years ago

cythereal_magic v1.0.1

Weekly downloads
-
License
Unlicense
Repository
-
Last release
5 years ago

cythereal_magic

CytherealMagic - JavaScript client for cythereal_magic The API for accessing Cythereal MAGIC products and services. # API Clients We provide clients in several languages for accessing the MAGIC API. https://bitbucket.org/cythereal/magic-clients These clients are provided to make integration of the MAGIC API into your existing applications as easy as possible. If you want to use a language that is not currently supported, please contact us at support@cythereal.com and we will be glad to help. # Example Inputs Here are some example inputs that can be used for testing the service: Binary SHA1: ff9790d7902fea4c910b182f6e0b00221a40d616 Can be used for file_hash parameters. Procedure RVA: 0x1000 Use with the above SHA1 for proc_rva parameters. # API Conventions Properties MUST be named using snake_case. This API is inspired by the google json style guide. Any questions about conventions not documented here should be addressed by this style guide. All responses MUST be of type APIResponse and contain the following fields: api_version | The current api version success | Boolean value indicating if the operation succeeded. code | Status code. Typically corresponds to the HTTP status code. message | A human readable message providing more details about the operation. Can be null or empty. Successful operations MUST return a SuccessResponse, which extends APIResponse by adding: data | Properties containing the response object. success | MUST equal True When returning objects from a successful response, the data object SHOULD contain a property named after the requested object type. For example, the /matches endpoint should return a response object with data.matches. This property SHOULD contain a list of the returned objects. For the /matches endpoint, the data.matches property contains a list of MagicMatch objects. See the /matches endpoint documentation for an example. Failed Operations MUST return an ErrorResponse, which extends APIResponse by adding: errors | Array of error objects. An error object contains the following properties: ErrorObject.reason | Unique identifier for this error. Example: \"FileNotFoundError\". ErrorObject.message| Human readable error message. success | MUST equal False. This SDK is automatically generated by the Swagger Codegen project:

  • API version: 1
  • Package version: 1.0.1
  • Build package: io.swagger.codegen.languages.JavascriptClientCodegen For more information, please visit http://cythereal.com

Installation

For Node.js

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install cythereal_magic --save
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

Finally, switch to the directory you want to use your cythereal_magic from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

You should now be able to require('cythereal_magic') in javascript files from the directory you ran the last command above from.

git

If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var CytherealMagic = require('cythereal_magic');

var defaultClient = CytherealMagic.ApiClient.instance;

// Configure API key authorization: api_key_query_param
var api_key_query_param = defaultClient.authentications['api_key_query_param'];
api_key_query_param.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key_query_param.apiKeyPrefix['key'] = "Token"

var api = new CytherealMagic.AlphaApi()

var binaryId = ["binaryId_example"]; // {[String]} The SHA1 of the binary to add to your collection. Specify parameter multiple times to add multiple binaries.  Only public binaries will be added. The list of successfully added binaries will be in the 'data' key 


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.addBinary(binaryId, callback);

Documentation for API Endpoints

All URIs are relative to https://api.magic.cythereal.com/v1

ClassMethodHTTP requestDescription
CytherealMagic.AlphaApiaddBinaryGET /files/add/Add public binaries to your account
CytherealMagic.AlphaApicheckAccessGET /files/{file_hash}/check_accessReturns a success if the user has access to this file
CytherealMagic.AlphaApigetCampaignInfoGET /campaigns/{campaign_id}/List available information for the campaign id
CytherealMagic.AlphaApigetCampaignMembersGET /campaigns/{campaign_id}/membersMembers of the campaign
CytherealMagic.AlphaApigetFileStatusGET /files/{file_hash}/status/Get processing status of the file.
CytherealMagic.AlphaApigetMagicYaraGET /signatures/magic_yara/\"Generate a yara rule, and campaign information for the provided binaries.\"
CytherealMagic.AlphaApigetProcedureSignaturesGET /signatures/procedures/Generate procedure signatures for provided binaries.
CytherealMagic.AlphaApigetProceduresReportGET /procedures/{proc_hash}/reportGenerate the report for the given procedures
CytherealMagic.AlphaApigetYaraRuleGET /signatures/yara/Generate a yara rule for the provided binaries.
CytherealMagic.AlphaApimakeFilePublicGET /files/{file_hash}/make_publicAllows a user to make their file public
CytherealMagic.CytherealMagicApicreateFilePOST /files/Upload a file for processing
CytherealMagic.CytherealMagicApidownloadFileGET /files/{file_hash}Download a file
CytherealMagic.CytherealMagicApigetBinaryGenomicsGET /genomics/{file_hash}/Show the genomic features for a given binary.
CytherealMagic.CytherealMagicApigetCampaignIdGET /reports/{file_hash}/campaignGet the campaign id for a binary.
CytherealMagic.CytherealMagicApigetFileInfoGET /files/{file_hash}/info/Get file info and analysis status
CytherealMagic.CytherealMagicApigetOwnedFilesGET /files/List files owned by the authenticated user.
CytherealMagic.CytherealMagicApigetProcedureGenomicsGET /genomics/{file_hash}/{proc_rva}/Show the genomic features for a given procedure.
CytherealMagic.CytherealMagicApigetReportGET /reports/{file_hash}/Get the Magic report for a binary.
CytherealMagic.CytherealMagicApigetReportCategoriesGET /reports/{file_hash}/categories/Retrieve the MAGIC categories for a binary.
CytherealMagic.CytherealMagicApigetReportLabelsGET /reports/{file_hash}/labels/Retrieve the MAGIC labels report for a binary.
CytherealMagic.CytherealMagicApigetReportMatchesGET /reports/{file_hash}/matches/Retrieve the MAGIC matches for a binary.
CytherealMagic.CytherealMagicApigetSimilarBinariesGET /similarities/{file_hash}/Search for similar binaries.
CytherealMagic.CytherealMagicApigetSimilarProceduresGET /similarities/{file_hash}/{proc_rva}/Search for procedures similar to a given procedure.
CytherealMagic.CytherealMagicApipingGET /ping/Check if server is responding to queries.
CytherealMagic.CytherealMagicApireprocessFileGET /files/{file_hash}/reprocess/Reprocess a previously uploaded file

Documentation for Models

Documentation for Authorization

api_key_query_param

  • Type: API key
  • API key parameter name: key
  • Location: URL query string