cythereal_magic

1.0.1 • Public • Published

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

Class Method HTTP request Description
CytherealMagic.AlphaApi addBinary GET /files/add/ Add public binaries to your account
CytherealMagic.AlphaApi checkAccess GET /files/{file_hash}/check_access Returns a success if the user has access to this file
CytherealMagic.AlphaApi getCampaignInfo GET /campaigns/{campaign_id}/ List available information for the campaign id
CytherealMagic.AlphaApi getCampaignMembers GET /campaigns/{campaign_id}/members Members of the campaign
CytherealMagic.AlphaApi getFileStatus GET /files/{file_hash}/status/ Get processing status of the file.
CytherealMagic.AlphaApi getMagicYara GET /signatures/magic_yara/ &quot;Generate a yara rule, and campaign information for the provided binaries.&quot;
CytherealMagic.AlphaApi getProcedureSignatures GET /signatures/procedures/ Generate procedure signatures for provided binaries.
CytherealMagic.AlphaApi getProceduresReport GET /procedures/{proc_hash}/report Generate the report for the given procedures
CytherealMagic.AlphaApi getYaraRule GET /signatures/yara/ Generate a yara rule for the provided binaries.
CytherealMagic.AlphaApi makeFilePublic GET /files/{file_hash}/make_public Allows a user to make their file public
CytherealMagic.CytherealMagicApi createFile POST /files/ Upload a file for processing
CytherealMagic.CytherealMagicApi downloadFile GET /files/{file_hash} Download a file
CytherealMagic.CytherealMagicApi getBinaryGenomics GET /genomics/{file_hash}/ Show the genomic features for a given binary.
CytherealMagic.CytherealMagicApi getCampaignId GET /reports/{file_hash}/campaign Get the campaign id for a binary.
CytherealMagic.CytherealMagicApi getFileInfo GET /files/{file_hash}/info/ Get file info and analysis status
CytherealMagic.CytherealMagicApi getOwnedFiles GET /files/ List files owned by the authenticated user.
CytherealMagic.CytherealMagicApi getProcedureGenomics GET /genomics/{file_hash}/{proc_rva}/ Show the genomic features for a given procedure.
CytherealMagic.CytherealMagicApi getReport GET /reports/{file_hash}/ Get the Magic report for a binary.
CytherealMagic.CytherealMagicApi getReportCategories GET /reports/{file_hash}/categories/ Retrieve the MAGIC categories for a binary.
CytherealMagic.CytherealMagicApi getReportLabels GET /reports/{file_hash}/labels/ Retrieve the MAGIC labels report for a binary.
CytherealMagic.CytherealMagicApi getReportMatches GET /reports/{file_hash}/matches/ Retrieve the MAGIC matches for a binary.
CytherealMagic.CytherealMagicApi getSimilarBinaries GET /similarities/{file_hash}/ Search for similar binaries.
CytherealMagic.CytherealMagicApi getSimilarProcedures GET /similarities/{file_hash}/{proc_rva}/ Search for procedures similar to a given procedure.
CytherealMagic.CytherealMagicApi ping GET /ping/ Check if server is responding to queries.
CytherealMagic.CytherealMagicApi reprocessFile GET /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

Readme

Keywords

none

Package Sidebar

Install

npm i cythereal_magic

Weekly Downloads

4

Version

1.0.1

License

Unlicense

Unpacked Size

867 kB

Total Files

198

Last publish

Collaborators

  • hubbard.zlee